LZ4_compressBound:
  779|     82|int LZ4_compressBound(int isize)  { return LZ4_COMPRESSBOUND(isize); }
  ------------------
  |  |  222|     82|#define LZ4_COMPRESSBOUND(isize)  ((unsigned)(isize) > (unsigned)LZ4_MAX_INPUT_SIZE ? 0 : (isize) + ((isize)/255) + 16)
  |  |  ------------------
  |  |  |  |  221|     82|#define LZ4_MAX_INPUT_SIZE        0x7E000000   /* 2 113 929 216 bytes */
  |  |  ------------------
  |  |  |  Branch (222:36): [True: 0, False: 82]
  |  |  ------------------
  ------------------
LZ4_compress_fast_extState_fastReset:
 1570|     82|{
 1571|     82|    LZ4_stream_t_internal* const ctx = &((LZ4_stream_t*)state)->internal_donotuse;
 1572|     82|    acceleration = LZ4_clampAcceleration(acceleration);
 1573|     82|    assert(ctx != NULL);
  ------------------
  |  |  273|     82|#    define assert(condition) ((void)0)
  ------------------
 1574|       |
 1575|     82|    if (dstCapacity >= LZ4_compressBound(srcSize)) {
  ------------------
  |  Branch (1575:9): [True: 0, False: 82]
  ------------------
 1576|      0|        return LZ4_compress_fastReset_generic(ctx, src, dst, srcSize, 0, notLimited, acceleration);
 1577|     82|    } else {
 1578|     82|        return LZ4_compress_fastReset_generic(ctx, src, dst, srcSize, dstCapacity, limitedOutput, acceleration);
 1579|     82|    }
 1580|     82|}
LZ4_createStream:
 1662|      5|{
 1663|      5|    LZ4_stream_t* const lz4s = (LZ4_stream_t*)ALLOC(sizeof(LZ4_stream_t));
  ------------------
  |  |  225|      5|# define ALLOC(s)          malloc(s)
  ------------------
 1664|      5|    LZ4_STATIC_ASSERT(sizeof(LZ4_stream_t) >= sizeof(LZ4_stream_t_internal));
  ------------------
  |  |  277|      5|#define LZ4_STATIC_ASSERT(c)   { enum { LZ4_static_assert = 1/(int)(!!(c)) }; }   /* use after variable declarations */
  ------------------
 1665|      5|    DEBUGLOG(4, "LZ4_createStream %p", (void*)lz4s);
  ------------------
  |  |  289|      5|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1666|      5|    if (lz4s == NULL) return NULL;
  ------------------
  |  Branch (1666:9): [True: 0, False: 5]
  ------------------
 1667|      5|    LZ4_initStream(lz4s, sizeof(*lz4s));
 1668|      5|    return lz4s;
 1669|      5|}
LZ4_initStream:
 1683|      5|{
 1684|      5|    DEBUGLOG(5, "LZ4_initStream");
  ------------------
  |  |  289|      5|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1685|      5|    if (buffer == NULL) { return NULL; }
  ------------------
  |  Branch (1685:9): [True: 0, False: 5]
  ------------------
 1686|      5|    if (size < sizeof(LZ4_stream_t)) { return NULL; }
  ------------------
  |  Branch (1686:9): [True: 0, False: 5]
  ------------------
 1687|      5|    if (!LZ4_isAligned(buffer, LZ4_stream_t_alignment())) return NULL;
  ------------------
  |  Branch (1687:9): [True: 0, False: 5]
  ------------------
 1688|      5|    MEM_INIT(buffer, 0, sizeof(LZ4_stream_t_internal));
  ------------------
  |  |  236|      5|#define MEM_INIT(p,v,s)   LZ4_memset((p),(v),(s))
  |  |  ------------------
  |  |  |  |  234|      5|#  define LZ4_memset(p,v,s) memset((p),(v),(s))
  |  |  ------------------
  ------------------
 1689|      5|    return (LZ4_stream_t*)buffer;
 1690|      5|}
LZ4_freeStream:
 1706|      5|{
 1707|      5|    if (!LZ4_stream) return 0;   /* support free on NULL */
  ------------------
  |  Branch (1707:9): [True: 0, False: 5]
  ------------------
 1708|      5|    DEBUGLOG(5, "LZ4_freeStream %p", (void*)LZ4_stream);
  ------------------
  |  |  289|      5|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1709|      5|    FREEMEM(LZ4_stream);
  ------------------
  |  |  227|      5|# define FREEMEM(p)        free(p)
  ------------------
 1710|      5|    return (0);
 1711|      5|}
LZ4_decompress_safe:
 2570|    120|{
 2571|    120|    return LZ4_decompress_generic(source, dest, compressedSize, maxDecompressedSize,
 2572|    120|                                  decode_full_block, noDict,
 2573|       |                                  (BYTE*)dest, NULL, 0);
 2574|    120|}
lz4.c:LZ4_clampAcceleration:
 1513|     82|{
 1514|     82|    if (acceleration < 1) return LZ4_ACCELERATION_DEFAULT;
  ------------------
  |  |  614|      0|#define LZ4_ACCELERATION_DEFAULT 1
  ------------------
  |  Branch (1514:9): [True: 0, False: 82]
  ------------------
 1515|     82|    if (acceleration > LZ4_ACCELERATION_MAX) return LZ4_ACCELERATION_MAX;
  ------------------
  |  |  615|     82|#define LZ4_ACCELERATION_MAX 65537
  ------------------
                  if (acceleration > LZ4_ACCELERATION_MAX) return LZ4_ACCELERATION_MAX;
  ------------------
  |  |  615|      0|#define LZ4_ACCELERATION_MAX 65537
  ------------------
  |  Branch (1515:9): [True: 0, False: 82]
  ------------------
 1516|     82|    return acceleration;
 1517|     82|}
lz4.c:LZ4_compress_fastReset_generic:
 1537|     82|{
 1538|     82|    if (srcSize < LZ4_64Klimit) {
  ------------------
  |  Branch (1538:9): [True: 82, False: 0]
  ------------------
 1539|     82|        LZ4_prepareTable(ctx, srcSize, byU16);
 1540|     82|        if (ctx->currentOffset) {  /* table re-used : stale entries must be rejected */
  ------------------
  |  Branch (1540:13): [True: 77, False: 5]
  ------------------
 1541|     77|            return LZ4_compress_generic(ctx, src, dst, srcSize, NULL, dstCapacity, outputDirective, byU16, noDict, dictSmall, acceleration);
 1542|     77|        } else {
 1543|      5|            return LZ4_compress_generic(ctx, src, dst, srcSize, NULL, dstCapacity, outputDirective, byU16, noDict, noDictIssue, acceleration);
 1544|      5|        }
 1545|     82|    } else {
 1546|      0|        const tableType_t tableType = LZ4_largeInputTableType(src);
 1547|      0|        LZ4_prepareTable(ctx, srcSize, tableType);
 1548|       |        return LZ4_compress_generic(ctx, src, dst, srcSize, NULL, dstCapacity, outputDirective, tableType, noDict, noDictIssue, acceleration);
 1549|      0|    }
 1550|     82|}
lz4.c:LZ4_isAligned:
  293|      5|{
  294|      5|    return ((size_t)ptr & (alignment -1)) == 0;
  295|      5|}
lz4.c:LZ4_stream_t_alignment:
 1673|      5|{
 1674|      5|#if LZ4_ALIGN_TEST
 1675|      5|    typedef struct { char c; LZ4_stream_t t; } t_a;
 1676|      5|    return sizeof(t_a) - sizeof(LZ4_stream_t);
 1677|       |#else
 1678|       |    return 1;  /* effectively disabled */
 1679|       |#endif
 1680|      5|}
lz4.c:LZ4_prepareTable:
  942|     82|           const tableType_t tableType) {
  943|       |    /* If the table hasn't been used, it's guaranteed to be zeroed out, and is
  944|       |     * therefore safe to use no matter what mode we're in. Otherwise, we figure
  945|       |     * out if it's safe to leave as is or whether it needs to be reset.
  946|       |     */
  947|     82|    if ((tableType_t)cctx->tableType != clearedTable) {
  ------------------
  |  Branch (947:9): [True: 77, False: 5]
  ------------------
  948|     77|        assert(inputSize >= 0);
  ------------------
  |  |  273|     77|#    define assert(condition) ((void)0)
  ------------------
  949|     77|        if ((tableType_t)cctx->tableType != tableType
  ------------------
  |  Branch (949:13): [True: 0, False: 77]
  ------------------
  950|     77|          || ((tableType == byU16) && cctx->currentOffset + (unsigned)inputSize >= 0xFFFFU)
  ------------------
  |  Branch (950:15): [True: 77, False: 0]
  |  Branch (950:39): [True: 0, False: 77]
  ------------------
  951|     77|          || ((tableType == byU32) && cctx->currentOffset > 1 GB)
  ------------------
  |  |  253|      0|#define GB *(1U<<30)
  ------------------
  |  Branch (951:15): [True: 0, False: 77]
  |  Branch (951:39): [True: 0, False: 0]
  ------------------
  952|     77|          || tableType == byPtr
  ------------------
  |  Branch (952:14): [True: 0, False: 77]
  ------------------
  953|     77|          || inputSize >= LZ4_CLEAR_TABLE_THRESHOLD)
  ------------------
  |  |  937|     77|#define LZ4_CLEAR_TABLE_THRESHOLD (LZ4_HASHTABLESIZE / 16)
  |  |  ------------------
  |  |  |  |  713|     77|#define LZ4_HASHTABLESIZE (1 << LZ4_MEMORY_USAGE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  162|     77|# define LZ4_MEMORY_USAGE LZ4_MEMORY_USAGE_DEFAULT
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  167|     77|#define LZ4_MEMORY_USAGE_DEFAULT 14
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (953:14): [True: 0, False: 77]
  ------------------
  954|      0|        {
  955|      0|            DEBUGLOG(4, "LZ4_prepareTable: Resetting table in %p", (void*)cctx);
  ------------------
  |  |  289|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
  956|      0|            MEM_INIT(cctx->hashTable, 0, LZ4_HASHTABLESIZE);
  ------------------
  |  |  236|      0|#define MEM_INIT(p,v,s)   LZ4_memset((p),(v),(s))
  |  |  ------------------
  |  |  |  |  234|      0|#  define LZ4_memset(p,v,s) memset((p),(v),(s))
  |  |  ------------------
  ------------------
  957|      0|            cctx->currentOffset = 0;
  958|      0|            cctx->tableType = (U32)clearedTable;
  959|     77|        } else {
  960|     77|            DEBUGLOG(4, "LZ4_prepareTable: Re-use hash table (no reset)");
  ------------------
  |  |  289|     77|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
  961|     77|        }
  962|     77|    }
  963|       |
  964|       |    /* Adding a gap, so all previous entries are > LZ4_DISTANCE_MAX back,
  965|       |     * is faster than compressing without a gap.
  966|       |     * However, compressing with currentOffset == 0 is faster still,
  967|       |     * so we preserve that case.
  968|       |     */
  969|     82|    if (cctx->currentOffset != 0 && tableType == byU32) {
  ------------------
  |  Branch (969:9): [True: 77, False: 5]
  |  Branch (969:37): [True: 0, False: 77]
  ------------------
  970|      0|        DEBUGLOG(5, "LZ4_prepareTable: adding 64KB to currentOffset");
  ------------------
  |  |  289|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
  971|      0|        cctx->currentOffset += 64 KB;
  ------------------
  |  |  251|      0|#define KB *(1 <<10)
  ------------------
  972|      0|    }
  973|       |
  974|       |    /* Finally, clear history */
  975|     82|    cctx->dictCtx = NULL;
  976|       |    cctx->dictionary = NULL;
  977|     82|    cctx->dictSize = 0;
  978|     82|}
lz4.c:LZ4_hashPosition:
  852|  1.01k|{
  853|  1.01k|    if ((sizeof(reg_t)==8) && (tableType != byU16)) return LZ4_hash5(LZ4_read_ARCH(p), tableType);
  ------------------
  |  Branch (853:9): [True: 1.01k, Folded]
  |  Branch (853:31): [True: 0, False: 1.01k]
  ------------------
  854|       |
  855|       |#ifdef LZ4_STATIC_LINKING_ONLY_ENDIANNESS_INDEPENDENT_OUTPUT
  856|       |    return LZ4_hash4(LZ4_readLE32(p), tableType);
  857|       |#else
  858|  1.01k|    return LZ4_hash4(LZ4_read32(p), tableType);
  859|  1.01k|#endif
  860|  1.01k|}
lz4.c:LZ4_isLittleEndian:
  364|    501|{
  365|    501|    const union { U32 u; BYTE c[4]; } one = { 1 };   /* don't use static : performance detrimental */
  366|    501|    return one.c[0];
  367|    501|}
lz4.c:LZ4_read_ARCH:
  395|    498|static reg_t LZ4_read_ARCH(const void* ptr) { return ((const LZ4_unalignST*)ptr)->uArch; }
lz4.c:LZ4_hash4:
  834|  1.01k|{
  835|  1.01k|    const U32 hashLog = (tableType == byU16) ? LZ4_HASHLOG+1 : LZ4_HASHLOG;
  ------------------
  |  |  712|  1.01k|#define LZ4_HASHLOG   (LZ4_MEMORY_USAGE-2)
  |  |  ------------------
  |  |  |  |  162|  1.01k|# define LZ4_MEMORY_USAGE LZ4_MEMORY_USAGE_DEFAULT
  |  |  |  |  ------------------
  |  |  |  |  |  |  167|  1.01k|#define LZ4_MEMORY_USAGE_DEFAULT 14
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                  const U32 hashLog = (tableType == byU16) ? LZ4_HASHLOG+1 : LZ4_HASHLOG;
  ------------------
  |  |  712|  1.01k|#define LZ4_HASHLOG   (LZ4_MEMORY_USAGE-2)
  |  |  ------------------
  |  |  |  |  162|      0|# define LZ4_MEMORY_USAGE LZ4_MEMORY_USAGE_DEFAULT
  |  |  |  |  ------------------
  |  |  |  |  |  |  167|      0|#define LZ4_MEMORY_USAGE_DEFAULT 14
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (835:25): [True: 1.01k, False: 0]
  ------------------
  836|  1.01k|    return ((sequence * 2654435761U) >> ((MINMATCH*8)-hashLog));
  ------------------
  |  |  242|  1.01k|#define MINMATCH 4
  ------------------
  837|  1.01k|}
lz4.c:LZ4_read32:
  394|  1.38k|static U32 LZ4_read32(const void* ptr) { return ((const LZ4_unalign32*)ptr)->u32; }
lz4.c:LZ4_putIndexOnHash:
  875|    868|{
  876|    868|    switch (tableType)
  877|    868|    {
  878|      0|    default: /* fallthrough */
  ------------------
  |  Branch (878:5): [True: 0, False: 868]
  ------------------
  879|      0|    case clearedTable: /* fallthrough */
  ------------------
  |  Branch (879:5): [True: 0, False: 868]
  ------------------
  880|      0|    case byPtr: { /* illegal! */ assert(0); return; }
  ------------------
  |  |  273|      0|#    define assert(condition) ((void)0)
  ------------------
  |  Branch (880:5): [True: 0, False: 868]
  ------------------
  881|      0|    case byU32: { U32* hashTable = (U32*) tableBase; hashTable[h] = idx; return; }
  ------------------
  |  Branch (881:5): [True: 0, False: 868]
  ------------------
  882|    868|    case byU16: { U16* hashTable = (U16*) tableBase; assert(idx < 65536); hashTable[h] = (U16)idx; return; }
  ------------------
  |  |  273|    868|#    define assert(condition) ((void)0)
  ------------------
  |  Branch (882:5): [True: 868, False: 0]
  ------------------
  883|    868|    }
  884|    868|}
lz4.c:LZ4_getIndexOnHash:
  914|    835|{
  915|    835|    LZ4_STATIC_ASSERT(LZ4_MEMORY_USAGE > 2);
  ------------------
  |  |  277|    835|#define LZ4_STATIC_ASSERT(c)   { enum { LZ4_static_assert = 1/(int)(!!(c)) }; }   /* use after variable declarations */
  ------------------
  916|    835|    if (tableType == byU32) {
  ------------------
  |  Branch (916:9): [True: 0, False: 835]
  ------------------
  917|      0|        const U32* const hashTable = (const U32*) tableBase;
  918|      0|        assert(h < (1U << (LZ4_MEMORY_USAGE-2)));
  ------------------
  |  |  273|      0|#    define assert(condition) ((void)0)
  ------------------
  919|      0|        return hashTable[h];
  920|      0|    }
  921|    835|    if (tableType == byU16) {
  ------------------
  |  Branch (921:9): [True: 835, False: 0]
  ------------------
  922|    835|        const U16* const hashTable = (const U16*) tableBase;
  923|    835|        assert(h < (1U << (LZ4_MEMORY_USAGE-1)));
  ------------------
  |  |  273|    835|#    define assert(condition) ((void)0)
  ------------------
  924|    835|        return hashTable[h];
  925|    835|    }
  926|      0|    assert(0); return 0;  /* forbidden case */
  ------------------
  |  |  273|      0|#    define assert(condition) ((void)0)
  ------------------
  927|    835|}
lz4.c:LZ4_compress_generic:
 1469|     82|{
 1470|     82|    DEBUGLOG(5, "LZ4_compress_generic: srcSize=%i, dstCapacity=%i",
  ------------------
  |  |  289|     82|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1471|     82|                srcSize, dstCapacity);
 1472|       |
 1473|     82|    if ((U32)srcSize > (U32)LZ4_MAX_INPUT_SIZE) { return 0; }  /* Unsupported srcSize, too large (or negative) */
  ------------------
  |  |  221|     82|#define LZ4_MAX_INPUT_SIZE        0x7E000000   /* 2 113 929 216 bytes */
  ------------------
  |  Branch (1473:9): [True: 0, False: 82]
  ------------------
 1474|     82|    if (srcSize == 0) {   /* src == NULL supported if srcSize == 0 */
  ------------------
  |  Branch (1474:9): [True: 0, False: 82]
  ------------------
 1475|      0|        if (outputDirective != notLimited && dstCapacity <= 0) return 0;  /* no output, can't write anything */
  ------------------
  |  Branch (1475:13): [True: 0, False: 0]
  |  Branch (1475:46): [True: 0, False: 0]
  ------------------
 1476|      0|        DEBUGLOG(5, "Generating an empty block");
  ------------------
  |  |  289|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1477|      0|        assert(outputDirective == notLimited || dstCapacity >= 1);
  ------------------
  |  |  273|      0|#    define assert(condition) ((void)0)
  ------------------
 1478|      0|        assert(dst != NULL);
  ------------------
  |  |  273|      0|#    define assert(condition) ((void)0)
  ------------------
 1479|      0|        dst[0] = 0;
 1480|      0|        if (outputDirective == fillOutput) {
  ------------------
  |  Branch (1480:13): [True: 0, False: 0]
  ------------------
 1481|      0|            assert (inputConsumed != NULL);
  ------------------
  |  |  273|      0|#    define assert(condition) ((void)0)
  ------------------
 1482|      0|            *inputConsumed = 0;
 1483|      0|        }
 1484|      0|        return 1;
 1485|      0|    }
 1486|     82|    assert(src != NULL);
  ------------------
  |  |  273|     82|#    define assert(condition) ((void)0)
  ------------------
 1487|       |
 1488|     82|    if ((dictDirective == usingExtDict) && (dictIssue == noDictIssue)) {
  ------------------
  |  Branch (1488:9): [True: 0, False: 82]
  |  Branch (1488:44): [True: 0, False: 0]
  ------------------
 1489|       |        /* beyond LZ4_DISTANCE_MAX, the dictionary is out of reach : the rest of the input is compressed in prefix mode */
 1490|      0|        LZ4_resume_t state;
 1491|      0|        int result;
 1492|      0|        assert(tableType == byU32);
  ------------------
  |  |  273|      0|#    define assert(condition) ((void)0)
  ------------------
 1493|      0|        assert(outputDirective != fillOutput);
  ------------------
  |  |  273|      0|#    define assert(condition) ((void)0)
  ------------------
 1494|      0|        state.ip = NULL;
 1495|      0|        result = LZ4_compress_generic_validated(cctx, src, dst, srcSize, inputConsumed, dstCapacity, outputDirective,
 1496|      0|                    tableType, usingExtDict, noDictIssue, acceleration, &state, NULL);
 1497|      0|        if (state.ip == NULL) return result;   /* completed (or failed) in extDict mode */
  ------------------
  |  Branch (1497:13): [True: 0, False: 0]
  ------------------
 1498|       |        /* notLimited : dst is presumed large enough for LZ4_compressBound() */
 1499|      0|        return LZ4_compress_resumeWithPrefix(cctx, src, dst, srcSize,
 1500|      0|                    (outputDirective == notLimited) ? LZ4_COMPRESSBOUND(srcSize) : dstCapacity,
  ------------------
  |  |  222|      0|#define LZ4_COMPRESSBOUND(isize)  ((unsigned)(isize) > (unsigned)LZ4_MAX_INPUT_SIZE ? 0 : (isize) + ((isize)/255) + 16)
  |  |  ------------------
  |  |  |  |  221|      0|#define LZ4_MAX_INPUT_SIZE        0x7E000000   /* 2 113 929 216 bytes */
  |  |  ------------------
  |  |  |  Branch (222:36): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (1500:21): [True: 0, False: 0]
  ------------------
 1501|      0|                    acceleration, &state);
 1502|      0|    }
 1503|       |
 1504|     82|    return LZ4_compress_generic_validated(cctx, src, dst, srcSize,
 1505|     82|                inputConsumed, /* only written into if outputDirective == fillOutput */
 1506|     82|                dstCapacity, outputDirective,
 1507|     82|                tableType, dictDirective, dictIssue, acceleration, NULL, NULL);
 1508|     82|}
lz4.c:LZ4_compress_generic_validated:
 1015|     82|{
 1016|     82|    int result;
 1017|     82|    const BYTE* ip = resume ? resume->ip : (const BYTE*)source;
  ------------------
  |  Branch (1017:22): [True: 0, False: 82]
  ------------------
 1018|       |
 1019|     82|    U32 const startIndex = resume ? resume->startIndex : cctx->currentOffset;
  ------------------
  |  Branch (1019:28): [True: 0, False: 82]
  ------------------
 1020|     82|    const BYTE* base = (const BYTE*)source - startIndex;
 1021|     82|    const BYTE* lowLimit;
 1022|       |
 1023|     82|    const LZ4_stream_t_internal* dictCtx = (const LZ4_stream_t_internal*) cctx->dictCtx;
 1024|     82|    const BYTE* const dictionary =
 1025|     82|        dictDirective == usingDictCtx ? dictCtx->dictionary : cctx->dictionary;
  ------------------
  |  Branch (1025:9): [True: 0, False: 82]
  ------------------
 1026|     82|    const U32 dictSize =
 1027|     82|        dictDirective == usingDictCtx ? dictCtx->dictSize : cctx->dictSize;
  ------------------
  |  Branch (1027:9): [True: 0, False: 82]
  ------------------
 1028|     82|    const U32 dictDelta =
 1029|     82|        (dictDirective == usingDictCtx) ? startIndex - dictCtx->currentOffset : 0;   /* make indexes in dictCtx comparable with indexes in current context */
  ------------------
  |  Branch (1029:9): [True: 0, False: 82]
  ------------------
 1030|       |
 1031|     82|    int const maybe_extMem = (dictDirective == usingExtDict) || (dictDirective == usingDictCtx);
  ------------------
  |  Branch (1031:30): [True: 0, False: 82]
  |  Branch (1031:65): [True: 0, False: 82]
  ------------------
 1032|     82|    U32 const prefixIdxLimit = startIndex - dictSize;   /* used when dictDirective == dictSmall */
 1033|     82|    const BYTE* const dictEnd = dictionary ? dictionary + dictSize : dictionary;
  ------------------
  |  Branch (1033:33): [True: 0, False: 82]
  ------------------
 1034|     82|    const BYTE* anchor = resume ? resume->ip : (const BYTE*)source;
  ------------------
  |  Branch (1034:26): [True: 0, False: 82]
  ------------------
 1035|     82|    const BYTE* const iend = (const BYTE*)source + inputSize;
 1036|     82|    const BYTE* mflimitPlusOne;   /* set after the size check : would precede a small input */
 1037|     82|    const BYTE* matchlimit;
 1038|     82|    const BYTE* seqLimit;   /* suspend : mflimitPlusOne, or earlier, where the dictionary gets out of reach */
 1039|       |
 1040|       |    /* the dictCtx currentOffset is indexed on the start of the dictionary,
 1041|       |     * while a dictionary in the current context precedes the currentOffset */
 1042|     82|    const BYTE* dictBase = (dictionary == NULL) ? NULL :
  ------------------
  |  Branch (1042:28): [True: 82, False: 0]
  ------------------
 1043|     82|                           (dictDirective == usingDictCtx) ?
  ------------------
  |  Branch (1043:28): [True: 0, False: 0]
  ------------------
 1044|      0|                            dictionary + dictSize - dictCtx->currentOffset :
 1045|      0|                            dictionary + dictSize - startIndex;
 1046|       |
 1047|     82|    BYTE* op = resume ? resume->op : (BYTE*)dest;
  ------------------
  |  Branch (1047:16): [True: 0, False: 82]
  ------------------
 1048|     82|    BYTE* const olimit = (BYTE*)dest + maxOutputSize;
 1049|       |
 1050|     82|    U32 offset = 0;
 1051|     82|    U32 forwardH;
 1052|     82|    const BYTE* filledIp = NULL;   /* fillOutput only ; set by catch up (resume : never with fillOutput) */
 1053|       |
 1054|     82|    DEBUGLOG(5, "LZ4_compress_generic_validated: srcSize=%i, tableType=%u", inputSize, tableType);
  ------------------
  |  |  289|     82|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1055|     82|    assert(ip != NULL);
  ------------------
  |  |  273|     82|#    define assert(condition) ((void)0)
  ------------------
 1056|     82|    if (tableType == byU16) assert(inputSize<LZ4_64Klimit);  /* Size too large (not within 64K limit) */
  ------------------
  |  |  273|     82|#    define assert(condition) ((void)0)
  ------------------
  |  Branch (1056:9): [True: 82, False: 0]
  ------------------
 1057|     82|    if (tableType == byPtr) assert(dictDirective==noDict);   /* only supported use case with byPtr */
  ------------------
  |  |  273|      0|#    define assert(condition) ((void)0)
  ------------------
  |  Branch (1057:9): [True: 0, False: 82]
  ------------------
 1058|       |    /* If init conditions are not met, we don't have to mark stream
 1059|       |     * as having dirty context, since no action was taken yet */
 1060|     82|    if (outputDirective == fillOutput && maxOutputSize < 1) { return 0; } /* Impossible to store anything */
  ------------------
  |  Branch (1060:9): [True: 0, False: 82]
  |  Branch (1060:42): [True: 0, False: 0]
  ------------------
 1061|     82|    assert(acceleration >= 1);
  ------------------
  |  |  273|     82|#    define assert(condition) ((void)0)
  ------------------
 1062|       |
 1063|       |    /* resume : candidates are within source (see LZ4_compress_generic()) */
 1064|     82|    lowLimit = (const BYTE*)source - ((dictDirective == withPrefix64k) && !resume ? dictSize : 0);
  ------------------
  |  Branch (1064:39): [True: 0, False: 82]
  |  Branch (1064:75): [True: 0, False: 0]
  ------------------
 1065|       |
 1066|     82|    if (!resume) {   /* resume : context state already updated */
  ------------------
  |  Branch (1066:9): [True: 82, False: 0]
  ------------------
 1067|       |        /* Update context state */
 1068|     82|        if (dictDirective == usingDictCtx) {
  ------------------
  |  Branch (1068:13): [True: 0, False: 82]
  ------------------
 1069|       |            /* Subsequent linked blocks can't use the dictionary. */
 1070|       |            /* Instead, they use the block we just compressed. */
 1071|      0|            cctx->dictCtx = NULL;
 1072|      0|            cctx->dictSize = (U32)inputSize;
 1073|     82|        } else {
 1074|     82|            cctx->dictSize += (U32)inputSize;
 1075|     82|        }
 1076|     82|        cctx->currentOffset += (U32)inputSize;
 1077|     82|        cctx->tableType = (U32)tableType;
 1078|       |
 1079|     82|        if (inputSize<LZ4_minLength) goto _last_literals;        /* Input too small, no compression (all literals) */
  ------------------
  |  Branch (1079:13): [True: 0, False: 82]
  ------------------
 1080|     82|    }
 1081|     82|    mflimitPlusOne = iend - MFLIMIT + 1;
  ------------------
  |  |  246|     82|#define MFLIMIT       12   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
 1082|     82|    matchlimit = iend - LASTLITERALS;
  ------------------
  |  |  245|     82|#define LASTLITERALS   5   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
 1083|     82|    seqLimit = mflimitPlusOne;
 1084|     82|    if ((suspend != NULL) && (inputSize > LZ4_DISTANCE_MAX + MFLIMIT - 1))   /* source + LZ4_DISTANCE_MAX < mflimitPlusOne */
  ------------------
  |  |  691|      0|#  define LZ4_DISTANCE_MAX 65535   /* set to maximum value by default */
  ------------------
                  if ((suspend != NULL) && (inputSize > LZ4_DISTANCE_MAX + MFLIMIT - 1))   /* source + LZ4_DISTANCE_MAX < mflimitPlusOne */
  ------------------
  |  |  246|      0|#define MFLIMIT       12   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
  |  Branch (1084:9): [True: 0, False: 82]
  |  Branch (1084:30): [True: 0, False: 0]
  ------------------
 1085|      0|        seqLimit = (const BYTE*)source + LZ4_DISTANCE_MAX;
  ------------------
  |  |  691|      0|#  define LZ4_DISTANCE_MAX 65535   /* set to maximum value by default */
  ------------------
 1086|       |
 1087|     82|    if (resume) goto _resume;
  ------------------
  |  Branch (1087:9): [True: 0, False: 82]
  ------------------
 1088|       |
 1089|       |    /* First Byte */
 1090|     82|    LZ4_putPosition(ip, cctx->hashTable, tableType, base);
 1091|     82|    ip++; forwardH = LZ4_hashPosition(ip, tableType);
 1092|       |
 1093|       |    /* Main Loop */
 1094|    142|    for ( ; ; ) {
 1095|    142|        const BYTE* match;
 1096|    142|        BYTE* token;
 1097|       |
 1098|       |        /* Find a match */
 1099|    142|        if (tableType == byPtr) {
  ------------------
  |  Branch (1099:13): [True: 0, False: 142]
  ------------------
 1100|      0|            const BYTE* forwardIp = ip;
 1101|      0|            int step = 1;
 1102|      0|            int searchMatchNb = acceleration << LZ4_skipTrigger;
 1103|      0|            do {
 1104|      0|                U32 const h = forwardH;
 1105|      0|                ip = forwardIp;
 1106|      0|                forwardIp += step;
 1107|      0|                step = (searchMatchNb++ >> LZ4_skipTrigger);
 1108|       |
 1109|      0|                if (unlikely(forwardIp > mflimitPlusOne)) goto _last_literals;
  ------------------
  |  |  180|      0|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|      0|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1110|      0|                assert(ip < mflimitPlusOne);
  ------------------
  |  |  273|      0|#    define assert(condition) ((void)0)
  ------------------
 1111|       |
 1112|      0|                match = LZ4_getPositionOnHash(h, cctx->hashTable, tableType);
 1113|      0|                forwardH = LZ4_hashPosition(forwardIp, tableType);
 1114|      0|                LZ4_putPositionOnHash(ip, h, cctx->hashTable, tableType);
 1115|       |
 1116|      0|            } while ( (match+LZ4_DISTANCE_MAX < ip)
  ------------------
  |  |  691|      0|#  define LZ4_DISTANCE_MAX 65535   /* set to maximum value by default */
  ------------------
  |  Branch (1116:23): [True: 0, False: 0]
  ------------------
 1117|      0|                   || (LZ4_read32(match) != LZ4_read32(ip)) );
  ------------------
  |  Branch (1117:23): [True: 0, False: 0]
  ------------------
 1118|       |
 1119|    142|        } else {   /* byU32, byU16 */
 1120|       |
 1121|    142|            const BYTE* forwardIp = ip;
 1122|    142|            int step = 1;
 1123|    142|            int searchMatchNb = acceleration << LZ4_skipTrigger;
 1124|    666|            do {
 1125|    666|                U32 const h = forwardH;
 1126|    666|                U32 const current = (U32)(forwardIp - base);
 1127|    666|                U32 matchIndex = LZ4_getIndexOnHash(h, cctx->hashTable, tableType);
 1128|    666|                assert(matchIndex <= current);
  ------------------
  |  |  273|    666|#    define assert(condition) ((void)0)
  ------------------
 1129|    666|                assert(forwardIp - base < (ptrdiff_t)(2 GB - 1));
  ------------------
  |  |  273|    666|#    define assert(condition) ((void)0)
  ------------------
 1130|    666|                ip = forwardIp;
 1131|    666|                forwardIp += step;
 1132|    666|                step = (searchMatchNb++ >> LZ4_skipTrigger);
 1133|       |
 1134|    666|                if (unlikely(forwardIp > mflimitPlusOne)) goto _last_literals;
  ------------------
  |  |  180|    666|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|    666|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 54, False: 612]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1135|    612|                assert(ip < mflimitPlusOne);
  ------------------
  |  |  273|    612|#    define assert(condition) ((void)0)
  ------------------
 1136|       |
 1137|    612|                if (dictDirective == usingDictCtx) {
  ------------------
  |  Branch (1137:21): [True: 0, False: 612]
  ------------------
 1138|      0|                    if (matchIndex < startIndex) {
  ------------------
  |  Branch (1138:25): [True: 0, False: 0]
  ------------------
 1139|       |                        /* there was no match, try the dictionary */
 1140|      0|                        assert(tableType == byU32);
  ------------------
  |  |  273|      0|#    define assert(condition) ((void)0)
  ------------------
 1141|      0|                        matchIndex = LZ4_getIndexOnHash(h, dictCtx->hashTable, byU32);
 1142|      0|                        match = dictBase + matchIndex;
 1143|      0|                        matchIndex += dictDelta;   /* make dictCtx index comparable with current context */
 1144|      0|                        lowLimit = dictionary;
 1145|      0|                    } else {
 1146|      0|                        match = base + matchIndex;
 1147|      0|                        lowLimit = (const BYTE*)source;
 1148|      0|                    }
 1149|    612|                } else if (dictDirective == usingExtDict) {
  ------------------
  |  Branch (1149:28): [True: 0, False: 612]
  ------------------
 1150|       |                    /* select without branch : dictionary and prefix candidates alternate unpredictably.
 1151|       |                     * relative to dictEnd or source, within their buffers (base can be NULL) */
 1152|      0|                    ptrdiff_t const relIdx = (ptrdiff_t)matchIndex - (ptrdiff_t)startIndex;   /* < 0 : within dictionary */
 1153|      0|                    match = ((relIdx < 0) ? dictEnd : (const BYTE*)source) + relIdx;
  ------------------
  |  Branch (1153:30): [True: 0, False: 0]
  ------------------
 1154|    612|                } else {   /* single continuous memory segment */
 1155|    612|                    match = base + matchIndex;
 1156|    612|                }
 1157|    612|                forwardH = LZ4_hashPosition(forwardIp, tableType);
 1158|    612|                LZ4_putIndexOnHash(current, h, cctx->hashTable, tableType);
 1159|       |
 1160|    612|                DEBUGLOG(7, "candidate at pos=%u  (offset=%u \n", matchIndex, current - matchIndex);
  ------------------
  |  |  289|    612|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1161|    612|                if ((dictIssue == dictSmall) && (matchIndex < prefixIdxLimit)) { continue; }    /* match outside of valid area */
  ------------------
  |  Branch (1161:21): [True: 566, False: 46]
  |  Branch (1161:49): [True: 481, False: 85]
  ------------------
 1162|    131|                assert(matchIndex < current);
  ------------------
  |  |  273|    131|#    define assert(condition) ((void)0)
  ------------------
 1163|       |                /* noDict : the candidate is within input, so it is compared before checking its distance :
 1164|       |                 * this order is faster (better branch prediction) */
 1165|    131|                assert((dictDirective != noDict) || (match >= (const BYTE*)source));
  ------------------
  |  |  273|    131|#    define assert(condition) ((void)0)
  ------------------
 1166|    131|                if ( (dictDirective != noDict)
  ------------------
  |  Branch (1166:22): [True: 0, False: 131]
  ------------------
 1167|      0|                  && ((tableType != byU16) || (LZ4_DISTANCE_MAX < LZ4_DISTANCE_ABSOLUTE_MAX))
  ------------------
  |  |  691|      0|#  define LZ4_DISTANCE_MAX 65535   /* set to maximum value by default */
  ------------------
                                && ((tableType != byU16) || (LZ4_DISTANCE_MAX < LZ4_DISTANCE_ABSOLUTE_MAX))
  ------------------
  |  |  255|      0|#define LZ4_DISTANCE_ABSOLUTE_MAX 65535
  ------------------
  |  Branch (1167:23): [True: 0, False: 0]
  |  Branch (1167:47): [Folded, False: 0]
  ------------------
 1168|      0|                  && (matchIndex+LZ4_DISTANCE_MAX < current)) {
  ------------------
  |  |  691|      0|#  define LZ4_DISTANCE_MAX 65535   /* set to maximum value by default */
  ------------------
  |  Branch (1168:22): [True: 0, False: 0]
  ------------------
 1169|      0|                    continue;
 1170|      0|                } /* too far */
 1171|       |
 1172|    131|                if (LZ4_read32(match) == LZ4_read32(ip)) {
  ------------------
  |  Branch (1172:21): [True: 88, False: 43]
  ------------------
 1173|     88|                    if ( (dictDirective == noDict)
  ------------------
  |  Branch (1173:26): [True: 88, False: 0]
  ------------------
 1174|     88|                      && ((tableType != byU16) || (LZ4_DISTANCE_MAX < LZ4_DISTANCE_ABSOLUTE_MAX))
  ------------------
  |  |  691|     88|#  define LZ4_DISTANCE_MAX 65535   /* set to maximum value by default */
  ------------------
                                    && ((tableType != byU16) || (LZ4_DISTANCE_MAX < LZ4_DISTANCE_ABSOLUTE_MAX))
  ------------------
  |  |  255|     88|#define LZ4_DISTANCE_ABSOLUTE_MAX 65535
  ------------------
  |  Branch (1174:27): [True: 0, False: 88]
  |  Branch (1174:51): [Folded, False: 0]
  ------------------
 1175|      0|                      && (matchIndex+LZ4_DISTANCE_MAX < current)) {
  ------------------
  |  |  691|      0|#  define LZ4_DISTANCE_MAX 65535   /* set to maximum value by default */
  ------------------
  |  Branch (1175:26): [True: 0, False: 0]
  ------------------
 1176|      0|                        continue;
 1177|      0|                    } /* too far */
 1178|     88|                    assert((current - matchIndex) <= LZ4_DISTANCE_MAX);  /* match now expected within distance */
  ------------------
  |  |  273|     88|#    define assert(condition) ((void)0)
  ------------------
 1179|     88|                    if (maybe_extMem) offset = current - matchIndex;
  ------------------
  |  Branch (1179:25): [True: 0, False: 88]
  ------------------
 1180|     88|                    if (dictDirective == usingExtDict)   /* lowLimit : only needed once a match is found */
  ------------------
  |  Branch (1180:25): [True: 0, False: 88]
  ------------------
 1181|      0|                        lowLimit = (matchIndex < startIndex) ? dictionary : (const BYTE*)source;
  ------------------
  |  Branch (1181:36): [True: 0, False: 0]
  ------------------
 1182|     88|                    break;   /* match found */
 1183|     88|                }
 1184|       |
 1185|    524|            } while(1);
  ------------------
  |  Branch (1185:21): [True: 524, Folded]
  ------------------
 1186|    142|        }
 1187|       |
 1188|       |        /* Catch up */
 1189|     88|        filledIp = ip;
 1190|     88|        assert(ip > anchor); /* this is always true as ip has been advanced before entering the main loop */
  ------------------
  |  |  273|     88|#    define assert(condition) ((void)0)
  ------------------
 1191|     88|        if ((match > lowLimit) && unlikely(ip[-1] == match[-1])) {
  ------------------
  |  |  180|     68|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|     68|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 24, False: 44]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1191:13): [True: 68, False: 20]
  ------------------
 1192|     45|            do { ip--; match--; } while (((ip > anchor) & (match > lowLimit)) && (unlikely(ip[-1] == match[-1])));
  ------------------
  |  |  180|     45|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|     45|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  ------------------
  ------------------
  |  Branch (1192:42): [True: 45, False: 0]
  |  Branch (1192:82): [True: 21, False: 24]
  ------------------
 1193|     24|        }
 1194|       |
 1195|       |        /* Encode Literals */
 1196|     88|        {   unsigned const litLength = (unsigned)(ip - anchor);
 1197|     88|            token = op++;
 1198|     88|            if ((outputDirective == limitedOutput) &&  /* Check output buffer overflow */
  ------------------
  |  Branch (1198:17): [True: 88, False: 0]
  ------------------
 1199|     88|                (unlikely(op + litLength + (2 + 1 + LASTLITERALS) + (litLength/255) > olimit)) ) {
  ------------------
  |  |  180|     88|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|     88|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  ------------------
  ------------------
  |  Branch (1199:17): [True: 0, False: 88]
  ------------------
 1200|      0|                return 0;   /* cannot compress within `dst` budget. Stored indexes in hash table are nonetheless fine */
 1201|      0|            }
 1202|     88|            if ((outputDirective == fillOutput) &&
  ------------------
  |  Branch (1202:17): [True: 0, False: 88]
  ------------------
 1203|      0|                (unlikely(op + (litLength+240)/255 /* litlen */ + litLength /* literals */ + 2 /* offset */ + 1 /* token */ + MFLIMIT - MINMATCH /* min last literals so last match is <= end - MFLIMIT */ > olimit))) {
  ------------------
  |  |  180|      0|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|      0|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  ------------------
  ------------------
  |  Branch (1203:17): [True: 0, False: 0]
  ------------------
 1204|      0|                op--;
 1205|      0|                goto _last_literals;
 1206|      0|            }
 1207|     88|            if (litLength >= RUN_MASK) {
  ------------------
  |  |  263|     88|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  262|     88|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  260|     88|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1207:17): [True: 39, False: 49]
  ------------------
 1208|     39|                unsigned len = litLength - RUN_MASK;
  ------------------
  |  |  263|     39|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  262|     39|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  260|     39|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1209|     39|                *token = (RUN_MASK<<ML_BITS);
  ------------------
  |  |  263|     39|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  262|     39|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  260|     39|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                              *token = (RUN_MASK<<ML_BITS);
  ------------------
  |  |  260|     39|#define ML_BITS  4
  ------------------
 1210|     39|                for(; len >= 255 ; len-=255) *op++ = 255;
  ------------------
  |  Branch (1210:23): [True: 0, False: 39]
  ------------------
 1211|     39|                *op++ = (BYTE)len;
 1212|     39|            }
 1213|     49|            else *token = (BYTE)(litLength<<ML_BITS);
  ------------------
  |  |  260|     49|#define ML_BITS  4
  ------------------
 1214|       |
 1215|       |            /* Copy Literals */
 1216|     88|            LZ4_wildCopy8(op, anchor, op+litLength);
 1217|     88|            op+=litLength;
 1218|     88|            DEBUGLOG(6, "seq.start:%i, literals=%u, match.start:%i",
  ------------------
  |  |  289|     88|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1219|     88|                        (int)(anchor-(const BYTE*)source), litLength, (int)(ip-(const BYTE*)source));
 1220|     88|        }
 1221|       |
 1222|    115|_next_match:
 1223|       |        /* at this stage, the following variables must be correctly set :
 1224|       |         * - ip : at start of LZ operation
 1225|       |         * - match : at start of previous pattern occurrence; can be within current prefix, or within extDict
 1226|       |         * - offset : if maybe_ext_memSegment==1 (constant)
 1227|       |         * - lowLimit : must be == dictionary to mean "match is within extDict"; must be == source otherwise
 1228|       |         * - token and *token : position to write 4-bits for match length; higher 4-bits for literal length supposed already written
 1229|       |         */
 1230|       |
 1231|    115|        if ((outputDirective == fillOutput) &&
  ------------------
  |  Branch (1231:13): [True: 0, False: 115]
  ------------------
 1232|      0|            (op + 2 /* offset */ + 1 /* token */ + MFLIMIT - MINMATCH /* min last literals so last match is <= end - MFLIMIT */ > olimit)) {
  ------------------
  |  |  246|      0|#define MFLIMIT       12   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
                          (op + 2 /* offset */ + 1 /* token */ + MFLIMIT - MINMATCH /* min last literals so last match is <= end - MFLIMIT */ > olimit)) {
  ------------------
  |  |  242|      0|#define MINMATCH 4
  ------------------
  |  Branch (1232:13): [True: 0, False: 0]
  ------------------
 1233|       |            /* the match was too close to the end, rewind and go to last literals */
 1234|      0|            op = token;
 1235|      0|            goto _last_literals;
 1236|      0|        }
 1237|       |
 1238|       |        /* Encode Offset */
 1239|    115|        if (maybe_extMem) {   /* static test */
  ------------------
  |  Branch (1239:13): [True: 0, False: 115]
  ------------------
 1240|      0|            DEBUGLOG(6, "             with offset=%u  (ext if > %i)", offset, (int)(ip - (const BYTE*)source));
  ------------------
  |  |  289|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1241|      0|            assert(offset <= LZ4_DISTANCE_MAX && offset > 0);
  ------------------
  |  |  273|      0|#    define assert(condition) ((void)0)
  ------------------
 1242|      0|            LZ4_writeLE16(op, (U16)offset); op+=2;
 1243|    115|        } else  {
 1244|    115|            DEBUGLOG(6, "             with offset=%u  (same segment)", (U32)(ip - match));
  ------------------
  |  |  289|    115|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1245|    115|            assert(ip-match <= LZ4_DISTANCE_MAX);
  ------------------
  |  |  273|    115|#    define assert(condition) ((void)0)
  ------------------
 1246|    115|            LZ4_writeLE16(op, (U16)(ip - match)); op+=2;
 1247|    115|        }
 1248|       |
 1249|       |        /* Encode MatchLength */
 1250|    115|        {   unsigned matchCode;
 1251|       |
 1252|    115|            if ( (dictDirective==usingExtDict || dictDirective==usingDictCtx)
  ------------------
  |  Branch (1252:19): [True: 0, False: 115]
  |  Branch (1252:50): [True: 0, False: 115]
  ------------------
 1253|      0|              && (lowLimit==dictionary) /* match within extDict */ ) {
  ------------------
  |  Branch (1253:18): [True: 0, False: 0]
  ------------------
 1254|      0|                const BYTE* limit = ip + (dictEnd-match);
 1255|      0|                assert(dictEnd > match);
  ------------------
  |  |  273|      0|#    define assert(condition) ((void)0)
  ------------------
 1256|      0|                if (limit > matchlimit) limit = matchlimit;
  ------------------
  |  Branch (1256:21): [True: 0, False: 0]
  ------------------
 1257|      0|                matchCode = LZ4_count(ip+MINMATCH, match+MINMATCH, limit);
  ------------------
  |  |  242|      0|#define MINMATCH 4
  ------------------
                              matchCode = LZ4_count(ip+MINMATCH, match+MINMATCH, limit);
  ------------------
  |  |  242|      0|#define MINMATCH 4
  ------------------
 1258|      0|                ip += (size_t)matchCode + MINMATCH;
  ------------------
  |  |  242|      0|#define MINMATCH 4
  ------------------
 1259|      0|                if (ip==limit) {
  ------------------
  |  Branch (1259:21): [True: 0, False: 0]
  ------------------
 1260|      0|                    unsigned const more = LZ4_count(limit, (const BYTE*)source, matchlimit);
 1261|      0|                    matchCode += more;
 1262|      0|                    ip += more;
 1263|      0|                }
 1264|      0|                DEBUGLOG(6, "             with matchLength=%u starting in extDict", matchCode+MINMATCH);
  ------------------
  |  |  289|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1265|    115|            } else {
 1266|    115|                matchCode = LZ4_count(ip+MINMATCH, match+MINMATCH, matchlimit);
  ------------------
  |  |  242|    115|#define MINMATCH 4
  ------------------
                              matchCode = LZ4_count(ip+MINMATCH, match+MINMATCH, matchlimit);
  ------------------
  |  |  242|    115|#define MINMATCH 4
  ------------------
 1267|    115|                ip += (size_t)matchCode + MINMATCH;
  ------------------
  |  |  242|    115|#define MINMATCH 4
  ------------------
 1268|    115|                DEBUGLOG(6, "             with matchLength=%u", matchCode+MINMATCH);
  ------------------
  |  |  289|    115|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1269|    115|            }
 1270|       |
 1271|    115|            if ((outputDirective) &&    /* Check output buffer overflow */
  ------------------
  |  Branch (1271:17): [True: 115, False: 0]
  ------------------
 1272|    115|                (unlikely(op + (1 + LASTLITERALS) + (matchCode+240)/255 > olimit)) ) {
  ------------------
  |  |  180|    115|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|    115|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  ------------------
  ------------------
  |  Branch (1272:17): [True: 0, False: 115]
  ------------------
 1273|      0|                if (outputDirective == fillOutput) {
  ------------------
  |  Branch (1273:21): [True: 0, False: 0]
  ------------------
 1274|       |                    /* Match description too long : reduce it */
 1275|      0|                    U32 newMatchCode = 15 /* in token */ - 1 /* to avoid needing a zero byte */ + ((U32)(olimit - op) - 1 - LASTLITERALS) * 255;
  ------------------
  |  |  245|      0|#define LASTLITERALS   5   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
 1276|      0|                    ip -= matchCode - newMatchCode;
 1277|      0|                    assert(newMatchCode < matchCode);
  ------------------
  |  |  273|      0|#    define assert(condition) ((void)0)
  ------------------
 1278|      0|                    matchCode = newMatchCode;
 1279|      0|                    if (unlikely(ip <= filledIp)) {
  ------------------
  |  |  180|      0|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|      0|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1280|       |                        /* We have already filled up to filledIp so if ip ends up less than filledIp
 1281|       |                         * we have positions in the hash table beyond the current position. This is
 1282|       |                         * a problem if we reuse the hash table. So we have to remove these positions
 1283|       |                         * from the hash table.
 1284|       |                         */
 1285|      0|                        const BYTE* ptr;
 1286|      0|                        DEBUGLOG(5, "Clearing %u positions", (U32)(filledIp - ip));
  ------------------
  |  |  289|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1287|      0|                        for (ptr = ip; ptr <= filledIp; ++ptr) {
  ------------------
  |  Branch (1287:40): [True: 0, False: 0]
  ------------------
 1288|      0|                            U32 const h = LZ4_hashPosition(ptr, tableType);
 1289|      0|                            LZ4_clearHash(h, cctx->hashTable, tableType);
 1290|      0|                        }
 1291|      0|                    }
 1292|      0|                } else {
 1293|      0|                    assert(outputDirective == limitedOutput);
  ------------------
  |  |  273|      0|#    define assert(condition) ((void)0)
  ------------------
 1294|      0|                    return 0;   /* cannot compress within `dst` budget. Stored indexes in hash table are nonetheless fine */
 1295|      0|                }
 1296|      0|            }
 1297|    115|            if (matchCode >= ML_MASK) {
  ------------------
  |  |  261|    115|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  260|    115|#define ML_BITS  4
  |  |  ------------------
  ------------------
  |  Branch (1297:17): [True: 12, False: 103]
  ------------------
 1298|     12|                *token += ML_MASK;
  ------------------
  |  |  261|     12|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  260|     12|#define ML_BITS  4
  |  |  ------------------
  ------------------
 1299|     12|                matchCode -= ML_MASK;
  ------------------
  |  |  261|     12|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  260|     12|#define ML_BITS  4
  |  |  ------------------
  ------------------
 1300|     12|                LZ4_write32(op, 0xFFFFFFFF);
 1301|     12|                while (matchCode >= 4*255) {
  ------------------
  |  Branch (1301:24): [True: 0, False: 12]
  ------------------
 1302|      0|                    op+=4;
 1303|      0|                    LZ4_write32(op, 0xFFFFFFFF);
 1304|      0|                    matchCode -= 4*255;
 1305|      0|                }
 1306|     12|                op += matchCode / 255;
 1307|     12|                *op++ = (BYTE)(matchCode % 255);
 1308|     12|            } else
 1309|    103|                *token += (BYTE)(matchCode);
 1310|    115|        }
 1311|       |        /* Ensure we have enough space for the last literals. */
 1312|    115|        assert(!(outputDirective == fillOutput && op + 1 + LASTLITERALS > olimit));
  ------------------
  |  |  273|    115|#    define assert(condition) ((void)0)
  ------------------
 1313|       |
 1314|    115|        anchor = ip;
 1315|       |
 1316|       |        /* Test end of chunk */
 1317|    115|        if (ip >= seqLimit) {
  ------------------
  |  Branch (1317:13): [True: 28, False: 87]
  ------------------
 1318|     28|            if ((suspend == NULL) || (ip >= mflimitPlusOne)) break;
  ------------------
  |  Branch (1318:17): [True: 28, False: 0]
  |  Branch (1318:38): [True: 0, False: 0]
  ------------------
 1319|       |            /* extDict : from ip, all candidates (and catch up) are beyond reach of the dictionary :
 1320|       |             * stop, to resume in prefix mode, which is faster */
 1321|      0|            suspend->ip = ip;
 1322|      0|            suspend->op = op;
 1323|      0|            suspend->startIndex = startIndex;
 1324|      0|            return 0;
 1325|     28|        }
 1326|       |
 1327|     87|_resume:
 1328|       |        /* Fill table, and test next position.
 1329|       |         * First, the position after the previous occurrence of ip-1, if it matches 8+ bytes :
 1330|       |         * it breaks chains of short matches, which the table alone can produce on periodic data. */
 1331|     87|        if (tableType == byPtr) {
  ------------------
  |  Branch (1331:13): [True: 0, False: 87]
  ------------------
 1332|       |
 1333|      0|            U32 const hPrev = LZ4_hashPosition(ip-1, tableType);
 1334|      0|            const BYTE* const prev = LZ4_getPositionOnHash(hPrev, cctx->hashTable, tableType);
 1335|      0|            U32 const h = LZ4_hashPosition(ip, tableType);
 1336|      0|            LZ4_putPositionOnHash(ip-1, hPrev, cctx->hashTable, tableType);
 1337|      0|            match = LZ4_getPositionOnHash(h, cctx->hashTable, tableType);
 1338|      0|            if ((prev+1+LZ4_DISTANCE_MAX >= ip) && LZ4_match8(prev+1, ip)) match = prev+1;
  ------------------
  |  |  691|      0|#  define LZ4_DISTANCE_MAX 65535   /* set to maximum value by default */
  ------------------
  |  Branch (1338:17): [True: 0, False: 0]
  |  Branch (1338:52): [True: 0, False: 0]
  ------------------
 1339|      0|            LZ4_putPositionOnHash(ip, h, cctx->hashTable, tableType);
 1340|      0|            if ( (match+LZ4_DISTANCE_MAX >= ip)
  ------------------
  |  |  691|      0|#  define LZ4_DISTANCE_MAX 65535   /* set to maximum value by default */
  ------------------
  |  Branch (1340:18): [True: 0, False: 0]
  ------------------
 1341|      0|              && (LZ4_read32(match) == LZ4_read32(ip)) )
  ------------------
  |  Branch (1341:18): [True: 0, False: 0]
  ------------------
 1342|      0|            { token=op++; *token=0; goto _next_match; }
 1343|       |
 1344|     87|        } else {   /* byU32, byU16 */
 1345|       |
 1346|     87|            U32 const h = LZ4_hashPosition(ip, tableType);
 1347|     87|            U32 const current = (U32)(ip-base);
 1348|     87|            U32 const hPrev = LZ4_hashPosition(ip-1, tableType);
 1349|     87|            U32 prevIndex = LZ4_getIndexOnHash(hPrev, cctx->hashTable, tableType);
 1350|     87|            U32 matchIndex;
 1351|     87|            LZ4_putIndexOnHash(current-1, hPrev, cctx->hashTable, tableType);
 1352|     87|            if ((dictDirective == usingDictCtx) && (prevIndex < startIndex)) {
  ------------------
  |  Branch (1352:17): [True: 0, False: 87]
  |  Branch (1352:52): [True: 0, False: 0]
  ------------------
 1353|       |                /* no occurrence in the current context : try the dictionary */
 1354|      0|                prevIndex = LZ4_getIndexOnHash(hPrev, dictCtx->hashTable, byU32) + dictDelta;
 1355|      0|            }
 1356|     87|            {   /* used table (small block, see LZ4_prepareTable()) : a stale entry yields the candidate of an empty slot
 1357|       |                 * of a cleared table (0), the position after the first one : the output doesn't depend on the table's history */
 1358|     87|                int const usedTable = (dictDirective == noDict) && (dictIssue == dictSmall);
  ------------------
  |  Branch (1358:39): [True: 87, False: 0]
  |  Branch (1358:68): [True: 83, False: 4]
  ------------------
 1359|     87|                U32 const ctxIndex = ((usedTable && (prevIndex < startIndex)) ? startIndex : prevIndex) + 1;
  ------------------
  |  Branch (1359:40): [True: 83, False: 4]
  |  Branch (1359:53): [True: 67, False: 16]
  ------------------
 1360|     87|                int const inDict = (dictDirective == usingExtDict || dictDirective == usingDictCtx) && (ctxIndex < startIndex);
  ------------------
  |  Branch (1360:37): [True: 0, False: 87]
  |  Branch (1360:70): [True: 0, False: 87]
  |  Branch (1360:104): [True: 0, False: 0]
  ------------------
 1361|     87|                if ( ((dictIssue==dictSmall) ? (ctxIndex >= prefixIdxLimit) : 1)
  ------------------
  |  Branch (1361:22): [True: 87, False: 0]
  |  Branch (1361:23): [True: 83, False: 4]
  ------------------
 1362|     87|                  && (((tableType==byU16) && (LZ4_DISTANCE_MAX == LZ4_DISTANCE_ABSOLUTE_MAX)) ? 1 : (ctxIndex+LZ4_DISTANCE_MAX >= current))
  ------------------
  |  |  691|     87|#  define LZ4_DISTANCE_MAX 65535   /* set to maximum value by default */
  ------------------
                                && (((tableType==byU16) && (LZ4_DISTANCE_MAX == LZ4_DISTANCE_ABSOLUTE_MAX)) ? 1 : (ctxIndex+LZ4_DISTANCE_MAX >= current))
  ------------------
  |  |  255|     87|#define LZ4_DISTANCE_ABSOLUTE_MAX 65535
  ------------------
                                && (((tableType==byU16) && (LZ4_DISTANCE_MAX == LZ4_DISTANCE_ABSOLUTE_MAX)) ? 1 : (ctxIndex+LZ4_DISTANCE_MAX >= current))
  ------------------
  |  |  691|      0|#  define LZ4_DISTANCE_MAX 65535   /* set to maximum value by default */
  ------------------
  |  Branch (1362:22): [True: 87, False: 0]
  |  Branch (1362:24): [True: 87, False: 0]
  |  Branch (1362:46): [True: 0, Folded]
  ------------------
 1363|     87|                  && (!inDict || (ctxIndex + 8 <= startIndex))   /* the 8 compared bytes are within the dictionary */
  ------------------
  |  Branch (1363:23): [True: 87, False: 0]
  |  Branch (1363:34): [True: 0, False: 0]
  ------------------
 1364|     87|                  && LZ4_match8(inDict ? dictBase + (ctxIndex - dictDelta) : base + ctxIndex, ip) ) {
  ------------------
  |  Branch (1364:22): [True: 5, False: 82]
  |  Branch (1364:33): [True: 0, False: 87]
  ------------------
 1365|      5|                    matchIndex = ctxIndex;
 1366|     82|                } else {
 1367|     82|                    matchIndex = LZ4_getIndexOnHash(h, cctx->hashTable, tableType);
 1368|     82|                    if ((dictDirective == usingDictCtx) && (matchIndex < startIndex))
  ------------------
  |  Branch (1368:25): [True: 0, False: 82]
  |  Branch (1368:60): [True: 0, False: 0]
  ------------------
 1369|      0|                        matchIndex = LZ4_getIndexOnHash(h, dictCtx->hashTable, byU32) + dictDelta;
 1370|     82|                }
 1371|     87|            }
 1372|     87|            assert(matchIndex < current);
  ------------------
  |  |  273|     87|#    define assert(condition) ((void)0)
  ------------------
 1373|     87|            if (dictDirective == usingExtDict) {   /* select without branch */
  ------------------
  |  Branch (1373:17): [True: 0, False: 87]
  ------------------
 1374|      0|                ptrdiff_t const relIdx = (ptrdiff_t)matchIndex - (ptrdiff_t)startIndex;   /* < 0 : within dictionary */
 1375|      0|                match = ((relIdx < 0) ? dictEnd : (const BYTE*)source) + relIdx;
  ------------------
  |  Branch (1375:26): [True: 0, False: 0]
  ------------------
 1376|     87|            } else if ((dictDirective == usingDictCtx) && (matchIndex < startIndex)) {
  ------------------
  |  Branch (1376:24): [True: 0, False: 87]
  |  Branch (1376:59): [True: 0, False: 0]
  ------------------
 1377|      0|                match = dictBase + (matchIndex - dictDelta);
 1378|      0|                lowLimit = dictionary;   /* required for match length counter */
 1379|     87|            } else {
 1380|     87|                match = base + matchIndex;
 1381|     87|                if (dictDirective == usingDictCtx)
  ------------------
  |  Branch (1381:21): [True: 0, False: 87]
  ------------------
 1382|      0|                    lowLimit = (const BYTE*)source;   /* required for match length counter */
 1383|     87|            }
 1384|     87|            LZ4_putIndexOnHash(current, h, cctx->hashTable, tableType);
 1385|     87|            assert(matchIndex < current);
  ------------------
  |  |  273|     87|#    define assert(condition) ((void)0)
  ------------------
 1386|     87|            if ( ((dictIssue==dictSmall) ? (matchIndex >= prefixIdxLimit) : 1)
  ------------------
  |  Branch (1386:18): [True: 29, False: 58]
  |  Branch (1386:19): [True: 83, False: 4]
  ------------------
 1387|     29|              && (((tableType==byU16) && (LZ4_DISTANCE_MAX == LZ4_DISTANCE_ABSOLUTE_MAX)) ? 1 : (matchIndex+LZ4_DISTANCE_MAX >= current))
  ------------------
  |  |  691|     29|#  define LZ4_DISTANCE_MAX 65535   /* set to maximum value by default */
  ------------------
                            && (((tableType==byU16) && (LZ4_DISTANCE_MAX == LZ4_DISTANCE_ABSOLUTE_MAX)) ? 1 : (matchIndex+LZ4_DISTANCE_MAX >= current))
  ------------------
  |  |  255|     29|#define LZ4_DISTANCE_ABSOLUTE_MAX 65535
  ------------------
                            && (((tableType==byU16) && (LZ4_DISTANCE_MAX == LZ4_DISTANCE_ABSOLUTE_MAX)) ? 1 : (matchIndex+LZ4_DISTANCE_MAX >= current))
  ------------------
  |  |  691|      0|#  define LZ4_DISTANCE_MAX 65535   /* set to maximum value by default */
  ------------------
  |  Branch (1387:18): [True: 29, False: 0]
  |  Branch (1387:20): [True: 29, False: 0]
  |  Branch (1387:42): [True: 0, Folded]
  ------------------
 1388|     29|              && (LZ4_read32(match) == LZ4_read32(ip)) ) {
  ------------------
  |  Branch (1388:18): [True: 27, False: 2]
  ------------------
 1389|     27|                token=op++;
 1390|     27|                *token=0;
 1391|     27|                if (maybe_extMem) offset = current - matchIndex;
  ------------------
  |  Branch (1391:21): [True: 0, False: 27]
  ------------------
 1392|     27|                if (dictDirective == usingExtDict)
  ------------------
  |  Branch (1392:21): [True: 0, False: 27]
  ------------------
 1393|      0|                    lowLimit = (matchIndex < startIndex) ? dictionary : (const BYTE*)source;   /* required for match length counter */
  ------------------
  |  Branch (1393:32): [True: 0, False: 0]
  ------------------
 1394|     27|                DEBUGLOG(6, "seq.start:%i, literals=%u, match.start:%i",
  ------------------
  |  |  289|     27|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1395|     27|                            (int)(anchor-(const BYTE*)source), 0, (int)(ip-(const BYTE*)source));
 1396|     27|                goto _next_match;
 1397|     27|            }
 1398|     87|        }
 1399|       |
 1400|       |        /* Prepare next loop */
 1401|     60|        forwardH = LZ4_hashPosition(++ip, tableType);
 1402|       |
 1403|     60|    }
 1404|       |
 1405|     82|_last_literals:
 1406|       |    /* Encode Last Literals */
 1407|     82|    {   size_t lastRun = (size_t)(iend - anchor);
 1408|     82|        if ( (outputDirective) &&  /* Check output buffer overflow */
  ------------------
  |  Branch (1408:14): [True: 82, False: 0]
  ------------------
 1409|     82|            (op + lastRun + 1 + ((lastRun+255-RUN_MASK)/255) > olimit)) {
  ------------------
  |  |  263|     82|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  262|     82|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  260|     82|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1409:13): [True: 46, False: 36]
  ------------------
 1410|     46|            if (outputDirective == fillOutput) {
  ------------------
  |  Branch (1410:17): [True: 0, False: 46]
  ------------------
 1411|       |                /* adapt lastRun to fill 'dst' */
 1412|      0|                assert(olimit >= op);
  ------------------
  |  |  273|      0|#    define assert(condition) ((void)0)
  ------------------
 1413|      0|                lastRun  = (size_t)(olimit-op) - 1/*token*/;
 1414|      0|                lastRun -= (lastRun + 256 - RUN_MASK) / 256;  /*additional length tokens*/
  ------------------
  |  |  263|      0|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  262|      0|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  260|      0|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1415|     46|            } else {
 1416|     46|                assert(outputDirective == limitedOutput);
  ------------------
  |  |  273|     46|#    define assert(condition) ((void)0)
  ------------------
 1417|     46|                return 0;   /* cannot compress within `dst` budget. Stored indexes in hash table are nonetheless fine */
 1418|     46|            }
 1419|     46|        }
 1420|     36|        DEBUGLOG(6, "Final literal run : %i literals", (int)lastRun);
  ------------------
  |  |  289|     36|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1421|     36|        if (lastRun >= RUN_MASK) {
  ------------------
  |  |  263|     36|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  262|     36|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  260|     36|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1421:13): [True: 7, False: 29]
  ------------------
 1422|      7|            size_t accumulator = lastRun - RUN_MASK;
  ------------------
  |  |  263|      7|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  262|      7|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  260|      7|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1423|      7|            *op++ = RUN_MASK << ML_BITS;
  ------------------
  |  |  263|      7|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  262|      7|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  260|      7|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                          *op++ = RUN_MASK << ML_BITS;
  ------------------
  |  |  260|      7|#define ML_BITS  4
  ------------------
 1424|      7|            for(; accumulator >= 255 ; accumulator-=255) *op++ = 255;
  ------------------
  |  Branch (1424:19): [True: 0, False: 7]
  ------------------
 1425|      7|            *op++ = (BYTE) accumulator;
 1426|     29|        } else {
 1427|     29|            *op++ = (BYTE)(lastRun<<ML_BITS);
  ------------------
  |  |  260|     29|#define ML_BITS  4
  ------------------
 1428|     29|        }
 1429|     36|        LZ4_memcpy(op, anchor, lastRun);
  ------------------
  |  |  349|     36|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 1430|     36|        ip = anchor + lastRun;
 1431|     36|        op += lastRun;
 1432|     36|    }
 1433|       |
 1434|     36|    if (outputDirective == fillOutput) {
  ------------------
  |  Branch (1434:9): [True: 0, False: 36]
  ------------------
 1435|      0|        *inputConsumed = (int) (((const char*)ip)-source);
 1436|      0|    }
 1437|     36|    result = (int)(((char*)op) - dest);
 1438|     36|    assert(result > 0);
  ------------------
  |  |  273|     36|#    define assert(condition) ((void)0)
  ------------------
 1439|     36|    DEBUGLOG(5, "LZ4_compress_generic: compressed %i bytes into %i bytes", inputSize, result);
  ------------------
  |  |  289|     36|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1440|     36|    return result;
 1441|     82|}
lz4.c:LZ4_putPosition:
  898|     82|{
  899|     82|    U32 const h = LZ4_hashPosition(p, tableType);
  900|     82|    if (tableType == byPtr) {
  ------------------
  |  Branch (900:9): [True: 0, False: 82]
  ------------------
  901|      0|        LZ4_putPositionOnHash(p, h, tableBase, byPtr);
  902|     82|    } else {
  903|     82|        LZ4_putIndexOnHash((U32)(p - base), h, tableBase, tableType);
  904|     82|    }
  905|     82|}
lz4.c:LZ4_wildCopy8:
  466|    287|{
  467|    287|    BYTE* d = (BYTE*)dstPtr;
  468|    287|    const BYTE* s = (const BYTE*)srcPtr;
  469|    287|    BYTE* const e = (BYTE*)dstEnd;
  470|       |
  471|  1.65k|    do { LZ4_memcpy(d,s,8); d+=8; s+=8; } while (d<e);
  ------------------
  |  |  349|  1.65k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  |  Branch (471:50): [True: 1.36k, False: 287]
  ------------------
  472|    287|}
lz4.c:LZ4_writeLE16:
  453|    115|{
  454|    115|    if (LZ4_isLittleEndian()) {
  ------------------
  |  Branch (454:9): [True: 115, False: 0]
  ------------------
  455|    115|        LZ4_write16(memPtr, value);
  456|    115|    } else {
  457|      0|        BYTE* p = (BYTE*)memPtr;
  458|      0|        p[0] = (BYTE) value;
  459|      0|        p[1] = (BYTE)(value>>8);
  460|      0|    }
  461|    115|}
lz4.c:LZ4_write16:
  397|    115|static void LZ4_write16(void* memPtr, U16 value) { ((LZ4_unalign16*)memPtr)->u16 = value; }
lz4.c:LZ4_count:
  709|    115|{
  710|    115|    const BYTE* const pStart = pIn;
  711|       |
  712|    115|    if (likely(pIn < pInLimit-(STEPSIZE-1))) {
  ------------------
  |  |  177|    115|#define likely(expr)     expect((expr) != 0, 1)
  |  |  ------------------
  |  |  |  |  171|    115|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 102, False: 13]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  713|    102|        reg_t const diff = LZ4_read_ARCH(pMatch) ^ LZ4_read_ARCH(pIn);
  714|    102|        if (!diff) {
  ------------------
  |  Branch (714:13): [True: 14, False: 88]
  ------------------
  715|     14|            pIn+=STEPSIZE; pMatch+=STEPSIZE;
  ------------------
  |  |  706|     14|#define STEPSIZE sizeof(reg_t)
  ------------------
                          pIn+=STEPSIZE; pMatch+=STEPSIZE;
  ------------------
  |  |  706|     14|#define STEPSIZE sizeof(reg_t)
  ------------------
  716|     88|        } else {
  717|     88|            return LZ4_NbCommonBytes(diff);
  718|     88|    }   }
  719|       |
  720|     60|    while (likely(pIn < pInLimit-(STEPSIZE-1))) {
  721|     60|        reg_t const diff = LZ4_read_ARCH(pMatch) ^ LZ4_read_ARCH(pIn);
  722|     60|        if (!diff) { pIn+=STEPSIZE; pMatch+=STEPSIZE; continue; }
  ------------------
  |  |  706|     60|#define STEPSIZE sizeof(reg_t)
  ------------------
                      if (!diff) { pIn+=STEPSIZE; pMatch+=STEPSIZE; continue; }
  ------------------
  |  |  706|     60|#define STEPSIZE sizeof(reg_t)
  ------------------
  |  Branch (722:13): [True: 60, False: 0]
  ------------------
  723|      0|        pIn += LZ4_NbCommonBytes(diff);
  724|      0|        return (unsigned)(pIn - pStart);
  725|     60|    }
  726|       |
  727|     27|    if ((STEPSIZE==8) && (pIn<(pInLimit-3)) && (LZ4_read32(pMatch) == LZ4_read32(pIn))) { pIn+=4; pMatch+=4; }
  ------------------
  |  |  706|     27|#define STEPSIZE sizeof(reg_t)
  ------------------
  |  Branch (727:9): [True: 27, Folded]
  |  Branch (727:26): [True: 25, False: 2]
  |  Branch (727:48): [True: 21, False: 4]
  ------------------
  728|     27|    if ((pIn<(pInLimit-1)) && (LZ4_read16(pMatch) == LZ4_read16(pIn))) { pIn+=2; pMatch+=2; }
  ------------------
  |  Branch (728:9): [True: 25, False: 2]
  |  Branch (728:31): [True: 21, False: 4]
  ------------------
  729|     27|    if ((pIn<pInLimit) && (*pMatch == *pIn)) pIn++;
  ------------------
  |  Branch (729:9): [True: 22, False: 5]
  |  Branch (729:27): [True: 20, False: 2]
  ------------------
  730|     27|    return (unsigned)(pIn - pStart);
  731|     27|}
lz4.c:LZ4_NbCommonBytes:
  608|     88|{
  609|     88|    assert(val != 0);
  ------------------
  |  |  273|     88|#    define assert(condition) ((void)0)
  ------------------
  610|     88|    if (LZ4_isLittleEndian()) {
  ------------------
  |  Branch (610:9): [True: 88, False: 0]
  ------------------
  611|     88|        if (sizeof(val) == 8) {
  ------------------
  |  Branch (611:13): [True: 88, Folded]
  ------------------
  612|       |#       if defined(_MSC_VER) && (_MSC_VER >= 1800) && (defined(_M_AMD64) && !defined(_M_ARM64EC)) && !defined(LZ4_FORCE_SW_BITCOUNT)
  613|       |/*-*************************************************************************************************
  614|       |* ARM64EC is a Microsoft-designed ARM64 ABI compatible with AMD64 applications on ARM64 Windows 11.
  615|       |* The ARM64EC ABI does not support AVX/AVX2/AVX512 instructions, nor their relevant intrinsics
  616|       |* including _tzcnt_u64. Therefore, we need to neuter the _tzcnt_u64 code path for ARM64EC.
  617|       |****************************************************************************************************/
  618|       |#         if defined(__clang__) && (__clang_major__ < 10)
  619|       |            /* Avoid undefined clang-cl intrinsics issue.
  620|       |             * See https://github.com/lz4/lz4/pull/1017 for details. */
  621|       |            return (unsigned)__builtin_ia32_tzcnt_u64(val) >> 3;
  622|       |#         else
  623|       |            /* x64 CPUS without BMI support interpret `TZCNT` as `REP BSF` */
  624|       |            return (unsigned)_tzcnt_u64(val) >> 3;
  625|       |#         endif
  626|       |#       elif defined(_MSC_VER) && defined(_WIN64) && !defined(LZ4_FORCE_SW_BITCOUNT)
  627|       |            unsigned long r = 0;
  628|       |            _BitScanForward64(&r, (U64)val);
  629|       |            return (unsigned)r >> 3;
  630|       |#       elif (defined(__clang__) || (defined(__GNUC__) && ((__GNUC__ > 3) || \
  631|       |                            ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 4))))) && \
  632|       |                                        !defined(LZ4_FORCE_SW_BITCOUNT)
  633|       |            return (unsigned)__builtin_ctzll((U64)val) >> 3;
  634|       |#       else
  635|       |            const U64 m = 0x0101010101010101ULL;
  636|       |            val ^= val - 1;
  637|       |            return (unsigned)(((U64)((val & (m - 1)) * m)) >> 56);
  638|       |#       endif
  639|     88|        } else /* 32 bits */ {
  640|       |#       if defined(_MSC_VER) && (_MSC_VER >= 1400) && !defined(LZ4_FORCE_SW_BITCOUNT)
  641|       |            unsigned long r;
  642|       |            _BitScanForward(&r, (U32)val);
  643|       |            return (unsigned)r >> 3;
  644|       |#       elif (defined(__clang__) || (defined(__GNUC__) && ((__GNUC__ > 3) || \
  645|       |                            ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 4))))) && \
  646|       |                        !defined(__TINYC__) && !defined(LZ4_FORCE_SW_BITCOUNT)
  647|       |            return (unsigned)__builtin_ctz((U32)val) >> 3;
  648|       |#       else
  649|       |            const U32 m = 0x01010101;
  650|       |            return (unsigned)((((val - 1) ^ val) & (m - 1)) * m) >> 24;
  651|       |#       endif
  652|      0|        }
  653|     88|    } else   /* Big Endian CPU */ {
  654|      0|        if (sizeof(val)==8) {
  ------------------
  |  Branch (654:13): [True: 0, Folded]
  ------------------
  655|      0|#       if (defined(__clang__) || (defined(__GNUC__) && ((__GNUC__ > 3) || \
  656|      0|                            ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 4))))) && \
  657|      0|                        !defined(__TINYC__) && !defined(LZ4_FORCE_SW_BITCOUNT)
  658|      0|            return (unsigned)__builtin_clzll((U64)val) >> 3;
  659|       |#       else
  660|       |#if 1
  661|       |            /* this method is probably faster,
  662|       |             * but adds a 128 bytes lookup table */
  663|       |            static const unsigned char ctz7_tab[128] = {
  664|       |                7, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
  665|       |                4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
  666|       |                5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
  667|       |                4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
  668|       |                6, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
  669|       |                4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
  670|       |                5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
  671|       |                4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
  672|       |            };
  673|       |            U64 const mask = 0x0101010101010101ULL;
  674|       |            U64 const t = (((val >> 8) - mask) | val) & mask;
  675|       |            return ctz7_tab[(t * 0x0080402010080402ULL) >> 57];
  676|       |#else
  677|       |            /* this method doesn't consume memory space like the previous one,
  678|       |             * but it contains several branches,
  679|       |             * that may end up slowing execution */
  680|       |            static const U32 by32 = sizeof(val)*4;  /* 32 on 64 bits (goal), 16 on 32 bits.
  681|       |            Just to avoid some static analyzer complaining about shift by 32 on 32-bits target.
  682|       |            Note that this code path is never triggered in 32-bits mode. */
  683|       |            unsigned r;
  684|       |            if (!(val>>by32)) { r=4; } else { r=0; val>>=by32; }
  685|       |            if (!(val>>16)) { r+=2; val>>=8; } else { val>>=24; }
  686|       |            r += (!val);
  687|       |            return r;
  688|       |#endif
  689|       |#       endif
  690|      0|        } else /* 32 bits */ {
  691|      0|#       if (defined(__clang__) || (defined(__GNUC__) && ((__GNUC__ > 3) || \
  692|      0|                            ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 4))))) && \
  693|      0|                                        !defined(LZ4_FORCE_SW_BITCOUNT)
  694|      0|            return (unsigned)__builtin_clz((U32)val) >> 3;
  695|       |#       else
  696|       |            val >>= 8;
  697|       |            val = ((((val + 0x00FFFF00) | 0x00FFFFFF) + val) |
  698|       |              (val + 0x00FF0000)) >> 24;
  699|       |            return (unsigned)val ^ 3;
  700|       |#       endif
  701|      0|        }
  702|      0|    }
  703|     88|}
lz4.c:LZ4_read16:
  393|    348|static U16 LZ4_read16(const void* ptr) { return ((const LZ4_unalign16*)ptr)->u16; }
lz4.c:LZ4_write32:
  398|    113|static void LZ4_write32(void* memPtr, U32 value) { ((LZ4_unalign32*)memPtr)->u32 = value; }
lz4.c:LZ4_match8:
  982|     87|{
  983|     87|    if (sizeof(reg_t) == 8) return LZ4_read_ARCH(p) == LZ4_read_ARCH(q);
  ------------------
  |  Branch (983:9): [True: 87, Folded]
  ------------------
  984|      0|    return (LZ4_read32(p) == LZ4_read32(q))
  ------------------
  |  Branch (984:12): [True: 0, False: 0]
  ------------------
  985|      0|        && (LZ4_read32((const BYTE*)p + 4) == LZ4_read32((const BYTE*)q + 4));
  ------------------
  |  Branch (985:12): [True: 0, False: 0]
  ------------------
  986|     87|}
lz4.c:LZ4_decompress_generic:
 2225|    120|{
 2226|    120|    if ((src == NULL) || (outputSize < 0)) { return -1; }
  ------------------
  |  Branch (2226:9): [True: 0, False: 120]
  |  Branch (2226:26): [True: 0, False: 120]
  ------------------
 2227|       |
 2228|    120|    {   const BYTE* ip = (const BYTE*) src;
 2229|    120|        const BYTE* const iend = ip + srcSize;
 2230|       |
 2231|    120|        BYTE* op = (BYTE*) dst;
 2232|    120|        BYTE* const oend = op + outputSize;
 2233|       |
 2234|    120|        const BYTE* const dictEnd = (dictStart == NULL) ? NULL : dictStart + dictSize;
  ------------------
  |  Branch (2234:37): [True: 120, False: 0]
  ------------------
 2235|       |
 2236|       |        /* withPrefix64k : offset <= 65535 can't reach beyond the 64 KB prefix */
 2237|    120|        const int checkOffset = (dict != withPrefix64k) && (dictSize < (int)(64 KB));
  ------------------
  |  |  251|    120|#define KB *(1 <<10)
  ------------------
  |  Branch (2237:33): [True: 120, False: 0]
  |  Branch (2237:60): [True: 120, False: 0]
  ------------------
 2238|       |
 2239|       |
 2240|       |        /* Set up the "end" pointers for the shortcut. */
 2241|    120|        const BYTE* const shortiend = iend - 14 /*maxLL*/ - 2 /*offset*/;
 2242|    120|        const BYTE* const shortoend = oend - 14 /*maxLL*/ - 18 /*maxML*/;
 2243|       |
 2244|       |        /* shared by both loops : the fast loop can hand over a decoded match (safe_match_copy) */
 2245|    120|        const BYTE* match;
 2246|    120|        size_t offset;
 2247|    120|        size_t ml;   /* match length */
 2248|       |
 2249|       |
 2250|    120|        DEBUGLOG(5, "LZ4_decompress_generic (srcSize:%i, dstSize:%i)", srcSize, outputSize);
  ------------------
  |  |  289|    120|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2251|       |
 2252|       |        /* Special cases */
 2253|    120|        assert(lowPrefix <= op);
  ------------------
  |  |  273|    120|#    define assert(condition) ((void)0)
  ------------------
 2254|    120|        if (unlikely(outputSize==0)) {
  ------------------
  |  |  180|    120|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|    120|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 0, False: 120]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2255|       |            /* Empty output buffer */
 2256|      0|            if (partialDecoding) return 0;
  ------------------
  |  Branch (2256:17): [True: 0, False: 0]
  ------------------
 2257|      0|            if ((srcSize==1) && (*ip==0)) return 0;   /* empty block */
  ------------------
  |  Branch (2257:17): [True: 0, False: 0]
  |  Branch (2257:33): [True: 0, False: 0]
  ------------------
 2258|      0|            return (srcSize > 1) ? -2 : -1;   /* -2 : output buffer too small */
  ------------------
  |  Branch (2258:20): [True: 0, False: 0]
  ------------------
 2259|      0|        }
 2260|    120|        if (unlikely(srcSize<=0)) { return -1; }
  ------------------
  |  |  180|    120|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|    120|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 0, False: 120]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2261|       |
 2262|       |    /* LZ4_FAST_DEC_LOOP:
 2263|       |     * designed for modern OoO performance cpus,
 2264|       |     * where copying reliably 32-bytes is preferable to an unpredictable branch.
 2265|       |     * note : fast loop may show a regression for some client arm chips. */
 2266|    120|#if LZ4_FAST_DEC_LOOP
 2267|    120|        if ((oend - op) < FASTLOOP_SAFE_DISTANCE) {
  ------------------
  |  |  248|    120|#define FASTLOOP_SAFE_DISTANCE 64
  ------------------
  |  Branch (2267:13): [True: 18, False: 102]
  ------------------
 2268|     18|            DEBUGLOG(6, "move to safe decode loop");
  ------------------
  |  |  289|     18|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2269|     18|            goto safe_decode;
 2270|     18|        }
 2271|       |        /* Ring buffer restarting at its beginning : the oldest referenced history (max distance behind op)
 2272|       |         * lies in the external dictionary, ahead of op, always at the same distance.
 2273|       |         * Rings sized with the former LZ4_DECODER_RING_BUFFER_SIZE() (margin 14, up to v1.10.0)
 2274|       |         * still work, but leave as little as 16 bytes :
 2275|       |         * the fast loop's wide copies could overwrite it, the safe loop's can't. */
 2276|    102|        if ( (dict==usingExtDict)
  ------------------
  |  Branch (2276:14): [True: 0, False: 102]
  ------------------
 2277|      0|          && ((uptrval)dictEnd - (uptrval)lowPrefix - LZ4_DISTANCE_ABSOLUTE_MAX < FASTLOOP_SAFE_DISTANCE) ) {
  ------------------
  |  |  255|      0|#define LZ4_DISTANCE_ABSOLUTE_MAX 65535
  ------------------
                        && ((uptrval)dictEnd - (uptrval)lowPrefix - LZ4_DISTANCE_ABSOLUTE_MAX < FASTLOOP_SAFE_DISTANCE) ) {
  ------------------
  |  |  248|      0|#define FASTLOOP_SAFE_DISTANCE 64
  ------------------
  |  Branch (2277:14): [True: 0, False: 0]
  ------------------
 2278|      0|            DEBUGLOG(6, "history just ahead : move to safe decode loop");
  ------------------
  |  |  289|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2279|      0|            goto safe_decode;
 2280|      0|        }
 2281|       |
 2282|       |        /* Fast loop : decode sequences as long as output < oend-FASTLOOP_SAFE_DISTANCE,
 2283|       |         * and input is not too close to iend.
 2284|       |         * It hands over to the safe loop either at a sequence start (break),
 2285|       |         * or once a match is fully decoded (goto safe_match_copy). */
 2286|    102|        DEBUGLOG(6, "using fast decode loop");
  ------------------
  |  |  289|    102|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2287|    144|        while (1) {
  ------------------
  |  Branch (2287:16): [True: 144, Folded]
  ------------------
 2288|    144|            unsigned token;
 2289|    144|            size_t ll;   /* literal length */
 2290|    144|            BYTE* cpy;
 2291|       |            /* Main fastloop assertion: We can always wildcopy FASTLOOP_SAFE_DISTANCE */
 2292|    144|            assert(oend - op >= FASTLOOP_SAFE_DISTANCE);
  ------------------
  |  |  273|    144|#    define assert(condition) ((void)0)
  ------------------
 2293|    144|            assert(ip < iend);
  ------------------
  |  |  273|    144|#    define assert(condition) ((void)0)
  ------------------
 2294|    144|            token = *ip++;
 2295|    144|            ll = token >> ML_BITS;
  ------------------
  |  |  260|    144|#define ML_BITS  4
  ------------------
 2296|    144|            DEBUGLOG(7, "blockPos%6u: litLength token = %u", (unsigned)(op-(BYTE*)dst), (unsigned)ll);
  ------------------
  |  |  289|    144|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2297|       |
 2298|       |            /* too close to input end : the safe loop restarts this sequence */
 2299|    144|            if (ip > iend-(16 + 1/*max lit + offset + nextToken*/)) { ip--; break; }
  ------------------
  |  Branch (2299:17): [True: 33, False: 111]
  ------------------
 2300|       |
 2301|       |            /* decode literal length */
 2302|    111|            if (ll == RUN_MASK) {
  ------------------
  |  |  263|    111|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  262|    111|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  260|    111|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2302:17): [True: 71, False: 40]
  ------------------
 2303|       |                /* literal length >= RUN_MASK means >= RUN_MASK literal bytes follow the extension bytes,
 2304|       |                 * so extension bytes cannot reach the last RUN_MASK bytes of input */
 2305|     71|                const BYTE* const tokenPos = ip-1;
 2306|     71|                size_t const addl = read_variable_length(&ip, iend - RUN_MASK);
  ------------------
  |  |  263|     71|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  262|     71|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  260|     71|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2307|     71|                if (addl == rvl_error) {
  ------------------
  |  Branch (2307:21): [True: 1, False: 70]
  ------------------
 2308|      1|                    DEBUGLOG(6, "error reading long literal length");
  ------------------
  |  |  289|      1|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2309|      1|                    goto _output_error;
 2310|      1|                }
 2311|     70|                ll += addl;
 2312|     70|                if (unlikely((uptrval)(op)+ll<(uptrval)(op))) { goto _output_error; } /* overflow detection */
  ------------------
  |  |  180|     70|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|     70|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 0, False: 70]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2313|     70|                if (unlikely((uptrval)(ip)+ll<(uptrval)(ip))) { goto _output_error; } /* overflow detection */
  ------------------
  |  |  180|     70|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|     70|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 0, False: 70]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2314|       |
 2315|       |                /* copy literals, unless too close to the end for a wild copy :
 2316|       |                 * nothing is written yet, so the safe loop can restart this sequence */
 2317|     70|                cpy = op+ll;
 2318|     70|                LZ4_STATIC_ASSERT(MFLIMIT >= WILDCOPYLENGTH);
  ------------------
  |  |  277|     70|#define LZ4_STATIC_ASSERT(c)   { enum { LZ4_static_assert = 1/(int)(!!(c)) }; }   /* use after variable declarations */
  ------------------
 2319|     70|              #if LZ4_WILDCOPY64
 2320|     70|                if ((cpy>oend-64) || (ip+ll>iend-64)) { ip = tokenPos; break; }
  ------------------
  |  Branch (2320:21): [True: 26, False: 44]
  |  Branch (2320:38): [True: 30, False: 14]
  ------------------
 2321|     14|                LZ4_wildCopy64(op, ip, cpy);
 2322|       |              #else
 2323|       |                if ((cpy>oend-32) || (ip+ll>iend-32)) { ip = tokenPos; break; }
 2324|       |                LZ4_wildCopy32(op, ip, cpy);
 2325|       |              #endif
 2326|     14|                ip += ll; op = cpy;
 2327|     40|            } else {
 2328|     40|                DEBUGLOG(7, "copy %u bytes in a 16-bytes stripe", (unsigned)ll);
  ------------------
  |  |  289|     40|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2329|       |                /* Literals can only be <= 14, but hope compilers optimize better when copy by a register size */
 2330|     40|                LZ4_memcpy(op, ip, 16);
  ------------------
  |  |  349|     40|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2331|     40|                ip += ll; op += ll;
 2332|     40|            }
 2333|       |
 2334|       |            /* get offset */
 2335|     54|            offset = LZ4_readLE16(ip); ip+=2;
 2336|     54|            DEBUGLOG(6, "blockPos%6u: offset = %u", (unsigned)(op-(BYTE*)dst), (unsigned)offset);
  ------------------
  |  |  289|     54|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2337|     54|            match = op - offset;
 2338|     54|            assert(match <= op);  /* overflow check */
  ------------------
  |  |  273|     54|#    define assert(condition) ((void)0)
  ------------------
 2339|       |
 2340|       |            /* get matchlength */
 2341|     54|            ml = token & ML_MASK;
  ------------------
  |  |  261|     54|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  260|     54|#define ML_BITS  4
  |  |  ------------------
  ------------------
 2342|     54|            DEBUGLOG(7, "  match length token = %u (len==%u)", (unsigned)ml, (unsigned)ml+MINMATCH);
  ------------------
  |  |  289|     54|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2343|       |
 2344|     54|            if (ml == ML_MASK) {
  ------------------
  |  |  261|     54|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  260|     54|#define ML_BITS  4
  |  |  ------------------
  ------------------
  |  Branch (2344:17): [True: 15, False: 39]
  ------------------
 2345|       |                /* after match length extension bytes, at least 1 token + LASTLITERALS literals must remain */
 2346|     15|                size_t const addl = read_variable_length(&ip, iend - (1 + LASTLITERALS));
  ------------------
  |  |  245|     15|#define LASTLITERALS   5   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
 2347|     15|                if (addl == rvl_error) {
  ------------------
  |  Branch (2347:21): [True: 2, False: 13]
  ------------------
 2348|      2|                    DEBUGLOG(5, "error reading long match length");
  ------------------
  |  |  289|      2|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2349|      2|                    goto _output_error;
 2350|      2|                }
 2351|     13|                ml += addl;
 2352|     13|                DEBUGLOG(7, "  long match length == %u", (unsigned)ml + MINMATCH);
  ------------------
  |  |  289|     13|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2353|     13|                if (unlikely((uptrval)(op)+ml<(uptrval)op)) { goto _output_error; } /* overflow detection */
  ------------------
  |  |  180|     13|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|     13|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 0, False: 13]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2354|     13|            }
 2355|     52|            ml += MINMATCH;
  ------------------
  |  |  242|     52|#define MINMATCH 4
  ------------------
 2356|       |
 2357|     52|            if (op + ml >= oend - FASTLOOP_SAFE_DISTANCE) {
  ------------------
  |  |  248|     52|#define FASTLOOP_SAFE_DISTANCE 64
  ------------------
  |  Branch (2357:17): [True: 4, False: 48]
  ------------------
 2358|      4|                DEBUGLOG(7, "moving to safe_match_copy (ml==%u)", (unsigned)ml);
  ------------------
  |  |  289|      4|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2359|      4|                goto safe_match_copy;
 2360|      4|            }
 2361|       |
 2362|       |            /* match length from token only (<= 18), no overlap, within prefix : copy 18 bytes */
 2363|     48|            if ( ((token & ML_MASK) != ML_MASK) && (offset >= 8)
  ------------------
  |  |  261|     48|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  260|     48|#define ML_BITS  4
  |  |  ------------------
  ------------------
                          if ( ((token & ML_MASK) != ML_MASK) && (offset >= 8)
  ------------------
  |  |  261|     48|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  260|     48|#define ML_BITS  4
  |  |  ------------------
  ------------------
  |  Branch (2363:18): [True: 35, False: 13]
  |  Branch (2363:52): [True: 8, False: 27]
  ------------------
 2364|      8|              && ((dict == withPrefix64k) || (match >= lowPrefix)) ) {
  ------------------
  |  Branch (2364:19): [True: 0, False: 8]
  |  Branch (2364:46): [True: 7, False: 1]
  ------------------
 2365|      7|                assert(match >= lowPrefix);
  ------------------
  |  |  273|      7|#    define assert(condition) ((void)0)
  ------------------
 2366|      7|                assert(match <= op);
  ------------------
  |  |  273|      7|#    define assert(condition) ((void)0)
  ------------------
 2367|      7|                assert(op + 18 <= oend);
  ------------------
  |  |  273|      7|#    define assert(condition) ((void)0)
  ------------------
 2368|      7|                LZ4_memcpy(op, match, 8);
  ------------------
  |  |  349|      7|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2369|      7|                LZ4_memcpy(op+8, match+8, 8);
  ------------------
  |  |  349|      7|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2370|      7|                LZ4_memcpy(op+16, match+16, 2);
  ------------------
  |  |  349|      7|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2371|      7|                op += ml;
 2372|      7|                continue;
 2373|      7|            }
 2374|       |
 2375|       |            /* match ends far from oend : no end-of-block condition to check */
 2376|     41|            assert(op + ml < oend - FASTLOOP_SAFE_DISTANCE);
  ------------------
  |  |  273|     41|#    define assert(condition) ((void)0)
  ------------------
 2377|       |
 2378|     41|            if ( checkOffset && (unlikely(match + dictSize < lowPrefix)) ) {
  ------------------
  |  |  180|     41|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|     41|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  ------------------
  ------------------
  |  Branch (2378:18): [True: 41, False: 0]
  |  Branch (2378:33): [True: 6, False: 35]
  ------------------
 2379|      6|                DEBUGLOG(5, "Error : pos=%zi, offset=%zi => outside buffers", op-lowPrefix, op-match);
  ------------------
  |  |  289|      6|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2380|      6|                goto _offset_error;
 2381|      6|            }
 2382|       |            /* match starting within external dictionary */
 2383|     35|            if ((dict==usingExtDict) && (match < lowPrefix)) {
  ------------------
  |  Branch (2383:17): [True: 0, False: 35]
  |  Branch (2383:41): [True: 0, False: 0]
  ------------------
 2384|      0|                assert(dictEnd != NULL);
  ------------------
  |  |  273|      0|#    define assert(condition) ((void)0)
  ------------------
 2385|      0|                op = LZ4_copyExtDictMatch(op, match, ml, lowPrefix, dictEnd);
 2386|      0|                continue;
 2387|      0|            }
 2388|       |
 2389|       |            /* copy match within block */
 2390|     35|            cpy = op + ml;
 2391|       |
 2392|     35|            assert((op <= oend) && (oend-op >= 64));
  ------------------
  |  |  273|     35|#    define assert(condition) ((void)0)
  ------------------
 2393|     35|            if (unlikely(offset<16)) {
  ------------------
  |  |  180|     35|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|     35|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 35, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2394|     35|                LZ4_memcpy_using_offset(op, match, cpy, offset);
 2395|     35|    #if LZ4_WILDCOPY64
 2396|     35|            } else if (offset >= 64) {
  ------------------
  |  Branch (2396:24): [True: 0, False: 0]
  ------------------
 2397|      0|                LZ4_wildCopy64(op, match, cpy);
 2398|      0|    #endif
 2399|      0|            } else {
 2400|      0|                LZ4_wildCopy32(op, match, cpy);
 2401|      0|            }
 2402|       |
 2403|     35|            op = cpy;   /* wildcopy correction */
 2404|     35|        }
 2405|    107|    safe_decode:
 2406|    107|#endif
 2407|       |
 2408|       |        /* Safe loop : decode remaining sequences, without writing beyond oend nor reading beyond iend.
 2409|       |         * With LZ4_FAST_DEC_LOOP, that's the end of the block (or a block too small for the fast loop),
 2410|       |         * entered at a sequence start, or at safe_match_copy with a decoded match.
 2411|       |         * Without it, that's the whole block. */
 2412|    107|        DEBUGLOG(6, "using safe decode loop");
  ------------------
  |  |  289|    107|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2413|    348|        while (1) {
  ------------------
  |  Branch (2413:16): [True: 348, Folded]
  ------------------
 2414|    348|            unsigned token;
 2415|    348|            size_t ll;   /* literal length */
 2416|    348|            BYTE* cpy;
 2417|    348|            assert(ip < iend);
  ------------------
  |  |  273|    348|#    define assert(condition) ((void)0)
  ------------------
 2418|    348|            token = *ip++;
 2419|    348|            ll = token >> ML_BITS;
  ------------------
  |  |  260|    348|#define ML_BITS  4
  ------------------
 2420|    348|            DEBUGLOG(7, "blockPos%6u: litLength token = %u", (unsigned)(op-(BYTE*)dst), (unsigned)ll);
  ------------------
  |  |  289|    348|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2421|       |
 2422|       |            /* A two-stage shortcut for the most common case:
 2423|       |             * 1) If the literal length is 0..14, and there is enough space,
 2424|       |             * enter the shortcut and copy 16 bytes on behalf of the literals.
 2425|       |             * 2) Further if the match length is 4..18, copy 18 bytes in a similar
 2426|       |             * manner; but we ensure that there's enough space in the output for
 2427|       |             * those 18 bytes earlier, upon entering the shortcut (in other words,
 2428|       |             * there is a combined check for both stages).
 2429|       |             */
 2430|    348|            if ( (ll != RUN_MASK)
  ------------------
  |  |  263|    348|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  262|    348|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  260|    348|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2430:18): [True: 257, False: 91]
  ------------------
 2431|       |                /* strictly "less than" on input, to re-enter the loop with at least one byte */
 2432|    257|              && likely((ip < shortiend) & (op <= shortoend)) ) {
  ------------------
  |  |  177|    257|#define likely(expr)     expect((expr) != 0, 1)
  |  |  ------------------
  |  |  |  |  171|    257|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 62, False: 195]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2433|       |                /* Copy the literals */
 2434|     62|                LZ4_memcpy(op, ip, 16);
  ------------------
  |  |  349|     62|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2435|     62|                op += ll; ip += ll;
 2436|       |
 2437|       |                /* The second stage: prepare for match copying, decode full info.
 2438|       |                 * If it doesn't work out, the info won't be wasted. */
 2439|     62|                offset = LZ4_readLE16(ip); ip += 2;
 2440|     62|                match = op - offset;
 2441|     62|                assert(match <= op); /* check overflow */
  ------------------
  |  |  273|     62|#    define assert(condition) ((void)0)
  ------------------
 2442|     62|                ml = token & ML_MASK;
  ------------------
  |  |  261|     62|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  260|     62|#define ML_BITS  4
  |  |  ------------------
  ------------------
 2443|     62|                DEBUGLOG(7, "blockPos%6u: matchLength token = %u (len=%u)", (unsigned)(op-(BYTE*)dst), (unsigned)ml, (unsigned)ml + 4);
  ------------------
  |  |  289|     62|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2444|       |
 2445|       |                /* Do not deal with overlapping matches. */
 2446|     62|                if ( (ml != ML_MASK)
  ------------------
  |  |  261|     62|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  260|     62|#define ML_BITS  4
  |  |  ------------------
  ------------------
  |  Branch (2446:22): [True: 62, False: 0]
  ------------------
 2447|     62|                  && (offset >= 8)
  ------------------
  |  Branch (2447:22): [True: 28, False: 34]
  ------------------
 2448|     28|                  && (dict==withPrefix64k || match >= lowPrefix) ) {
  ------------------
  |  Branch (2448:23): [True: 0, False: 28]
  |  Branch (2448:46): [True: 28, False: 0]
  ------------------
 2449|       |                    /* Copy the match. */
 2450|     28|                    LZ4_memcpy(op + 0, match + 0, 8);
  ------------------
  |  |  349|     28|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2451|     28|                    LZ4_memcpy(op + 8, match + 8, 8);
  ------------------
  |  |  349|     28|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2452|     28|                    LZ4_memcpy(op +16, match +16, 2);
  ------------------
  |  |  349|     28|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2453|     28|                    op += ml + MINMATCH;
  ------------------
  |  |  242|     28|#define MINMATCH 4
  ------------------
 2454|       |                    /* Both stages worked, load the next token. */
 2455|     28|                    continue;
 2456|     28|                }
 2457|       |                /* The second stage didn't work out, but the info is ready for the match copy below. */
 2458|    286|            } else {
 2459|       |                /* decode literal length */
 2460|    286|                if (ll == RUN_MASK) {
  ------------------
  |  |  263|    286|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  262|    286|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  260|    286|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2460:21): [True: 91, False: 195]
  ------------------
 2461|       |                    /* literal length >= RUN_MASK means >= RUN_MASK literal bytes follow the extension bytes,
 2462|       |                     * so extension bytes cannot reach the last RUN_MASK bytes of input */
 2463|     91|                    size_t const addl = read_variable_length(&ip, iend-RUN_MASK);
  ------------------
  |  |  263|     91|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  262|     91|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  260|     91|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2464|     91|                    if (addl == rvl_error) { goto _output_error; }
  ------------------
  |  Branch (2464:25): [True: 9, False: 82]
  ------------------
 2465|     82|                    ll += addl;
 2466|     82|                    if (unlikely((uptrval)(op)+ll<(uptrval)(op))) { goto _output_error; } /* overflow detection */
  ------------------
  |  |  180|     82|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|     82|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 0, False: 82]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2467|     82|                    if (unlikely((uptrval)(ip)+ll<(uptrval)(ip))) { goto _output_error; } /* overflow detection */
  ------------------
  |  |  180|     82|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|     82|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 0, False: 82]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2468|     82|                }
 2469|       |
 2470|       |                /* copy literals */
 2471|    277|                cpy = op+ll;
 2472|    277|                LZ4_STATIC_ASSERT(MFLIMIT >= WILDCOPYLENGTH);
  ------------------
  |  |  277|    277|#define LZ4_STATIC_ASSERT(c)   { enum { LZ4_static_assert = 1/(int)(!!(c)) }; }   /* use after variable declarations */
  ------------------
 2473|    277|                if ((cpy>oend-MFLIMIT) || (ip+ll>iend-(2+1+LASTLITERALS))) {
  ------------------
  |  |  246|    277|#define MFLIMIT       12   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
                              if ((cpy>oend-MFLIMIT) || (ip+ll>iend-(2+1+LASTLITERALS))) {
  ------------------
  |  |  245|    204|#define LASTLITERALS   5   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
  |  Branch (2473:21): [True: 73, False: 204]
  |  Branch (2473:43): [True: 22, False: 182]
  ------------------
 2474|       |                    /* close to input or output end : these must be the last literals of the block,
 2475|       |                     * except with partialDecoding, which can also stop within them */
 2476|     95|                    if (partialDecoding) {
  ------------------
  |  Branch (2476:25): [True: 0, False: 95]
  ------------------
 2477|       |                        /* stop at input end, or when output is full */
 2478|      0|                        ll = MIN(ll, (size_t)(iend-ip));
  ------------------
  |  | 1997|      0|#define MIN(a,b)    ( (a) < (b) ? (a) : (b) )
  |  |  ------------------
  |  |  |  Branch (1997:23): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2479|      0|                        ll = MIN(ll, (size_t)(oend-op));
  ------------------
  |  | 1997|      0|#define MIN(a,b)    ( (a) < (b) ? (a) : (b) )
  |  |  ------------------
  |  |  |  Branch (1997:23): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2480|     95|                    } else if ((ip+ll != iend) || (cpy > oend)) {
  ------------------
  |  Branch (2480:32): [True: 21, False: 74]
  |  Branch (2480:51): [True: 1, False: 73]
  ------------------
 2481|       |                        /* last literals must end exactly at input end, within output */
 2482|     22|                        DEBUGLOG(5, "invalid last literals : they end at iend%+zi and oend%+zi", (ip+ll)-iend, cpy-oend);
  ------------------
  |  |  289|     22|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2483|     22|                        if ((ip+ll <= iend) && (cpy > oend-MFLIMIT)) goto _dst_too_small;   /* output full, input left */
  ------------------
  |  |  246|     15|#define MFLIMIT       12   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
  |  Branch (2483:29): [True: 15, False: 7]
  |  Branch (2483:48): [True: 2, False: 13]
  ------------------
 2484|     20|                        goto _output_error;
 2485|     22|                    }
 2486|     73|                    LZ4_memmove(op, ip, ll);  /* supports overlapping memory regions, for in-place decompression scenarios */
  ------------------
  |  |  357|     73|#    define LZ4_memmove __builtin_memmove
  ------------------
 2487|     73|                    ip += ll;
 2488|     73|                    op += ll;
 2489|       |                    /* end of block, unless partialDecoding can go on : output not full, input left for a match */
 2490|     73|                    if (!partialDecoding || (op == oend) || (ip >= (iend-2))) {
  ------------------
  |  Branch (2490:25): [True: 73, False: 0]
  |  Branch (2490:45): [True: 0, False: 0]
  |  Branch (2490:61): [True: 0, False: 0]
  ------------------
 2491|     73|                        break;
 2492|     73|                    }
 2493|    182|                } else {
 2494|    182|                    LZ4_wildCopy8(op, ip, cpy);   /* can overwrite up to 8 bytes beyond cpy */
 2495|    182|                    ip += ll; op = cpy;
 2496|    182|                }
 2497|       |
 2498|       |                /* get offset */
 2499|    182|                offset = LZ4_readLE16(ip); ip+=2;
 2500|    182|                match = op - offset;
 2501|       |
 2502|       |                /* get matchlength */
 2503|    182|                ml = token & ML_MASK;
  ------------------
  |  |  261|    182|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  260|    182|#define ML_BITS  4
  |  |  ------------------
  ------------------
 2504|    182|                DEBUGLOG(7, "blockPos%6u: matchLength token = %u", (unsigned)(op-(BYTE*)dst), (unsigned)ml);
  ------------------
  |  |  289|    182|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2505|    182|            }
 2506|       |
 2507|       |            /* literals copied, offset decoded, ml == match length token */
 2508|    216|            if (ml == ML_MASK) {
  ------------------
  |  |  261|    216|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  260|    216|#define ML_BITS  4
  |  |  ------------------
  ------------------
  |  Branch (2508:17): [True: 35, False: 181]
  ------------------
 2509|       |                /* after match length extension bytes, at least 1 token + LASTLITERALS literals must remain */
 2510|     35|                size_t const addl = read_variable_length(&ip, iend - (1 + LASTLITERALS));
  ------------------
  |  |  245|     35|#define LASTLITERALS   5   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
 2511|     35|                if (addl == rvl_error) { goto _output_error; }
  ------------------
  |  Branch (2511:21): [True: 0, False: 35]
  ------------------
 2512|     35|                ml += addl;
 2513|     35|                if (unlikely((uptrval)(op)+ml<(uptrval)op)) goto _output_error;   /* overflow detection */
  ------------------
  |  |  180|     35|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|     35|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 0, False: 35]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2514|     35|            }
 2515|    216|            ml += MINMATCH;
  ------------------
  |  |  242|    216|#define MINMATCH 4
  ------------------
 2516|       |
 2517|    216|#if LZ4_FAST_DEC_LOOP
 2518|    220|        safe_match_copy:
 2519|    220|#endif
 2520|       |            /* literals copied, match fully decoded (ml includes MINMATCH), offset not validated yet */
 2521|    220|            if ((checkOffset) && (unlikely(match + dictSize < lowPrefix))) goto _offset_error;   /* Error : offset outside buffers */
  ------------------
  |  |  180|    220|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|    220|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  ------------------
  ------------------
  |  Branch (2521:17): [True: 220, False: 0]
  |  Branch (2521:34): [True: 6, False: 214]
  ------------------
 2522|       |
 2523|       |            /* end of block : the last LASTLITERALS bytes must be literals */
 2524|    214|            assert(op <= oend);
  ------------------
  |  |  273|    214|#    define assert(condition) ((void)0)
  ------------------
 2525|    214|            if (unlikely(op+ml > oend-LASTLITERALS)) {
  ------------------
  |  |  180|    214|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|    214|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 1, False: 213]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2526|      1|                if (partialDecoding) ml = MIN(ml, (size_t)(oend-op));   /* partialDecoding : may end anywhere */
  ------------------
  |  | 1997|      0|#define MIN(a,b)    ( (a) < (b) ? (a) : (b) )
  |  |  ------------------
  |  |  |  Branch (1997:23): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (2526:21): [True: 0, False: 1]
  ------------------
 2527|      1|                else goto _dst_too_small;
 2528|      1|            }
 2529|       |
 2530|       |            /* match starting within external dictionary */
 2531|    213|            if ((dict==usingExtDict) && (match < lowPrefix)) {
  ------------------
  |  Branch (2531:17): [True: 0, False: 213]
  |  Branch (2531:41): [True: 0, False: 0]
  ------------------
 2532|      0|                assert(dictEnd != NULL);
  ------------------
  |  |  273|      0|#    define assert(condition) ((void)0)
  ------------------
 2533|      0|                op = LZ4_copyExtDictMatch(op, match, ml, lowPrefix, dictEnd);
 2534|      0|                continue;
 2535|      0|            }
 2536|    213|            assert(match >= lowPrefix);
  ------------------
  |  |  273|    213|#    define assert(condition) ((void)0)
  ------------------
 2537|       |
 2538|       |            /* close to block end : no wild copy */
 2539|    213|            if (unlikely(op+ml > oend-MATCH_SAFEGUARD_DISTANCE)) {
  ------------------
  |  |  180|    213|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|    213|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 57, False: 156]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2540|     57|                op = LZ4_copyMatchExact(op, match, ml);
 2541|     57|                if (op == oend) { break; }   /* partialDecoding : output buffer full */
  ------------------
  |  Branch (2541:21): [True: 0, False: 57]
  ------------------
 2542|     57|                continue;
 2543|     57|            }
 2544|       |
 2545|       |            /* copy match within block */
 2546|    156|            cpy = op + ml;
 2547|    156|            LZ4_memcpy_using_offset_base(op, match, cpy, offset);
 2548|    156|            op = cpy;   /* wildcopy correction */
 2549|    156|        }
 2550|       |
 2551|       |        /* end of decoding */
 2552|     73|        DEBUGLOG(5, "decoded %i bytes", (int) (((char*)op)-dst));
  ------------------
  |  |  289|     73|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2553|     73|        return (int) (((char*)op)-dst);     /* Nb of output bytes decoded */
 2554|       |
 2555|       |        /* errors : see LZ4_decompress_safe() in lz4.h */
 2556|     32|    _output_error:
 2557|     32|        return -1;
 2558|      3|    _dst_too_small:
 2559|      3|        return -2;
 2560|     12|    _offset_error:
 2561|     12|        return -3;
 2562|    107|    }
 2563|    107|}
lz4.c:read_variable_length:
 2132|    212|{
 2133|    212|    Rvl_t s, length = 0;
 2134|    212|    assert(ipPtr != NULL);
  ------------------
  |  |  273|    212|#    define assert(condition) ((void)0)
  ------------------
 2135|    212|    assert(*ipPtr !=  NULL);
  ------------------
  |  |  273|    212|#    define assert(condition) ((void)0)
  ------------------
 2136|    212|    assert(ilimit != NULL);
  ------------------
  |  |  273|    212|#    define assert(condition) ((void)0)
  ------------------
 2137|    212|    if (unlikely((*ipPtr) >= ilimit)) {    /* read limit reached */
  ------------------
  |  |  180|    212|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|    212|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 9, False: 203]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2138|      9|        return rvl_error;
 2139|      9|    }
 2140|    203|    s = **ipPtr;
 2141|    203|    (*ipPtr)++;
 2142|    203|    length += s;
 2143|    203|    if (likely(s != 255)) return length;
  ------------------
  |  |  177|    203|#define likely(expr)     expect((expr) != 0, 1)
  |  |  ------------------
  |  |  |  |  171|    203|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 178, False: 25]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2144|     49|    do {
 2145|     49|        if (unlikely((*ipPtr) >= ilimit)) {    /* read limit reached */
  ------------------
  |  |  180|     49|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|     49|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 3, False: 46]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2146|      3|            return rvl_error;
 2147|      3|        }
 2148|     46|        s = **ipPtr;
 2149|     46|        (*ipPtr)++;
 2150|     46|        length += s;
 2151|       |        /* accumulator overflow detection (32-bit mode only) */
 2152|     46|        if ((sizeof(length) < 8) && unlikely(length > ((Rvl_t)(-1)/2)) ) {
  ------------------
  |  |  180|      0|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|      0|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2152:13): [Folded, False: 46]
  ------------------
 2153|      0|            return rvl_error;
 2154|      0|        }
 2155|     46|    } while (s == 255);
  ------------------
  |  Branch (2155:14): [True: 24, False: 22]
  ------------------
 2156|       |
 2157|     22|    return length;
 2158|     25|}
lz4.c:LZ4_wildCopy64:
  537|     14|{
  538|     14|    BYTE* d = (BYTE*)dstPtr;
  539|     14|    const BYTE* s = (const BYTE*)srcPtr;
  540|     14|    BYTE* const e = (BYTE*)dstEnd;
  541|       |
  542|     14|    do { LZ4_memcpy(d,s,64); d+=64; s+=64; } while (d<e);
  ------------------
  |  |  349|     14|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  |  Branch (542:53): [True: 0, False: 14]
  ------------------
  543|     14|}
lz4.c:LZ4_readLE16:
  431|    298|{
  432|    298|    if (LZ4_isLittleEndian()) {
  ------------------
  |  Branch (432:9): [True: 298, False: 0]
  ------------------
  433|    298|        return LZ4_read16(memPtr);
  434|    298|    } else {
  435|      0|        const BYTE* p = (const BYTE*)memPtr;
  436|      0|        return (U16)((U16)p[0] | (p[1]<<8));
  437|      0|    }
  438|    298|}
lz4.c:LZ4_memcpy_using_offset:
  564|     35|{
  565|     35|    BYTE v[8];
  566|       |
  567|     35|    assert(dstEnd >= dstPtr + MINMATCH);
  ------------------
  |  |  273|     35|#    define assert(condition) ((void)0)
  ------------------
  568|       |
  569|     35|    switch(offset) {
  570|      2|    case 1:
  ------------------
  |  Branch (570:5): [True: 2, False: 33]
  ------------------
  571|      2|        MEM_INIT(v, *srcPtr, 8);
  ------------------
  |  |  236|      2|#define MEM_INIT(p,v,s)   LZ4_memset((p),(v),(s))
  |  |  ------------------
  |  |  |  |  234|      2|#  define LZ4_memset(p,v,s) memset((p),(v),(s))
  |  |  ------------------
  ------------------
  572|      2|        break;
  573|      1|    case 2:
  ------------------
  |  Branch (573:5): [True: 1, False: 34]
  ------------------
  574|      1|        LZ4_memcpy(v, srcPtr, 2);
  ------------------
  |  |  349|      1|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  575|      1|        LZ4_memcpy(&v[2], srcPtr, 2);
  ------------------
  |  |  349|      1|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  576|       |#if defined(_MSC_VER) && (_MSC_VER <= 1937) /* MSVC 2022 ver 17.7 or earlier */
  577|       |#  pragma warning(push)
  578|       |#  pragma warning(disable : 6385) /* warning C6385: Reading invalid data from 'v'. */
  579|       |#endif
  580|      1|        LZ4_memcpy(&v[4], v, 4);
  ------------------
  |  |  349|      1|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  581|       |#if defined(_MSC_VER) && (_MSC_VER <= 1937) /* MSVC 2022 ver 17.7 or earlier */
  582|       |#  pragma warning(pop)
  583|       |#endif
  584|      1|        break;
  585|      3|    case 4:
  ------------------
  |  Branch (585:5): [True: 3, False: 32]
  ------------------
  586|      3|        LZ4_memcpy(v, srcPtr, 4);
  ------------------
  |  |  349|      3|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  587|      3|        LZ4_memcpy(&v[4], srcPtr, 4);
  ------------------
  |  |  349|      3|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  588|      3|        break;
  589|     29|    default:
  ------------------
  |  Branch (589:5): [True: 29, False: 6]
  ------------------
  590|     29|        LZ4_memcpy_using_offset_base(dstPtr, srcPtr, dstEnd, offset);
  591|     29|        return;
  592|     35|    }
  593|       |
  594|      6|    LZ4_memcpy(dstPtr, v, 8);
  ------------------
  |  |  349|      6|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  595|      6|    dstPtr += 8;
  596|    209|    while (dstPtr < dstEnd) {
  ------------------
  |  Branch (596:12): [True: 203, False: 6]
  ------------------
  597|    203|        LZ4_memcpy(dstPtr, v, 8);
  ------------------
  |  |  349|    203|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  598|    203|        dstPtr += 8;
  599|    203|    }
  600|      6|}
lz4.c:LZ4_copyMatchExact:
 2167|     57|{
 2168|     57|    if (unlikely(match == op)) {   /* invalid offset 0 : clear the match segment, see doc/lz4_Block_format.md */
  ------------------
  |  |  180|     57|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|     57|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 1, False: 56]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2169|      1|        MEM_INIT(op, 0, length);
  ------------------
  |  |  236|      1|#define MEM_INIT(p,v,s)   LZ4_memset((p),(v),(s))
  |  |  ------------------
  |  |  |  |  234|      1|#  define LZ4_memset(p,v,s) memset((p),(v),(s))
  |  |  ------------------
  ------------------
 2170|      1|        return op + length;
 2171|      1|    }
 2172|       |    /* bytes from match to op repeat with period (op-match) :
 2173|       |     * copy all of them, so the distance doubles at each round.
 2174|       |     * Beyond 2 KB, keep the distance : larger copies of just written data are slower */
 2175|    115|    while (length > (size_t)(op - match)) {
  ------------------
  |  Branch (2175:12): [True: 59, False: 56]
  ------------------
 2176|     59|        size_t const available = (size_t)(op - match);
 2177|     59|        LZ4_memcpy(op, match, available);
  ------------------
  |  |  349|     59|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2178|     59|        op += available;
 2179|     59|        length -= available;
 2180|     59|        if (available >= 2048) match += available;
  ------------------
  |  Branch (2180:13): [True: 0, False: 59]
  ------------------
 2181|     59|    }
 2182|     56|    LZ4_memcpy(op, match, length);
  ------------------
  |  |  349|     56|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2183|     56|    return op + length;
 2184|     57|}
lz4.c:LZ4_memcpy_using_offset_base:
  497|    185|{
  498|    185|    assert(srcPtr + offset == dstPtr);
  ------------------
  |  |  273|    185|#    define assert(condition) ((void)0)
  ------------------
  499|    185|    if (unlikely(offset < 8)) {
  ------------------
  |  |  180|    185|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|    185|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 101, False: 84]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  500|    101|        LZ4_write32(dstPtr, 0);   /* silence an msan warning when offset==0 */
  501|    101|        dstPtr[0] = srcPtr[0];
  502|    101|        dstPtr[1] = srcPtr[1];
  503|    101|        dstPtr[2] = srcPtr[2];
  504|    101|        dstPtr[3] = srcPtr[3];
  505|    101|        srcPtr += inc32table[offset];
  506|    101|        LZ4_memcpy(dstPtr+4, srcPtr, 4);
  ------------------
  |  |  349|    101|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  507|    101|        srcPtr -= dec64table[offset];
  508|    101|    } else {
  509|     84|        LZ4_memcpy(dstPtr, srcPtr, 8);
  ------------------
  |  |  349|     84|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  510|     84|        srcPtr += 8;
  511|     84|    }
  512|    185|    dstPtr += 8;
  513|       |
  514|       |    /* srcPtr is now at least 8 bytes behind dstPtr */
  515|    185|    LZ4_memcpy(dstPtr, srcPtr, 8);
  ------------------
  |  |  349|    185|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  516|    185|    if (dstEnd > dstPtr + 8) { LZ4_wildCopy8(dstPtr + 8, srcPtr + 8, dstEnd); }
  ------------------
  |  Branch (516:9): [True: 17, False: 168]
  ------------------
  517|    185|}

stream_size:
  189|    388|{
  190|    388|  return (size_t)(s->ptr - s->begin) * sizeof(bitstream_word);
  191|    388|}
stream_rtell:
  318|    252|{
  319|       |  return (bitstream_offset)(s->ptr - s->begin) * wsize - s->bits;
  ------------------
  |  |  130|    252|#define wsize ((bitstream_count)(sizeof(bitstream_word) * CHAR_BIT))
  ------------------
  320|    252|}
stream_rewind:
  332|  1.03k|{
  333|  1.03k|  s->ptr = s->begin;
  334|  1.03k|  s->buffer = 0;
  335|  1.03k|  s->bits = 0;
  336|  1.03k|}
stream_rseek:
  341|    252|{
  342|    252|  bitstream_count n = (bitstream_count)(offset % wsize);
  ------------------
  |  |  130|    252|#define wsize ((bitstream_count)(sizeof(bitstream_word) * CHAR_BIT))
  ------------------
  343|    252|  s->ptr = s->begin + (size_t)(offset / wsize);
  ------------------
  |  |  130|    252|#define wsize ((bitstream_count)(sizeof(bitstream_word) * CHAR_BIT))
  ------------------
  344|    252|  if (n) {
  ------------------
  |  Branch (344:7): [True: 0, False: 252]
  ------------------
  345|      0|    s->buffer = stream_read_word(s) >> n;
  346|      0|    s->bits = wsize - n;
  ------------------
  |  |  130|      0|#define wsize ((bitstream_count)(sizeof(bitstream_word) * CHAR_BIT))
  ------------------
  347|      0|  }
  348|    252|  else {
  349|    252|    s->buffer = 0;
  350|    252|    s->bits = 0;
  351|    252|  }
  352|    252|}
stream_skip:
  375|    252|{
  376|    252|  stream_rseek(s, stream_rtell(s) + n);
  377|    252|}
stream_pad:
  382|    127|{
  383|    127|  bitstream_offset bits = s->bits;
  384|    254|  for (bits += n; bits >= wsize; bits -= wsize) {
  ------------------
  |  |  130|    254|#define wsize ((bitstream_count)(sizeof(bitstream_word) * CHAR_BIT))
  ------------------
                for (bits += n; bits >= wsize; bits -= wsize) {
  ------------------
  |  |  130|    127|#define wsize ((bitstream_count)(sizeof(bitstream_word) * CHAR_BIT))
  ------------------
  |  Branch (384:19): [True: 127, False: 127]
  ------------------
  385|    127|    stream_write_word(s, s->buffer);
  386|    127|    s->buffer = 0;
  387|    127|  }
  388|    127|  s->bits = (bitstream_count)bits;
  389|    127|}
stream_align:
  394|    258|{
  395|    258|  bitstream_count bits = s->bits;
  396|    258|  if (bits)
  ------------------
  |  Branch (396:7): [True: 252, False: 6]
  ------------------
  397|    252|    stream_skip(s, bits);
  398|    258|  return bits;
  399|    258|}
stream_flush:
  404|    130|{
  405|    130|  bitstream_count bits = (wsize - s->bits) % wsize;
  ------------------
  |  |  130|    130|#define wsize ((bitstream_count)(sizeof(bitstream_word) * CHAR_BIT))
  ------------------
                bitstream_count bits = (wsize - s->bits) % wsize;
  ------------------
  |  |  130|    130|#define wsize ((bitstream_count)(sizeof(bitstream_word) * CHAR_BIT))
  ------------------
  406|    130|  if (bits)
  ------------------
  |  Branch (406:7): [True: 127, False: 3]
  ------------------
  407|    127|    stream_pad(s, bits);
  408|    130|  return bits;
  409|    130|}
stream_open:
  443|    518|{
  444|    518|  bitstream* s = (bitstream*)malloc(sizeof(bitstream));
  445|    518|  if (s) {
  ------------------
  |  Branch (445:7): [True: 518, False: 0]
  ------------------
  446|    518|    s->begin = (bitstream_word*)buffer;
  447|    518|    s->end = s->begin + bytes / sizeof(bitstream_word);
  448|       |#ifdef BIT_STREAM_STRIDED
  449|       |    stream_set_stride(s, 0, 0);
  450|       |#endif
  451|    518|    stream_rewind(s);
  452|    518|  }
  453|    518|  return s;
  454|    518|}
stream_close:
  459|    518|{
  460|    518|  free(s);
  461|    518|}
bitstream.c:stream_write_word:
  162|    127|{
  163|    127|  *s->ptr++ = value;
  164|       |#ifdef BIT_STREAM_STRIDED
  165|       |  if (!((s->ptr - s->begin) & s->mask))
  166|       |    s->ptr += s->delta;
  167|       |#endif
  168|    127|}
encode2d.c:stream_write_bits:
  290|     20|{
  291|       |  /* append bit string to buffer */
  292|     20|  s->buffer += (bitstream_word)(value << s->bits);
  293|     20|  s->bits += n;
  294|       |  /* is buffer full? */
  295|     20|  if (s->bits >= wsize) {
  ------------------
  |  |  130|     20|#define wsize ((bitstream_count)(sizeof(bitstream_word) * CHAR_BIT))
  ------------------
  |  Branch (295:7): [True: 2, False: 18]
  ------------------
  296|       |    /* 1 <= n <= 64; decrement n to ensure valid right shifts below */
  297|      2|    value >>= 1;
  298|      2|    n--;
  299|       |    /* assert: 0 <= n < 64; wsize <= s->bits <= wsize + n */
  300|      2|    do {
  301|       |      /* output wsize bits while buffer is full */
  302|      2|      s->bits -= wsize;
  ------------------
  |  |  130|      2|#define wsize ((bitstream_count)(sizeof(bitstream_word) * CHAR_BIT))
  ------------------
  303|       |      /* assert: 0 <= s->bits <= n */
  304|      2|      stream_write_word(s, s->buffer);
  305|       |      /* assert: 0 <= n - s->bits < 64 */
  306|      2|      s->buffer = (bitstream_word)(value >> (n - s->bits));
  307|      2|    } while (sizeof(s->buffer) < sizeof(value) && s->bits >= wsize);
  ------------------
  |  |  130|      0|#define wsize ((bitstream_count)(sizeof(bitstream_word) * CHAR_BIT))
  ------------------
  |  Branch (307:14): [Folded, False: 2]
  |  Branch (307:51): [True: 0, False: 0]
  ------------------
  308|      2|  }
  309|       |  /* assert: 0 <= s->bits < wsize */
  310|     20|  s->buffer &= ((bitstream_word)1 << s->bits) - 1;
  311|       |  /* assert: 0 <= n < 64 */
  312|     20|  return value >> n;
  313|     20|}
encode2d.c:stream_write_word:
  162|      2|{
  163|      2|  *s->ptr++ = value;
  164|       |#ifdef BIT_STREAM_STRIDED
  165|       |  if (!((s->ptr - s->begin) & s->mask))
  166|       |    s->ptr += s->delta;
  167|       |#endif
  168|      2|}
encode2d.c:stream_wtell:
  325|      4|{
  326|       |  return (bitstream_offset)(s->ptr - s->begin) * wsize + s->bits;
  ------------------
  |  |  130|      4|#define wsize ((bitstream_count)(sizeof(bitstream_word) * CHAR_BIT))
  ------------------
  327|      4|}
encode2d.c:stream_write_bit:
  242|     46|{
  243|     46|  s->buffer += (bitstream_word)bit << s->bits;
  244|     46|  if (++s->bits == wsize) {
  ------------------
  |  |  130|     46|#define wsize ((bitstream_count)(sizeof(bitstream_word) * CHAR_BIT))
  ------------------
  |  Branch (244:7): [True: 0, False: 46]
  ------------------
  245|      0|    stream_write_word(s, s->buffer);
  246|      0|    s->buffer = 0;
  247|      0|    s->bits = 0;
  248|      0|  }
  249|     46|  return bit;
  250|     46|}
decode2d.c:stream_read_bit:
  227|     96|{
  228|     96|  uint bit;
  229|     96|  if (!s->bits) {
  ------------------
  |  Branch (229:7): [True: 6, False: 90]
  ------------------
  230|      6|    s->buffer = stream_read_word(s);
  231|       |    s->bits = wsize;
  ------------------
  |  |  130|      6|#define wsize ((bitstream_count)(sizeof(bitstream_word) * CHAR_BIT))
  ------------------
  232|      6|  }
  233|     96|  s->bits--;
  234|     96|  bit = (uint)s->buffer & 1u;
  235|     96|  s->buffer >>= 1;
  236|     96|  return bit;
  237|     96|}
decode2d.c:stream_read_word:
  150|      8|{
  151|      8|  bitstream_word w = *s->ptr++;
  152|       |#ifdef BIT_STREAM_STRIDED
  153|       |  if (!((s->ptr - s->begin) & s->mask))
  154|       |    s->ptr += s->delta;
  155|       |#endif
  156|      8|  return w;
  157|      8|}
decode2d.c:stream_read_bits:
  255|     40|{
  256|     40|  uint64 value = s->buffer;
  257|     40|  if (s->bits < n) {
  ------------------
  |  Branch (257:7): [True: 2, False: 38]
  ------------------
  258|       |    /* keep fetching wsize bits until enough bits are buffered */
  259|      2|    do {
  260|       |      /* assert: 0 <= s->bits < n <= 64 */
  261|      2|      s->buffer = stream_read_word(s);
  262|      2|      value += (uint64)s->buffer << s->bits;
  263|      2|      s->bits += wsize;
  ------------------
  |  |  130|      2|#define wsize ((bitstream_count)(sizeof(bitstream_word) * CHAR_BIT))
  ------------------
  264|      2|    } while (sizeof(s->buffer) < sizeof(value) && s->bits < n);
  ------------------
  |  Branch (264:14): [Folded, False: 2]
  |  Branch (264:51): [True: 0, False: 0]
  ------------------
  265|       |    /* assert: 1 <= n <= s->bits < n + wsize */
  266|      2|    s->bits -= n;
  267|      2|    if (!s->bits) {
  ------------------
  |  Branch (267:9): [True: 0, False: 2]
  ------------------
  268|       |      /* value holds exactly n bits; no need for masking */
  269|      0|      s->buffer = 0;
  270|      0|    }
  271|      2|    else {
  272|       |      /* assert: 1 <= s->bits < wsize */
  273|      2|      s->buffer >>= wsize - s->bits;
  ------------------
  |  |  130|      2|#define wsize ((bitstream_count)(sizeof(bitstream_word) * CHAR_BIT))
  ------------------
  274|       |      /* assert: 1 <= n <= 64 */
  275|      2|      value &= ((uint64)2 << (n - 1)) - 1;
  276|      2|    }
  277|      2|  }
  278|     38|  else {
  279|       |    /* assert: 0 <= n <= s->bits < wsize <= 64 */
  280|     38|    s->bits -= n;
  281|     38|    s->buffer >>= n;
  282|     38|    value &= ((uint64)1 << n) - 1;
  283|     38|  }
  284|     40|  return value;
  285|     40|}
decode2d.c:stream_rtell:
  318|      8|{
  319|       |  return (bitstream_offset)(s->ptr - s->begin) * wsize - s->bits;
  ------------------
  |  |  130|      8|#define wsize ((bitstream_count)(sizeof(bitstream_word) * CHAR_BIT))
  ------------------
  320|      8|}
encode3f.c:stream_write_bits:
  290|    589|{
  291|       |  /* append bit string to buffer */
  292|    589|  s->buffer += (bitstream_word)(value << s->bits);
  293|    589|  s->bits += n;
  294|       |  /* is buffer full? */
  295|    589|  if (s->bits >= wsize) {
  ------------------
  |  |  130|    589|#define wsize ((bitstream_count)(sizeof(bitstream_word) * CHAR_BIT))
  ------------------
  |  Branch (295:7): [True: 398, False: 191]
  ------------------
  296|       |    /* 1 <= n <= 64; decrement n to ensure valid right shifts below */
  297|    398|    value >>= 1;
  298|    398|    n--;
  299|       |    /* assert: 0 <= n < 64; wsize <= s->bits <= wsize + n */
  300|    398|    do {
  301|       |      /* output wsize bits while buffer is full */
  302|    398|      s->bits -= wsize;
  ------------------
  |  |  130|    398|#define wsize ((bitstream_count)(sizeof(bitstream_word) * CHAR_BIT))
  ------------------
  303|       |      /* assert: 0 <= s->bits <= n */
  304|    398|      stream_write_word(s, s->buffer);
  305|       |      /* assert: 0 <= n - s->bits < 64 */
  306|    398|      s->buffer = (bitstream_word)(value >> (n - s->bits));
  307|    398|    } while (sizeof(s->buffer) < sizeof(value) && s->bits >= wsize);
  ------------------
  |  |  130|      0|#define wsize ((bitstream_count)(sizeof(bitstream_word) * CHAR_BIT))
  ------------------
  |  Branch (307:14): [Folded, False: 398]
  |  Branch (307:51): [True: 0, False: 0]
  ------------------
  308|    398|  }
  309|       |  /* assert: 0 <= s->bits < wsize */
  310|    589|  s->buffer &= ((bitstream_word)1 << s->bits) - 1;
  311|       |  /* assert: 0 <= n < 64 */
  312|    589|  return value >> n;
  313|    589|}
encode3f.c:stream_write_word:
  162|    420|{
  163|    420|  *s->ptr++ = value;
  164|       |#ifdef BIT_STREAM_STRIDED
  165|       |  if (!((s->ptr - s->begin) & s->mask))
  166|       |    s->ptr += s->delta;
  167|       |#endif
  168|    420|}
encode3f.c:stream_wtell:
  325|     36|{
  326|       |  return (bitstream_offset)(s->ptr - s->begin) * wsize + s->bits;
  ------------------
  |  |  130|     36|#define wsize ((bitstream_count)(sizeof(bitstream_word) * CHAR_BIT))
  ------------------
  327|     36|}
encode3f.c:stream_write_bit:
  242|  2.06k|{
  243|  2.06k|  s->buffer += (bitstream_word)bit << s->bits;
  244|  2.06k|  if (++s->bits == wsize) {
  ------------------
  |  |  130|  2.06k|#define wsize ((bitstream_count)(sizeof(bitstream_word) * CHAR_BIT))
  ------------------
  |  Branch (244:7): [True: 22, False: 2.03k]
  ------------------
  245|     22|    stream_write_word(s, s->buffer);
  246|     22|    s->buffer = 0;
  247|     22|    s->bits = 0;
  248|     22|  }
  249|  2.06k|  return bit;
  250|  2.06k|}
encode3d.c:stream_write_bits:
  290|  1.18k|{
  291|       |  /* append bit string to buffer */
  292|  1.18k|  s->buffer += (bitstream_word)(value << s->bits);
  293|  1.18k|  s->bits += n;
  294|       |  /* is buffer full? */
  295|  1.18k|  if (s->bits >= wsize) {
  ------------------
  |  |  130|  1.18k|#define wsize ((bitstream_count)(sizeof(bitstream_word) * CHAR_BIT))
  ------------------
  |  Branch (295:7): [True: 925, False: 260]
  ------------------
  296|       |    /* 1 <= n <= 64; decrement n to ensure valid right shifts below */
  297|    925|    value >>= 1;
  298|    925|    n--;
  299|       |    /* assert: 0 <= n < 64; wsize <= s->bits <= wsize + n */
  300|    925|    do {
  301|       |      /* output wsize bits while buffer is full */
  302|    925|      s->bits -= wsize;
  ------------------
  |  |  130|    925|#define wsize ((bitstream_count)(sizeof(bitstream_word) * CHAR_BIT))
  ------------------
  303|       |      /* assert: 0 <= s->bits <= n */
  304|    925|      stream_write_word(s, s->buffer);
  305|       |      /* assert: 0 <= n - s->bits < 64 */
  306|    925|      s->buffer = (bitstream_word)(value >> (n - s->bits));
  307|    925|    } while (sizeof(s->buffer) < sizeof(value) && s->bits >= wsize);
  ------------------
  |  |  130|      0|#define wsize ((bitstream_count)(sizeof(bitstream_word) * CHAR_BIT))
  ------------------
  |  Branch (307:14): [Folded, False: 925]
  |  Branch (307:51): [True: 0, False: 0]
  ------------------
  308|    925|  }
  309|       |  /* assert: 0 <= s->bits < wsize */
  310|  1.18k|  s->buffer &= ((bitstream_word)1 << s->bits) - 1;
  311|       |  /* assert: 0 <= n < 64 */
  312|  1.18k|  return value >> n;
  313|  1.18k|}
encode3d.c:stream_write_word:
  162|    979|{
  163|    979|  *s->ptr++ = value;
  164|       |#ifdef BIT_STREAM_STRIDED
  165|       |  if (!((s->ptr - s->begin) & s->mask))
  166|       |    s->ptr += s->delta;
  167|       |#endif
  168|    979|}
encode3d.c:stream_wtell:
  325|     32|{
  326|       |  return (bitstream_offset)(s->ptr - s->begin) * wsize + s->bits;
  ------------------
  |  |  130|     32|#define wsize ((bitstream_count)(sizeof(bitstream_word) * CHAR_BIT))
  ------------------
  327|     32|}
encode3d.c:stream_write_bit:
  242|  2.73k|{
  243|  2.73k|  s->buffer += (bitstream_word)bit << s->bits;
  244|  2.73k|  if (++s->bits == wsize) {
  ------------------
  |  |  130|  2.73k|#define wsize ((bitstream_count)(sizeof(bitstream_word) * CHAR_BIT))
  ------------------
  |  Branch (244:7): [True: 54, False: 2.68k]
  ------------------
  245|     54|    stream_write_word(s, s->buffer);
  246|     54|    s->buffer = 0;
  247|     54|    s->bits = 0;
  248|     54|  }
  249|  2.73k|  return bit;
  250|  2.73k|}
decode3f.c:stream_read_bit:
  227|  4.04k|{
  228|  4.04k|  uint bit;
  229|  4.04k|  if (!s->bits) {
  ------------------
  |  Branch (229:7): [True: 102, False: 3.94k]
  ------------------
  230|    102|    s->buffer = stream_read_word(s);
  231|       |    s->bits = wsize;
  ------------------
  |  |  130|    102|#define wsize ((bitstream_count)(sizeof(bitstream_word) * CHAR_BIT))
  ------------------
  232|    102|  }
  233|  4.04k|  s->bits--;
  234|  4.04k|  bit = (uint)s->buffer & 1u;
  235|  4.04k|  s->buffer >>= 1;
  236|  4.04k|  return bit;
  237|  4.04k|}
decode3f.c:stream_read_word:
  150|    834|{
  151|    834|  bitstream_word w = *s->ptr++;
  152|       |#ifdef BIT_STREAM_STRIDED
  153|       |  if (!((s->ptr - s->begin) & s->mask))
  154|       |    s->ptr += s->delta;
  155|       |#endif
  156|    834|  return w;
  157|    834|}
decode3f.c:stream_read_bits:
  255|  1.11k|{
  256|  1.11k|  uint64 value = s->buffer;
  257|  1.11k|  if (s->bits < n) {
  ------------------
  |  Branch (257:7): [True: 732, False: 380]
  ------------------
  258|       |    /* keep fetching wsize bits until enough bits are buffered */
  259|    732|    do {
  260|       |      /* assert: 0 <= s->bits < n <= 64 */
  261|    732|      s->buffer = stream_read_word(s);
  262|    732|      value += (uint64)s->buffer << s->bits;
  263|    732|      s->bits += wsize;
  ------------------
  |  |  130|    732|#define wsize ((bitstream_count)(sizeof(bitstream_word) * CHAR_BIT))
  ------------------
  264|    732|    } while (sizeof(s->buffer) < sizeof(value) && s->bits < n);
  ------------------
  |  Branch (264:14): [Folded, False: 732]
  |  Branch (264:51): [True: 0, False: 0]
  ------------------
  265|       |    /* assert: 1 <= n <= s->bits < n + wsize */
  266|    732|    s->bits -= n;
  267|    732|    if (!s->bits) {
  ------------------
  |  Branch (267:9): [True: 0, False: 732]
  ------------------
  268|       |      /* value holds exactly n bits; no need for masking */
  269|      0|      s->buffer = 0;
  270|      0|    }
  271|    732|    else {
  272|       |      /* assert: 1 <= s->bits < wsize */
  273|    732|      s->buffer >>= wsize - s->bits;
  ------------------
  |  |  130|    732|#define wsize ((bitstream_count)(sizeof(bitstream_word) * CHAR_BIT))
  ------------------
  274|       |      /* assert: 1 <= n <= 64 */
  275|    732|      value &= ((uint64)2 << (n - 1)) - 1;
  276|    732|    }
  277|    732|  }
  278|    380|  else {
  279|       |    /* assert: 0 <= n <= s->bits < wsize <= 64 */
  280|    380|    s->bits -= n;
  281|    380|    s->buffer >>= n;
  282|    380|    value &= ((uint64)1 << n) - 1;
  283|    380|  }
  284|  1.11k|  return value;
  285|  1.11k|}
decode3f.c:stream_rtell:
  318|     68|{
  319|       |  return (bitstream_offset)(s->ptr - s->begin) * wsize - s->bits;
  ------------------
  |  |  130|     68|#define wsize ((bitstream_count)(sizeof(bitstream_word) * CHAR_BIT))
  ------------------
  320|     68|}
decode3d.c:stream_read_bit:
  227|  5.54k|{
  228|  5.54k|  uint bit;
  229|  5.54k|  if (!s->bits) {
  ------------------
  |  Branch (229:7): [True: 158, False: 5.38k]
  ------------------
  230|    158|    s->buffer = stream_read_word(s);
  231|       |    s->bits = wsize;
  ------------------
  |  |  130|    158|#define wsize ((bitstream_count)(sizeof(bitstream_word) * CHAR_BIT))
  ------------------
  232|    158|  }
  233|  5.54k|  s->bits--;
  234|  5.54k|  bit = (uint)s->buffer & 1u;
  235|  5.54k|  s->buffer >>= 1;
  236|  5.54k|  return bit;
  237|  5.54k|}
decode3d.c:stream_read_word:
  150|  2.01k|{
  151|  2.01k|  bitstream_word w = *s->ptr++;
  152|       |#ifdef BIT_STREAM_STRIDED
  153|       |  if (!((s->ptr - s->begin) & s->mask))
  154|       |    s->ptr += s->delta;
  155|       |#endif
  156|  2.01k|  return w;
  157|  2.01k|}
decode3d.c:stream_read_bits:
  255|  2.37k|{
  256|  2.37k|  uint64 value = s->buffer;
  257|  2.37k|  if (s->bits < n) {
  ------------------
  |  Branch (257:7): [True: 1.86k, False: 510]
  ------------------
  258|       |    /* keep fetching wsize bits until enough bits are buffered */
  259|  1.86k|    do {
  260|       |      /* assert: 0 <= s->bits < n <= 64 */
  261|  1.86k|      s->buffer = stream_read_word(s);
  262|  1.86k|      value += (uint64)s->buffer << s->bits;
  263|  1.86k|      s->bits += wsize;
  ------------------
  |  |  130|  1.86k|#define wsize ((bitstream_count)(sizeof(bitstream_word) * CHAR_BIT))
  ------------------
  264|  1.86k|    } while (sizeof(s->buffer) < sizeof(value) && s->bits < n);
  ------------------
  |  Branch (264:14): [Folded, False: 1.86k]
  |  Branch (264:51): [True: 0, False: 0]
  ------------------
  265|       |    /* assert: 1 <= n <= s->bits < n + wsize */
  266|  1.86k|    s->bits -= n;
  267|  1.86k|    if (!s->bits) {
  ------------------
  |  Branch (267:9): [True: 88, False: 1.77k]
  ------------------
  268|       |      /* value holds exactly n bits; no need for masking */
  269|     88|      s->buffer = 0;
  270|     88|    }
  271|  1.77k|    else {
  272|       |      /* assert: 1 <= s->bits < wsize */
  273|  1.77k|      s->buffer >>= wsize - s->bits;
  ------------------
  |  |  130|  1.77k|#define wsize ((bitstream_count)(sizeof(bitstream_word) * CHAR_BIT))
  ------------------
  274|       |      /* assert: 1 <= n <= 64 */
  275|  1.77k|      value &= ((uint64)2 << (n - 1)) - 1;
  276|  1.77k|    }
  277|  1.86k|  }
  278|    510|  else {
  279|       |    /* assert: 0 <= n <= s->bits < wsize <= 64 */
  280|    510|    s->bits -= n;
  281|    510|    s->buffer >>= n;
  282|    510|    value &= ((uint64)1 << n) - 1;
  283|    510|  }
  284|  2.37k|  return value;
  285|  2.37k|}
decode3d.c:stream_rtell:
  318|     64|{
  319|       |  return (bitstream_offset)(s->ptr - s->begin) * wsize - s->bits;
  ------------------
  |  |  130|     64|#define wsize ((bitstream_count)(sizeof(bitstream_word) * CHAR_BIT))
  ------------------
  320|     64|}
encode4f.c:stream_write_bits:
  290|     58|{
  291|       |  /* append bit string to buffer */
  292|     58|  s->buffer += (bitstream_word)(value << s->bits);
  293|     58|  s->bits += n;
  294|       |  /* is buffer full? */
  295|     58|  if (s->bits >= wsize) {
  ------------------
  |  |  130|     58|#define wsize ((bitstream_count)(sizeof(bitstream_word) * CHAR_BIT))
  ------------------
  |  Branch (295:7): [True: 0, False: 58]
  ------------------
  296|       |    /* 1 <= n <= 64; decrement n to ensure valid right shifts below */
  297|      0|    value >>= 1;
  298|      0|    n--;
  299|       |    /* assert: 0 <= n < 64; wsize <= s->bits <= wsize + n */
  300|      0|    do {
  301|       |      /* output wsize bits while buffer is full */
  302|      0|      s->bits -= wsize;
  ------------------
  |  |  130|      0|#define wsize ((bitstream_count)(sizeof(bitstream_word) * CHAR_BIT))
  ------------------
  303|       |      /* assert: 0 <= s->bits <= n */
  304|      0|      stream_write_word(s, s->buffer);
  305|       |      /* assert: 0 <= n - s->bits < 64 */
  306|      0|      s->buffer = (bitstream_word)(value >> (n - s->bits));
  307|      0|    } while (sizeof(s->buffer) < sizeof(value) && s->bits >= wsize);
  ------------------
  |  |  130|      0|#define wsize ((bitstream_count)(sizeof(bitstream_word) * CHAR_BIT))
  ------------------
  |  Branch (307:14): [Folded, False: 0]
  |  Branch (307:51): [True: 0, False: 0]
  ------------------
  308|      0|  }
  309|       |  /* assert: 0 <= s->bits < wsize */
  310|     58|  s->buffer &= ((bitstream_word)1 << s->bits) - 1;
  311|       |  /* assert: 0 <= n < 64 */
  312|     58|  return value >> n;
  313|     58|}
encode4f.c:stream_write_word:
  162|  1.53k|{
  163|  1.53k|  *s->ptr++ = value;
  164|       |#ifdef BIT_STREAM_STRIDED
  165|       |  if (!((s->ptr - s->begin) & s->mask))
  166|       |    s->ptr += s->delta;
  167|       |#endif
  168|  1.53k|}
encode4f.c:stream_wtell:
  325|     72|{
  326|       |  return (bitstream_offset)(s->ptr - s->begin) * wsize + s->bits;
  ------------------
  |  |  130|     72|#define wsize ((bitstream_count)(sizeof(bitstream_word) * CHAR_BIT))
  ------------------
  327|     72|}
encode4f.c:stream_write_bit:
  242|  99.1k|{
  243|  99.1k|  s->buffer += (bitstream_word)bit << s->bits;
  244|  99.1k|  if (++s->bits == wsize) {
  ------------------
  |  |  130|  99.1k|#define wsize ((bitstream_count)(sizeof(bitstream_word) * CHAR_BIT))
  ------------------
  |  Branch (244:7): [True: 1.53k, False: 97.6k]
  ------------------
  245|  1.53k|    stream_write_word(s, s->buffer);
  246|  1.53k|    s->buffer = 0;
  247|  1.53k|    s->bits = 0;
  248|  1.53k|  }
  249|  99.1k|  return bit;
  250|  99.1k|}
encode4f.c:stream_pad:
  382|      2|{
  383|      2|  bitstream_offset bits = s->bits;
  384|      6|  for (bits += n; bits >= wsize; bits -= wsize) {
  ------------------
  |  |  130|      6|#define wsize ((bitstream_count)(sizeof(bitstream_word) * CHAR_BIT))
  ------------------
                for (bits += n; bits >= wsize; bits -= wsize) {
  ------------------
  |  |  130|      4|#define wsize ((bitstream_count)(sizeof(bitstream_word) * CHAR_BIT))
  ------------------
  |  Branch (384:19): [True: 4, False: 2]
  ------------------
  385|      4|    stream_write_word(s, s->buffer);
  386|      4|    s->buffer = 0;
  387|      4|  }
  388|      2|  s->bits = (bitstream_count)bits;
  389|      2|}
encode4d.c:stream_write_bit:
  242|      7|{
  243|      7|  s->buffer += (bitstream_word)bit << s->bits;
  244|      7|  if (++s->bits == wsize) {
  ------------------
  |  |  130|      7|#define wsize ((bitstream_count)(sizeof(bitstream_word) * CHAR_BIT))
  ------------------
  |  Branch (244:7): [True: 0, False: 7]
  ------------------
  245|      0|    stream_write_word(s, s->buffer);
  246|      0|    s->buffer = 0;
  247|      0|    s->bits = 0;
  248|      0|  }
  249|      7|  return bit;
  250|      7|}
decode4f.c:stream_read_bit:
  227|   198k|{
  228|   198k|  uint bit;
  229|   198k|  if (!s->bits) {
  ------------------
  |  Branch (229:7): [True: 3.18k, False: 195k]
  ------------------
  230|  3.18k|    s->buffer = stream_read_word(s);
  231|       |    s->bits = wsize;
  ------------------
  |  |  130|  3.18k|#define wsize ((bitstream_count)(sizeof(bitstream_word) * CHAR_BIT))
  ------------------
  232|  3.18k|  }
  233|   198k|  s->bits--;
  234|   198k|  bit = (uint)s->buffer & 1u;
  235|   198k|  s->buffer >>= 1;
  236|   198k|  return bit;
  237|   198k|}
decode4f.c:stream_read_word:
  150|  3.18k|{
  151|  3.18k|  bitstream_word w = *s->ptr++;
  152|       |#ifdef BIT_STREAM_STRIDED
  153|       |  if (!((s->ptr - s->begin) & s->mask))
  154|       |    s->ptr += s->delta;
  155|       |#endif
  156|  3.18k|  return w;
  157|  3.18k|}
decode4f.c:stream_read_bits:
  255|    116|{
  256|    116|  uint64 value = s->buffer;
  257|    116|  if (s->bits < n) {
  ------------------
  |  Branch (257:7): [True: 0, False: 116]
  ------------------
  258|       |    /* keep fetching wsize bits until enough bits are buffered */
  259|      0|    do {
  260|       |      /* assert: 0 <= s->bits < n <= 64 */
  261|      0|      s->buffer = stream_read_word(s);
  262|      0|      value += (uint64)s->buffer << s->bits;
  263|      0|      s->bits += wsize;
  ------------------
  |  |  130|      0|#define wsize ((bitstream_count)(sizeof(bitstream_word) * CHAR_BIT))
  ------------------
  264|      0|    } while (sizeof(s->buffer) < sizeof(value) && s->bits < n);
  ------------------
  |  Branch (264:14): [Folded, False: 0]
  |  Branch (264:51): [True: 0, False: 0]
  ------------------
  265|       |    /* assert: 1 <= n <= s->bits < n + wsize */
  266|      0|    s->bits -= n;
  267|      0|    if (!s->bits) {
  ------------------
  |  Branch (267:9): [True: 0, False: 0]
  ------------------
  268|       |      /* value holds exactly n bits; no need for masking */
  269|      0|      s->buffer = 0;
  270|      0|    }
  271|      0|    else {
  272|       |      /* assert: 1 <= s->bits < wsize */
  273|      0|      s->buffer >>= wsize - s->bits;
  ------------------
  |  |  130|      0|#define wsize ((bitstream_count)(sizeof(bitstream_word) * CHAR_BIT))
  ------------------
  274|       |      /* assert: 1 <= n <= 64 */
  275|      0|      value &= ((uint64)2 << (n - 1)) - 1;
  276|      0|    }
  277|      0|  }
  278|    116|  else {
  279|       |    /* assert: 0 <= n <= s->bits < wsize <= 64 */
  280|    116|    s->bits -= n;
  281|    116|    s->buffer >>= n;
  282|    116|    value &= ((uint64)1 << n) - 1;
  283|    116|  }
  284|    116|  return value;
  285|    116|}
decode4f.c:stream_rtell:
  318|    148|{
  319|       |  return (bitstream_offset)(s->ptr - s->begin) * wsize - s->bits;
  ------------------
  |  |  130|    148|#define wsize ((bitstream_count)(sizeof(bitstream_word) * CHAR_BIT))
  ------------------
  320|    148|}
decode4f.c:stream_skip:
  375|      4|{
  376|      4|  stream_rseek(s, stream_rtell(s) + n);
  377|      4|}
decode4f.c:stream_rseek:
  341|      4|{
  342|      4|  bitstream_count n = (bitstream_count)(offset % wsize);
  ------------------
  |  |  130|      4|#define wsize ((bitstream_count)(sizeof(bitstream_word) * CHAR_BIT))
  ------------------
  343|      4|  s->ptr = s->begin + (size_t)(offset / wsize);
  ------------------
  |  |  130|      4|#define wsize ((bitstream_count)(sizeof(bitstream_word) * CHAR_BIT))
  ------------------
  344|      4|  if (n) {
  ------------------
  |  Branch (344:7): [True: 4, False: 0]
  ------------------
  345|      4|    s->buffer = stream_read_word(s) >> n;
  346|      4|    s->bits = wsize - n;
  ------------------
  |  |  130|      4|#define wsize ((bitstream_count)(sizeof(bitstream_word) * CHAR_BIT))
  ------------------
  347|      4|  }
  348|      0|  else {
  349|      0|    s->buffer = 0;
  350|      0|    s->bits = 0;
  351|      0|  }
  352|      4|}
decode4d.c:stream_read_bit:
  227|     14|{
  228|     14|  uint bit;
  229|     14|  if (!s->bits) {
  ------------------
  |  Branch (229:7): [True: 14, False: 0]
  ------------------
  230|     14|    s->buffer = stream_read_word(s);
  231|       |    s->bits = wsize;
  ------------------
  |  |  130|     14|#define wsize ((bitstream_count)(sizeof(bitstream_word) * CHAR_BIT))
  ------------------
  232|     14|  }
  233|     14|  s->bits--;
  234|     14|  bit = (uint)s->buffer & 1u;
  235|     14|  s->buffer >>= 1;
  236|     14|  return bit;
  237|     14|}
decode4d.c:stream_read_word:
  150|     14|{
  151|     14|  bitstream_word w = *s->ptr++;
  152|       |#ifdef BIT_STREAM_STRIDED
  153|       |  if (!((s->ptr - s->begin) & s->mask))
  154|       |    s->ptr += s->delta;
  155|       |#endif
  156|     14|  return w;
  157|     14|}

encode2d.c:with_maxbits:
    4|      2|{
    5|      2|  return (maxprec + 1) * size - 1 > maxbits;
    6|      2|}
decode2d.c:with_maxbits:
    4|      4|{
    5|      4|  return (maxprec + 1) * size - 1 > maxbits;
    6|      4|}
encode3f.c:with_maxbits:
    4|     27|{
    5|     27|  return (maxprec + 1) * size - 1 > maxbits;
    6|     27|}
encode3d.c:with_maxbits:
    4|     32|{
    5|     32|  return (maxprec + 1) * size - 1 > maxbits;
    6|     32|}
decode3f.c:with_maxbits:
    4|     52|{
    5|     52|  return (maxprec + 1) * size - 1 > maxbits;
    6|     52|}
decode3d.c:with_maxbits:
    4|     64|{
    5|     64|  return (maxprec + 1) * size - 1 > maxbits;
    6|     64|}
encode4f.c:with_maxbits:
    4|     58|{
    5|     58|  return (maxprec + 1) * size - 1 > maxbits;
    6|     58|}
decode4f.c:with_maxbits:
    4|    116|{
    5|    116|  return (maxprec + 1) * size - 1 > maxbits;
    6|    116|}

encode2d.c:precision:
    7|      2|{
    8|       |#if (ZFP_ROUNDING_MODE != ZFP_ROUND_NEVER) && defined(ZFP_WITH_TIGHT_ERROR)
    9|       |  return MIN(maxprec, (uint)MAX(0, maxexp - minexp + 2 * dims + 1));
   10|       |#else
   11|      2|  return MIN(maxprec, (uint)MAX(0, maxexp - minexp + 2 * dims + 2));
  ------------------
  |  |    4|      4|#define MIN(x, y) ((x) < (y) ? (x) : (y))
  |  |  ------------------
  |  |  |  Branch (4:20): [True: 2, False: 0]
  |  |  |  Branch (4:27): [True: 0, False: 2]
  |  |  |  Branch (4:39): [True: 0, False: 0]
  |  |  ------------------
  ------------------
   12|      2|#endif
   13|      2|}
decode2d.c:precision:
    7|      4|{
    8|       |#if (ZFP_ROUNDING_MODE != ZFP_ROUND_NEVER) && defined(ZFP_WITH_TIGHT_ERROR)
    9|       |  return MIN(maxprec, (uint)MAX(0, maxexp - minexp + 2 * dims + 1));
   10|       |#else
   11|      4|  return MIN(maxprec, (uint)MAX(0, maxexp - minexp + 2 * dims + 2));
  ------------------
  |  |    4|      8|#define MIN(x, y) ((x) < (y) ? (x) : (y))
  |  |  ------------------
  |  |  |  Branch (4:20): [True: 4, False: 0]
  |  |  |  Branch (4:27): [True: 0, False: 4]
  |  |  |  Branch (4:39): [True: 0, False: 0]
  |  |  ------------------
  ------------------
   12|      4|#endif
   13|      4|}
decode2d.c:inv_cast_double:
   25|      4|{
   26|       |  /* compute power-of-two scale factor s */
   27|      4|  Scalar s = _t1(dequantize, Scalar)(1, emax);
  ------------------
  |  |    3|      4|#define Scalar double                      /* floating-point type */
  ------------------
                Scalar s = _t1(dequantize, Scalar)(1, emax);
  ------------------
  |  |    9|      4|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|      4|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
   28|       |  /* compute p-bit float x = s*y where |y| <= 2^(p-2) - 1 */
   29|      4|  do
   30|     64|    *fblock++ = (Scalar)(s * *iblock++);
   31|     64|  while (--n);
  ------------------
  |  Branch (31:10): [True: 60, False: 4]
  ------------------
   32|      4|}
decode2d.c:dequantize_double:
   18|      4|{
   19|      4|  return LDEXP((Scalar)x, e - ((int)(CHAR_BIT * sizeof(Scalar)) - 2));
  ------------------
  |  |   14|      4|#define LDEXP(x, e) ldexp(x, e)
  ------------------
   20|      4|}
encode3f.c:precision:
    7|     29|{
    8|       |#if (ZFP_ROUNDING_MODE != ZFP_ROUND_NEVER) && defined(ZFP_WITH_TIGHT_ERROR)
    9|       |  return MIN(maxprec, (uint)MAX(0, maxexp - minexp + 2 * dims + 1));
   10|       |#else
   11|     29|  return MIN(maxprec, (uint)MAX(0, maxexp - minexp + 2 * dims + 2));
  ------------------
  |  |    4|     58|#define MIN(x, y) ((x) < (y) ? (x) : (y))
  |  |  ------------------
  |  |  |  Branch (4:20): [True: 22, False: 7]
  |  |  |  Branch (4:27): [True: 2, False: 27]
  |  |  |  Branch (4:39): [True: 2, False: 5]
  |  |  ------------------
  ------------------
   12|     29|#endif
   13|     29|}
encode3d.c:precision:
    7|     32|{
    8|       |#if (ZFP_ROUNDING_MODE != ZFP_ROUND_NEVER) && defined(ZFP_WITH_TIGHT_ERROR)
    9|       |  return MIN(maxprec, (uint)MAX(0, maxexp - minexp + 2 * dims + 1));
   10|       |#else
   11|     32|  return MIN(maxprec, (uint)MAX(0, maxexp - minexp + 2 * dims + 2));
  ------------------
  |  |    4|     64|#define MIN(x, y) ((x) < (y) ? (x) : (y))
  |  |  ------------------
  |  |  |  Branch (4:20): [True: 32, False: 0]
  |  |  |  Branch (4:27): [True: 0, False: 32]
  |  |  |  Branch (4:39): [True: 0, False: 0]
  |  |  ------------------
  ------------------
   12|     32|#endif
   13|     32|}
decode3f.c:precision:
    7|     52|{
    8|       |#if (ZFP_ROUNDING_MODE != ZFP_ROUND_NEVER) && defined(ZFP_WITH_TIGHT_ERROR)
    9|       |  return MIN(maxprec, (uint)MAX(0, maxexp - minexp + 2 * dims + 1));
   10|       |#else
   11|     52|  return MIN(maxprec, (uint)MAX(0, maxexp - minexp + 2 * dims + 2));
  ------------------
  |  |    4|    104|#define MIN(x, y) ((x) < (y) ? (x) : (y))
  |  |  ------------------
  |  |  |  Branch (4:20): [True: 42, False: 10]
  |  |  |  Branch (4:27): [True: 0, False: 52]
  |  |  |  Branch (4:39): [True: 0, False: 10]
  |  |  ------------------
  ------------------
   12|     52|#endif
   13|     52|}
decode3f.c:inv_cast_float:
   25|     52|{
   26|       |  /* compute power-of-two scale factor s */
   27|     52|  Scalar s = _t1(dequantize, Scalar)(1, emax);
  ------------------
  |  |    3|     52|#define Scalar float       /* floating-point type */
  ------------------
                Scalar s = _t1(dequantize, Scalar)(1, emax);
  ------------------
  |  |    9|     52|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|     52|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
   28|       |  /* compute p-bit float x = s*y where |y| <= 2^(p-2) - 1 */
   29|     52|  do
   30|  3.32k|    *fblock++ = (Scalar)(s * *iblock++);
   31|  3.32k|  while (--n);
  ------------------
  |  Branch (31:10): [True: 3.27k, False: 52]
  ------------------
   32|     52|}
decode3f.c:dequantize_float:
   18|     52|{
   19|     52|  return LDEXP((Scalar)x, e - ((int)(CHAR_BIT * sizeof(Scalar)) - 2));
  ------------------
  |  |   15|     52|  #define LDEXP(x, e) ldexpf(x, e)
  ------------------
   20|     52|}
decode3d.c:precision:
    7|     64|{
    8|       |#if (ZFP_ROUNDING_MODE != ZFP_ROUND_NEVER) && defined(ZFP_WITH_TIGHT_ERROR)
    9|       |  return MIN(maxprec, (uint)MAX(0, maxexp - minexp + 2 * dims + 1));
   10|       |#else
   11|     64|  return MIN(maxprec, (uint)MAX(0, maxexp - minexp + 2 * dims + 2));
  ------------------
  |  |    4|    128|#define MIN(x, y) ((x) < (y) ? (x) : (y))
  |  |  ------------------
  |  |  |  Branch (4:20): [True: 64, False: 0]
  |  |  |  Branch (4:27): [True: 0, False: 64]
  |  |  |  Branch (4:39): [True: 0, False: 0]
  |  |  ------------------
  ------------------
   12|     64|#endif
   13|     64|}
decode3d.c:inv_cast_double:
   25|     64|{
   26|       |  /* compute power-of-two scale factor s */
   27|     64|  Scalar s = _t1(dequantize, Scalar)(1, emax);
  ------------------
  |  |    3|     64|#define Scalar double                      /* floating-point type */
  ------------------
                Scalar s = _t1(dequantize, Scalar)(1, emax);
  ------------------
  |  |    9|     64|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|     64|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
   28|       |  /* compute p-bit float x = s*y where |y| <= 2^(p-2) - 1 */
   29|     64|  do
   30|  4.09k|    *fblock++ = (Scalar)(s * *iblock++);
   31|  4.09k|  while (--n);
  ------------------
  |  Branch (31:10): [True: 4.03k, False: 64]
  ------------------
   32|     64|}
decode3d.c:dequantize_double:
   18|     64|{
   19|     64|  return LDEXP((Scalar)x, e - ((int)(CHAR_BIT * sizeof(Scalar)) - 2));
  ------------------
  |  |   14|     64|#define LDEXP(x, e) ldexp(x, e)
  ------------------
   20|     64|}
encode4f.c:precision:
    7|     60|{
    8|       |#if (ZFP_ROUNDING_MODE != ZFP_ROUND_NEVER) && defined(ZFP_WITH_TIGHT_ERROR)
    9|       |  return MIN(maxprec, (uint)MAX(0, maxexp - minexp + 2 * dims + 1));
   10|       |#else
   11|     60|  return MIN(maxprec, (uint)MAX(0, maxexp - minexp + 2 * dims + 2));
  ------------------
  |  |    4|    120|#define MIN(x, y) ((x) < (y) ? (x) : (y))
  |  |  ------------------
  |  |  |  Branch (4:20): [True: 60, False: 0]
  |  |  |  Branch (4:27): [True: 0, False: 60]
  |  |  |  Branch (4:39): [True: 0, False: 0]
  |  |  ------------------
  ------------------
   12|     60|#endif
   13|     60|}
encode4d.c:precision:
    7|      7|{
    8|       |#if (ZFP_ROUNDING_MODE != ZFP_ROUND_NEVER) && defined(ZFP_WITH_TIGHT_ERROR)
    9|       |  return MIN(maxprec, (uint)MAX(0, maxexp - minexp + 2 * dims + 1));
   10|       |#else
   11|      7|  return MIN(maxprec, (uint)MAX(0, maxexp - minexp + 2 * dims + 2));
  ------------------
  |  |    4|     14|#define MIN(x, y) ((x) < (y) ? (x) : (y))
  |  |  ------------------
  |  |  |  Branch (4:20): [True: 0, False: 7]
  |  |  |  Branch (4:27): [True: 0, False: 7]
  |  |  |  Branch (4:39): [True: 0, False: 7]
  |  |  ------------------
  ------------------
   12|      7|#endif
   13|      7|}
decode4f.c:precision:
    7|    116|{
    8|       |#if (ZFP_ROUNDING_MODE != ZFP_ROUND_NEVER) && defined(ZFP_WITH_TIGHT_ERROR)
    9|       |  return MIN(maxprec, (uint)MAX(0, maxexp - minexp + 2 * dims + 1));
   10|       |#else
   11|    116|  return MIN(maxprec, (uint)MAX(0, maxexp - minexp + 2 * dims + 2));
  ------------------
  |  |    4|    232|#define MIN(x, y) ((x) < (y) ? (x) : (y))
  |  |  ------------------
  |  |  |  Branch (4:20): [True: 116, False: 0]
  |  |  |  Branch (4:27): [True: 0, False: 116]
  |  |  |  Branch (4:39): [True: 0, False: 0]
  |  |  ------------------
  ------------------
   12|    116|#endif
   13|    116|}
decode4f.c:inv_cast_float:
   25|    116|{
   26|       |  /* compute power-of-two scale factor s */
   27|    116|  Scalar s = _t1(dequantize, Scalar)(1, emax);
  ------------------
  |  |    3|    116|#define Scalar float       /* floating-point type */
  ------------------
                Scalar s = _t1(dequantize, Scalar)(1, emax);
  ------------------
  |  |    9|    116|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|    116|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
   28|       |  /* compute p-bit float x = s*y where |y| <= 2^(p-2) - 1 */
   29|    116|  do
   30|  29.6k|    *fblock++ = (Scalar)(s * *iblock++);
   31|  29.6k|  while (--n);
  ------------------
  |  Branch (31:10): [True: 29.5k, False: 116]
  ------------------
   32|    116|}
decode4f.c:dequantize_float:
   18|    116|{
   19|    116|  return LDEXP((Scalar)x, e - ((int)(CHAR_BIT * sizeof(Scalar)) - 2));
  ------------------
  |  |   15|    116|  #define LDEXP(x, e) ldexpf(x, e)
  ------------------
   20|    116|}

zfp.c:compress_strided_double_2:
   39|      2|{
   40|      2|  const Scalar* data = (const Scalar*)field->data;
   41|      2|  size_t nx = field->nx;
   42|      2|  size_t ny = field->ny;
   43|      2|  ptrdiff_t sx = field->sx ? field->sx : 1;
  ------------------
  |  Branch (43:18): [True: 0, False: 2]
  ------------------
   44|      2|  ptrdiff_t sy = field->sy ? field->sy : (ptrdiff_t)nx;
  ------------------
  |  Branch (44:18): [True: 0, False: 2]
  ------------------
   45|      2|  size_t x, y;
   46|       |
   47|       |  /* compress array one block of 4x4 values at a time */
   48|      4|  for (y = 0; y < ny; y += 4)
  ------------------
  |  Branch (48:15): [True: 2, False: 2]
  ------------------
   49|      4|    for (x = 0; x < nx; x += 4) {
  ------------------
  |  Branch (49:17): [True: 2, False: 2]
  ------------------
   50|      2|      const Scalar* p = data + sx * (ptrdiff_t)x + sy * (ptrdiff_t)y;
   51|      2|      if (nx - x < 4 || ny - y < 4)
  ------------------
  |  Branch (51:11): [True: 0, False: 2]
  |  Branch (51:25): [True: 0, False: 2]
  ------------------
   52|      0|        _t2(zfp_encode_partial_block_strided, Scalar, 2)(stream, p, MIN(nx - x, 4u), MIN(ny - y, 4u), sx, sy);
  ------------------
  |  |   10|      0|#define _t2(function, type, dims) _cat3(function, type, dims)
  |  |  ------------------
  |  |  |  |    6|      0|#define _cat3(x, y, z) x ## _ ## y ## _ ## z
  |  |  ------------------
  ------------------
                      _t2(zfp_encode_partial_block_strided, Scalar, 2)(stream, p, MIN(nx - x, 4u), MIN(ny - y, 4u), sx, sy);
  ------------------
  |  |    4|      0|#define MIN(x, y) ((x) < (y) ? (x) : (y))
  |  |  ------------------
  |  |  |  Branch (4:20): [True: 0, False: 0]
  |  |  ------------------
  ------------------
                      _t2(zfp_encode_partial_block_strided, Scalar, 2)(stream, p, MIN(nx - x, 4u), MIN(ny - y, 4u), sx, sy);
  ------------------
  |  |    4|      0|#define MIN(x, y) ((x) < (y) ? (x) : (y))
  |  |  ------------------
  |  |  |  Branch (4:20): [True: 0, False: 0]
  |  |  ------------------
  ------------------
   53|      2|      else
   54|      2|        _t2(zfp_encode_block_strided, Scalar, 2)(stream, p, sx, sy);
  ------------------
  |  |   10|      2|#define _t2(function, type, dims) _cat3(function, type, dims)
  |  |  ------------------
  |  |  |  |    6|      2|#define _cat3(x, y, z) x ## _ ## y ## _ ## z
  |  |  ------------------
  ------------------
   55|      2|    }
   56|      2|}
zfp.c:compress_strided_float_3:
   61|     29|{
   62|     29|  const Scalar* data = (const Scalar*)field->data;
   63|     29|  size_t nx = field->nx;
   64|     29|  size_t ny = field->ny;
   65|     29|  size_t nz = field->nz;
   66|     29|  ptrdiff_t sx = field->sx ? field->sx : 1;
  ------------------
  |  Branch (66:18): [True: 0, False: 29]
  ------------------
   67|     29|  ptrdiff_t sy = field->sy ? field->sy : (ptrdiff_t)nx;
  ------------------
  |  Branch (67:18): [True: 0, False: 29]
  ------------------
   68|     29|  ptrdiff_t sz = field->sz ? field->sz : (ptrdiff_t)(nx * ny);
  ------------------
  |  Branch (68:18): [True: 0, False: 29]
  ------------------
   69|     29|  size_t x, y, z;
   70|       |
   71|       |  /* compress array one block of 4x4x4 values at a time */
   72|     58|  for (z = 0; z < nz; z += 4)
  ------------------
  |  Branch (72:15): [True: 29, False: 29]
  ------------------
   73|     58|    for (y = 0; y < ny; y += 4)
  ------------------
  |  Branch (73:17): [True: 29, False: 29]
  ------------------
   74|     58|      for (x = 0; x < nx; x += 4) {
  ------------------
  |  Branch (74:19): [True: 29, False: 29]
  ------------------
   75|     29|        const Scalar* p = data + sx * (ptrdiff_t)x + sy * (ptrdiff_t)y + sz * (ptrdiff_t)z;
   76|     29|        if (nx - x < 4 || ny - y < 4 || nz - z < 4)
  ------------------
  |  Branch (76:13): [True: 0, False: 29]
  |  Branch (76:27): [True: 0, False: 29]
  |  Branch (76:41): [True: 0, False: 29]
  ------------------
   77|      0|          _t2(zfp_encode_partial_block_strided, Scalar, 3)(stream, p, MIN(nx - x, 4u), MIN(ny - y, 4u), MIN(nz - z, 4u), sx, sy, sz);
  ------------------
  |  |   10|      0|#define _t2(function, type, dims) _cat3(function, type, dims)
  |  |  ------------------
  |  |  |  |    6|      0|#define _cat3(x, y, z) x ## _ ## y ## _ ## z
  |  |  ------------------
  ------------------
                        _t2(zfp_encode_partial_block_strided, Scalar, 3)(stream, p, MIN(nx - x, 4u), MIN(ny - y, 4u), MIN(nz - z, 4u), sx, sy, sz);
  ------------------
  |  |    4|      0|#define MIN(x, y) ((x) < (y) ? (x) : (y))
  |  |  ------------------
  |  |  |  Branch (4:20): [True: 0, False: 0]
  |  |  ------------------
  ------------------
                        _t2(zfp_encode_partial_block_strided, Scalar, 3)(stream, p, MIN(nx - x, 4u), MIN(ny - y, 4u), MIN(nz - z, 4u), sx, sy, sz);
  ------------------
  |  |    4|      0|#define MIN(x, y) ((x) < (y) ? (x) : (y))
  |  |  ------------------
  |  |  |  Branch (4:20): [True: 0, False: 0]
  |  |  ------------------
  ------------------
                        _t2(zfp_encode_partial_block_strided, Scalar, 3)(stream, p, MIN(nx - x, 4u), MIN(ny - y, 4u), MIN(nz - z, 4u), sx, sy, sz);
  ------------------
  |  |    4|      0|#define MIN(x, y) ((x) < (y) ? (x) : (y))
  |  |  ------------------
  |  |  |  Branch (4:20): [True: 0, False: 0]
  |  |  ------------------
  ------------------
   78|     29|        else
   79|     29|          _t2(zfp_encode_block_strided, Scalar, 3)(stream, p, sx, sy, sz);
  ------------------
  |  |   10|     29|#define _t2(function, type, dims) _cat3(function, type, dims)
  |  |  ------------------
  |  |  |  |    6|     29|#define _cat3(x, y, z) x ## _ ## y ## _ ## z
  |  |  ------------------
  ------------------
   80|     29|      }
   81|     29|}
zfp.c:compress_strided_double_3:
   61|     32|{
   62|     32|  const Scalar* data = (const Scalar*)field->data;
   63|     32|  size_t nx = field->nx;
   64|     32|  size_t ny = field->ny;
   65|     32|  size_t nz = field->nz;
   66|     32|  ptrdiff_t sx = field->sx ? field->sx : 1;
  ------------------
  |  Branch (66:18): [True: 0, False: 32]
  ------------------
   67|     32|  ptrdiff_t sy = field->sy ? field->sy : (ptrdiff_t)nx;
  ------------------
  |  Branch (67:18): [True: 0, False: 32]
  ------------------
   68|     32|  ptrdiff_t sz = field->sz ? field->sz : (ptrdiff_t)(nx * ny);
  ------------------
  |  Branch (68:18): [True: 0, False: 32]
  ------------------
   69|     32|  size_t x, y, z;
   70|       |
   71|       |  /* compress array one block of 4x4x4 values at a time */
   72|     64|  for (z = 0; z < nz; z += 4)
  ------------------
  |  Branch (72:15): [True: 32, False: 32]
  ------------------
   73|     64|    for (y = 0; y < ny; y += 4)
  ------------------
  |  Branch (73:17): [True: 32, False: 32]
  ------------------
   74|     64|      for (x = 0; x < nx; x += 4) {
  ------------------
  |  Branch (74:19): [True: 32, False: 32]
  ------------------
   75|     32|        const Scalar* p = data + sx * (ptrdiff_t)x + sy * (ptrdiff_t)y + sz * (ptrdiff_t)z;
   76|     32|        if (nx - x < 4 || ny - y < 4 || nz - z < 4)
  ------------------
  |  Branch (76:13): [True: 0, False: 32]
  |  Branch (76:27): [True: 0, False: 32]
  |  Branch (76:41): [True: 0, False: 32]
  ------------------
   77|      0|          _t2(zfp_encode_partial_block_strided, Scalar, 3)(stream, p, MIN(nx - x, 4u), MIN(ny - y, 4u), MIN(nz - z, 4u), sx, sy, sz);
  ------------------
  |  |   10|      0|#define _t2(function, type, dims) _cat3(function, type, dims)
  |  |  ------------------
  |  |  |  |    6|      0|#define _cat3(x, y, z) x ## _ ## y ## _ ## z
  |  |  ------------------
  ------------------
                        _t2(zfp_encode_partial_block_strided, Scalar, 3)(stream, p, MIN(nx - x, 4u), MIN(ny - y, 4u), MIN(nz - z, 4u), sx, sy, sz);
  ------------------
  |  |    4|      0|#define MIN(x, y) ((x) < (y) ? (x) : (y))
  |  |  ------------------
  |  |  |  Branch (4:20): [True: 0, False: 0]
  |  |  ------------------
  ------------------
                        _t2(zfp_encode_partial_block_strided, Scalar, 3)(stream, p, MIN(nx - x, 4u), MIN(ny - y, 4u), MIN(nz - z, 4u), sx, sy, sz);
  ------------------
  |  |    4|      0|#define MIN(x, y) ((x) < (y) ? (x) : (y))
  |  |  ------------------
  |  |  |  Branch (4:20): [True: 0, False: 0]
  |  |  ------------------
  ------------------
                        _t2(zfp_encode_partial_block_strided, Scalar, 3)(stream, p, MIN(nx - x, 4u), MIN(ny - y, 4u), MIN(nz - z, 4u), sx, sy, sz);
  ------------------
  |  |    4|      0|#define MIN(x, y) ((x) < (y) ? (x) : (y))
  |  |  ------------------
  |  |  |  Branch (4:20): [True: 0, False: 0]
  |  |  ------------------
  ------------------
   78|     32|        else
   79|     32|          _t2(zfp_encode_block_strided, Scalar, 3)(stream, p, sx, sy, sz);
  ------------------
  |  |   10|     32|#define _t2(function, type, dims) _cat3(function, type, dims)
  |  |  ------------------
  |  |  |  |    6|     32|#define _cat3(x, y, z) x ## _ ## y ## _ ## z
  |  |  ------------------
  ------------------
   80|     32|      }
   81|     32|}
zfp.c:compress_strided_float_4:
   86|     60|{
   87|     60|  const Scalar* data = field->data;
   88|     60|  size_t nx = field->nx;
   89|     60|  size_t ny = field->ny;
   90|     60|  size_t nz = field->nz;
   91|     60|  size_t nw = field->nw;
   92|     60|  ptrdiff_t sx = field->sx ? field->sx : 1;
  ------------------
  |  Branch (92:18): [True: 0, False: 60]
  ------------------
   93|     60|  ptrdiff_t sy = field->sy ? field->sy : (ptrdiff_t)nx;
  ------------------
  |  Branch (93:18): [True: 0, False: 60]
  ------------------
   94|     60|  ptrdiff_t sz = field->sz ? field->sz : (ptrdiff_t)(nx * ny);
  ------------------
  |  Branch (94:18): [True: 0, False: 60]
  ------------------
   95|     60|  ptrdiff_t sw = field->sw ? field->sw : (ptrdiff_t)(nx * ny * nz);
  ------------------
  |  Branch (95:18): [True: 0, False: 60]
  ------------------
   96|     60|  size_t x, y, z, w;
   97|       |
   98|       |  /* compress array one block of 4x4x4x4 values at a time */
   99|    120|  for (w = 0; w < nw; w += 4)
  ------------------
  |  Branch (99:15): [True: 60, False: 60]
  ------------------
  100|    120|    for (z = 0; z < nz; z += 4)
  ------------------
  |  Branch (100:17): [True: 60, False: 60]
  ------------------
  101|    120|      for (y = 0; y < ny; y += 4)
  ------------------
  |  Branch (101:19): [True: 60, False: 60]
  ------------------
  102|    120|        for (x = 0; x < nx; x += 4) {
  ------------------
  |  Branch (102:21): [True: 60, False: 60]
  ------------------
  103|     60|          const Scalar* p = data + sx * (ptrdiff_t)x + sy * (ptrdiff_t)y + sz * (ptrdiff_t)z + sw * (ptrdiff_t)w;
  104|     60|          if (nx - x < 4 || ny - y < 4 || nz - z < 4 || nw - w < 4)
  ------------------
  |  Branch (104:15): [True: 0, False: 60]
  |  Branch (104:29): [True: 0, False: 60]
  |  Branch (104:43): [True: 0, False: 60]
  |  Branch (104:57): [True: 0, False: 60]
  ------------------
  105|      0|            _t2(zfp_encode_partial_block_strided, Scalar, 4)(stream, p, MIN(nx - x, 4u), MIN(ny - y, 4u), MIN(nz - z, 4u), MIN(nw - w, 4u), sx, sy, sz, sw);
  ------------------
  |  |   10|      0|#define _t2(function, type, dims) _cat3(function, type, dims)
  |  |  ------------------
  |  |  |  |    6|      0|#define _cat3(x, y, z) x ## _ ## y ## _ ## z
  |  |  ------------------
  ------------------
                          _t2(zfp_encode_partial_block_strided, Scalar, 4)(stream, p, MIN(nx - x, 4u), MIN(ny - y, 4u), MIN(nz - z, 4u), MIN(nw - w, 4u), sx, sy, sz, sw);
  ------------------
  |  |    4|      0|#define MIN(x, y) ((x) < (y) ? (x) : (y))
  |  |  ------------------
  |  |  |  Branch (4:20): [True: 0, False: 0]
  |  |  ------------------
  ------------------
                          _t2(zfp_encode_partial_block_strided, Scalar, 4)(stream, p, MIN(nx - x, 4u), MIN(ny - y, 4u), MIN(nz - z, 4u), MIN(nw - w, 4u), sx, sy, sz, sw);
  ------------------
  |  |    4|      0|#define MIN(x, y) ((x) < (y) ? (x) : (y))
  |  |  ------------------
  |  |  |  Branch (4:20): [True: 0, False: 0]
  |  |  ------------------
  ------------------
                          _t2(zfp_encode_partial_block_strided, Scalar, 4)(stream, p, MIN(nx - x, 4u), MIN(ny - y, 4u), MIN(nz - z, 4u), MIN(nw - w, 4u), sx, sy, sz, sw);
  ------------------
  |  |    4|      0|#define MIN(x, y) ((x) < (y) ? (x) : (y))
  |  |  ------------------
  |  |  |  Branch (4:20): [True: 0, False: 0]
  |  |  ------------------
  ------------------
                          _t2(zfp_encode_partial_block_strided, Scalar, 4)(stream, p, MIN(nx - x, 4u), MIN(ny - y, 4u), MIN(nz - z, 4u), MIN(nw - w, 4u), sx, sy, sz, sw);
  ------------------
  |  |    4|      0|#define MIN(x, y) ((x) < (y) ? (x) : (y))
  |  |  ------------------
  |  |  |  Branch (4:20): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  106|     60|          else
  107|     60|            _t2(zfp_encode_block_strided, Scalar, 4)(stream, p, sx, sy, sz, sw);
  ------------------
  |  |   10|     60|#define _t2(function, type, dims) _cat3(function, type, dims)
  |  |  ------------------
  |  |  |  |    6|     60|#define _cat3(x, y, z) x ## _ ## y ## _ ## z
  |  |  ------------------
  ------------------
  108|     60|        }
  109|     60|}
zfp.c:compress_strided_double_4:
   86|      7|{
   87|      7|  const Scalar* data = field->data;
   88|      7|  size_t nx = field->nx;
   89|      7|  size_t ny = field->ny;
   90|      7|  size_t nz = field->nz;
   91|      7|  size_t nw = field->nw;
   92|      7|  ptrdiff_t sx = field->sx ? field->sx : 1;
  ------------------
  |  Branch (92:18): [True: 0, False: 7]
  ------------------
   93|      7|  ptrdiff_t sy = field->sy ? field->sy : (ptrdiff_t)nx;
  ------------------
  |  Branch (93:18): [True: 0, False: 7]
  ------------------
   94|      7|  ptrdiff_t sz = field->sz ? field->sz : (ptrdiff_t)(nx * ny);
  ------------------
  |  Branch (94:18): [True: 0, False: 7]
  ------------------
   95|      7|  ptrdiff_t sw = field->sw ? field->sw : (ptrdiff_t)(nx * ny * nz);
  ------------------
  |  Branch (95:18): [True: 0, False: 7]
  ------------------
   96|      7|  size_t x, y, z, w;
   97|       |
   98|       |  /* compress array one block of 4x4x4x4 values at a time */
   99|     14|  for (w = 0; w < nw; w += 4)
  ------------------
  |  Branch (99:15): [True: 7, False: 7]
  ------------------
  100|     14|    for (z = 0; z < nz; z += 4)
  ------------------
  |  Branch (100:17): [True: 7, False: 7]
  ------------------
  101|     14|      for (y = 0; y < ny; y += 4)
  ------------------
  |  Branch (101:19): [True: 7, False: 7]
  ------------------
  102|     14|        for (x = 0; x < nx; x += 4) {
  ------------------
  |  Branch (102:21): [True: 7, False: 7]
  ------------------
  103|      7|          const Scalar* p = data + sx * (ptrdiff_t)x + sy * (ptrdiff_t)y + sz * (ptrdiff_t)z + sw * (ptrdiff_t)w;
  104|      7|          if (nx - x < 4 || ny - y < 4 || nz - z < 4 || nw - w < 4)
  ------------------
  |  Branch (104:15): [True: 0, False: 7]
  |  Branch (104:29): [True: 0, False: 7]
  |  Branch (104:43): [True: 0, False: 7]
  |  Branch (104:57): [True: 0, False: 7]
  ------------------
  105|      0|            _t2(zfp_encode_partial_block_strided, Scalar, 4)(stream, p, MIN(nx - x, 4u), MIN(ny - y, 4u), MIN(nz - z, 4u), MIN(nw - w, 4u), sx, sy, sz, sw);
  ------------------
  |  |   10|      0|#define _t2(function, type, dims) _cat3(function, type, dims)
  |  |  ------------------
  |  |  |  |    6|      0|#define _cat3(x, y, z) x ## _ ## y ## _ ## z
  |  |  ------------------
  ------------------
                          _t2(zfp_encode_partial_block_strided, Scalar, 4)(stream, p, MIN(nx - x, 4u), MIN(ny - y, 4u), MIN(nz - z, 4u), MIN(nw - w, 4u), sx, sy, sz, sw);
  ------------------
  |  |    4|      0|#define MIN(x, y) ((x) < (y) ? (x) : (y))
  |  |  ------------------
  |  |  |  Branch (4:20): [True: 0, False: 0]
  |  |  ------------------
  ------------------
                          _t2(zfp_encode_partial_block_strided, Scalar, 4)(stream, p, MIN(nx - x, 4u), MIN(ny - y, 4u), MIN(nz - z, 4u), MIN(nw - w, 4u), sx, sy, sz, sw);
  ------------------
  |  |    4|      0|#define MIN(x, y) ((x) < (y) ? (x) : (y))
  |  |  ------------------
  |  |  |  Branch (4:20): [True: 0, False: 0]
  |  |  ------------------
  ------------------
                          _t2(zfp_encode_partial_block_strided, Scalar, 4)(stream, p, MIN(nx - x, 4u), MIN(ny - y, 4u), MIN(nz - z, 4u), MIN(nw - w, 4u), sx, sy, sz, sw);
  ------------------
  |  |    4|      0|#define MIN(x, y) ((x) < (y) ? (x) : (y))
  |  |  ------------------
  |  |  |  Branch (4:20): [True: 0, False: 0]
  |  |  ------------------
  ------------------
                          _t2(zfp_encode_partial_block_strided, Scalar, 4)(stream, p, MIN(nx - x, 4u), MIN(ny - y, 4u), MIN(nz - z, 4u), MIN(nw - w, 4u), sx, sy, sz, sw);
  ------------------
  |  |    4|      0|#define MIN(x, y) ((x) < (y) ? (x) : (y))
  |  |  ------------------
  |  |  |  Branch (4:20): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  106|      7|          else
  107|      7|            _t2(zfp_encode_block_strided, Scalar, 4)(stream, p, sx, sy, sz, sw);
  ------------------
  |  |   10|      7|#define _t2(function, type, dims) _cat3(function, type, dims)
  |  |  ------------------
  |  |  |  |    6|      7|#define _cat3(x, y, z) x ## _ ## y ## _ ## z
  |  |  ------------------
  ------------------
  108|      7|        }
  109|      7|}

decode2d.c:decode_block_int64_2:
  272|      4|{
  273|      4|  uint bits;
  274|      4|  cache_align_(UInt ublock[BLOCK_SIZE]);
  ------------------
  |  |   42|      4|  #define cache_align_(x) x __attribute__((aligned(ZFP_CACHE_LINE_SIZE)))
  ------------------
  275|       |  /* decode integer coefficients */
  276|      4|  bits = _t1(decode_ints, UInt)(stream, maxbits, maxprec, ublock, BLOCK_SIZE);
  ------------------
  |  |    9|      4|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|      4|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
                bits = _t1(decode_ints, UInt)(stream, maxbits, maxprec, ublock, BLOCK_SIZE);
  ------------------
  |  |    2|      4|#define BLOCK_SIZE (1 << (2 * DIMS))   /* values per block */
  |  |  ------------------
  |  |  |  |    1|      4|#define DIMS 2
  |  |  ------------------
  ------------------
  277|       |  /* read at least minbits bits */
  278|      4|  if (bits < minbits) {
  ------------------
  |  Branch (278:7): [True: 0, False: 4]
  ------------------
  279|      0|    stream_skip(stream, minbits - bits);
  280|      0|    bits = minbits;
  281|      0|  }
  282|       |  /* reorder unsigned coefficients and convert to signed integer */
  283|      4|  _t1(inv_order, Int)(ublock, iblock, PERM, BLOCK_SIZE);
  ------------------
  |  |    9|      4|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|      4|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
                _t1(inv_order, Int)(ublock, iblock, PERM, BLOCK_SIZE);
  ------------------
  |  |    1|      4|#define PERM _t1(perm, DIMS)           /* coefficient order */
  |  |  ------------------
  |  |  |  |    9|      4|#define _t1(function, arg)        _cat2(function, arg)
  |  |  |  |  ------------------
  |  |  |  |  |  |    5|      4|#define _cat2(x, y)    x ## _ ## y
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                _t1(inv_order, Int)(ublock, iblock, PERM, BLOCK_SIZE);
  ------------------
  |  |    2|      4|#define BLOCK_SIZE (1 << (2 * DIMS))   /* values per block */
  |  |  ------------------
  |  |  |  |    1|      4|#define DIMS 2
  |  |  ------------------
  ------------------
  284|       |  /* perform decorrelating transform */
  285|      4|  _t2(inv_xform, Int, DIMS)(iblock);
  ------------------
  |  |   10|      4|#define _t2(function, type, dims) _cat3(function, type, dims)
  |  |  ------------------
  |  |  |  |    6|      4|#define _cat3(x, y, z) x ## _ ## y ## _ ## z
  |  |  ------------------
  ------------------
  286|      4|  return bits;
  287|      4|}
decode2d.c:decode_ints_uint64:
  251|      4|{
  252|       |  /* use fastest available decoder implementation */
  253|      4|  if (with_maxbits(maxbits, maxprec, size)) {
  ------------------
  |  Branch (253:7): [True: 0, False: 4]
  ------------------
  254|       |    /* rate constrained path: decode partial bit planes */
  255|      0|    if (size <= 64)
  ------------------
  |  Branch (255:9): [True: 0, False: 0]
  ------------------
  256|      0|      return _t1(decode_few_ints, UInt)(stream, maxbits, maxprec, data, size); /* 1D, 2D, 3D blocks */
  ------------------
  |  |    9|      0|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|      0|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
  257|      0|    else
  258|      0|      return _t1(decode_many_ints, UInt)(stream, maxbits, maxprec, data, size); /* 4D blocks */
  ------------------
  |  |    9|      0|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|      0|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
  259|      0|  }
  260|      4|  else {
  261|       |    /* variable-rate path: decode whole bit planes */
  262|      4|    if (size <= 64)
  ------------------
  |  Branch (262:9): [True: 4, False: 0]
  ------------------
  263|      4|      return _t1(decode_few_ints_prec, UInt)(stream, maxprec, data, size); /* 1D, 2D, 3D blocks */
  ------------------
  |  |    9|      4|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|      4|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
  264|      0|    else
  265|      0|      return _t1(decode_many_ints_prec, UInt)(stream, maxprec, data, size); /* 4D blocks */
  ------------------
  |  |    9|      0|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|      0|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
  266|      4|  }
  267|      4|}
decode2d.c:decode_few_ints_prec_uint64:
  178|      4|{
  179|       |  /* make a copy of bit stream to avoid aliasing */
  180|      4|  bitstream s = *stream;
  181|      4|  bitstream_offset offset = stream_rtell(&s);
  182|      4|  uint intprec = (uint)(CHAR_BIT * sizeof(UInt));
  183|      4|  uint kmin = intprec > maxprec ? intprec - maxprec : 0;
  ------------------
  |  Branch (183:15): [True: 4, False: 0]
  ------------------
  184|      4|  uint i, k, n;
  185|       |
  186|       |  /* initialize data array to all zeros */
  187|     68|  for (i = 0; i < size; i++)
  ------------------
  |  Branch (187:15): [True: 64, False: 4]
  ------------------
  188|     64|    data[i] = 0;
  189|       |
  190|       |  /* decode one bit plane at a time from MSB to LSB */
  191|     40|  for (k = intprec, n = 0; k-- > kmin;) {
  ------------------
  |  Branch (191:28): [True: 36, False: 4]
  ------------------
  192|       |    /* step 1: decode first n bits of bit plane #k */
  193|     36|    uint64 x = stream_read_bits(&s, n);
  194|       |    /* step 2: unary run-length decode remainder of bit plane */
  195|     50|    for (; n < size && stream_read_bit(&s); x += (uint64)1 << n, n++)
  ------------------
  |  Branch (195:12): [True: 32, False: 18]
  |  Branch (195:24): [True: 14, False: 18]
  ------------------
  196|     64|      for (; n < size - 1 && !stream_read_bit(&s); n++)
  ------------------
  |  Branch (196:14): [True: 60, False: 4]
  |  Branch (196:30): [True: 50, False: 10]
  ------------------
  197|     50|        ;
  198|       |    /* step 3: deposit bit plane from x */
  199|    374|    for (i = 0; x; i++, x >>= 1)
  ------------------
  |  Branch (199:17): [True: 338, False: 36]
  ------------------
  200|    338|      data[i] += (UInt)(x & 1u) << k;
  201|     36|  }
  202|       |
  203|       |#if ZFP_ROUNDING_MODE == ZFP_ROUND_LAST
  204|       |  /* bias values to achieve proper rounding */
  205|       |  _t1(inv_round, UInt)(data, size, 0, intprec - k);
  206|       |#endif
  207|       |
  208|      4|  *stream = s;
  209|      4|  return (uint)(stream_rtell(&s) - offset);
  210|      4|}
decode2d.c:inv_order_int64:
   61|      4|{
   62|      4|  do
   63|     64|    iblock[*perm++] = _t1(uint2int, UInt)(*ublock++);
  ------------------
  |  |    9|     64|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|     64|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
   64|     64|  while (--n);
  ------------------
  |  Branch (64:10): [True: 60, False: 4]
  ------------------
   65|      4|}
decode2d.c:uint2int_uint64:
   54|     64|{
   55|     64|  return (Int)((x ^ NBMASK) - NBMASK);
  ------------------
  |  |    8|     64|#define NBMASK UINT64C(0xaaaaaaaaaaaaaaaa) /* negabinary mask */
  |  |  ------------------
  |  |  |  |   38|     64|  #define UINT64C(x) UINT64_C(x)
  |  |  ------------------
  ------------------
                return (Int)((x ^ NBMASK) - NBMASK);
  ------------------
  |  |    8|     64|#define NBMASK UINT64C(0xaaaaaaaaaaaaaaaa) /* negabinary mask */
  |  |  ------------------
  |  |  |  |   38|     64|  #define UINT64C(x) UINT64_C(x)
  |  |  ------------------
  ------------------
   56|     64|}
decode2d.c:inv_lift_int64:
   10|     32|{
   11|     32|  Int x, y, z, w;
  ------------------
  |  |    4|     32|#define Int int64                          /* corresponding signed integer type */
  ------------------
   12|     32|  x = *p; p += s;
   13|     32|  y = *p; p += s;
   14|     32|  z = *p; p += s;
   15|     32|  w = *p; p += s;
   16|       |
   17|       |  /*
   18|       |  ** non-orthogonal transform
   19|       |  **       ( 4  6 -4 -1) (x)
   20|       |  ** 1/4 * ( 4  2  4  5) (y)
   21|       |  **       ( 4 -2  4 -5) (z)
   22|       |  **       ( 4 -6 -4  1) (w)
   23|       |  */
   24|     32|  y += w >> 1; w -= y >> 1;
   25|     32|  y += w; w <<= 1; w -= y;
   26|     32|  z += x; x <<= 1; x -= z;
   27|     32|  y += z; z <<= 1; z -= y;
   28|     32|  w += x; x <<= 1; x -= w;
   29|       |
   30|     32|  p -= s; *p = w;
   31|     32|  p -= s; *p = z;
   32|     32|  p -= s; *p = y;
   33|     32|  p -= s; *p = x;
   34|     32|}
decode3f.c:decode_block_int32_3:
  272|     52|{
  273|     52|  uint bits;
  274|     52|  cache_align_(UInt ublock[BLOCK_SIZE]);
  ------------------
  |  |   42|     52|  #define cache_align_(x) x __attribute__((aligned(ZFP_CACHE_LINE_SIZE)))
  ------------------
  275|       |  /* decode integer coefficients */
  276|     52|  bits = _t1(decode_ints, UInt)(stream, maxbits, maxprec, ublock, BLOCK_SIZE);
  ------------------
  |  |    9|     52|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|     52|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
                bits = _t1(decode_ints, UInt)(stream, maxbits, maxprec, ublock, BLOCK_SIZE);
  ------------------
  |  |    2|     52|#define BLOCK_SIZE (1 << (2 * DIMS))   /* values per block */
  |  |  ------------------
  |  |  |  |    1|     52|#define DIMS 3
  |  |  ------------------
  ------------------
  277|       |  /* read at least minbits bits */
  278|     52|  if (bits < minbits) {
  ------------------
  |  Branch (278:7): [True: 0, False: 52]
  ------------------
  279|      0|    stream_skip(stream, minbits - bits);
  280|      0|    bits = minbits;
  281|      0|  }
  282|       |  /* reorder unsigned coefficients and convert to signed integer */
  283|     52|  _t1(inv_order, Int)(ublock, iblock, PERM, BLOCK_SIZE);
  ------------------
  |  |    9|     52|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|     52|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
                _t1(inv_order, Int)(ublock, iblock, PERM, BLOCK_SIZE);
  ------------------
  |  |    1|     52|#define PERM _t1(perm, DIMS)           /* coefficient order */
  |  |  ------------------
  |  |  |  |    9|     52|#define _t1(function, arg)        _cat2(function, arg)
  |  |  |  |  ------------------
  |  |  |  |  |  |    5|     52|#define _cat2(x, y)    x ## _ ## y
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                _t1(inv_order, Int)(ublock, iblock, PERM, BLOCK_SIZE);
  ------------------
  |  |    2|     52|#define BLOCK_SIZE (1 << (2 * DIMS))   /* values per block */
  |  |  ------------------
  |  |  |  |    1|     52|#define DIMS 3
  |  |  ------------------
  ------------------
  284|       |  /* perform decorrelating transform */
  285|     52|  _t2(inv_xform, Int, DIMS)(iblock);
  ------------------
  |  |   10|     52|#define _t2(function, type, dims) _cat3(function, type, dims)
  |  |  ------------------
  |  |  |  |    6|     52|#define _cat3(x, y, z) x ## _ ## y ## _ ## z
  |  |  ------------------
  ------------------
  286|     52|  return bits;
  287|     52|}
decode3f.c:decode_ints_uint32:
  251|     52|{
  252|       |  /* use fastest available decoder implementation */
  253|     52|  if (with_maxbits(maxbits, maxprec, size)) {
  ------------------
  |  Branch (253:7): [True: 18, False: 34]
  ------------------
  254|       |    /* rate constrained path: decode partial bit planes */
  255|     18|    if (size <= 64)
  ------------------
  |  Branch (255:9): [True: 18, False: 0]
  ------------------
  256|     18|      return _t1(decode_few_ints, UInt)(stream, maxbits, maxprec, data, size); /* 1D, 2D, 3D blocks */
  ------------------
  |  |    9|     18|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|     18|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
  257|      0|    else
  258|      0|      return _t1(decode_many_ints, UInt)(stream, maxbits, maxprec, data, size); /* 4D blocks */
  ------------------
  |  |    9|      0|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|      0|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
  259|     18|  }
  260|     34|  else {
  261|       |    /* variable-rate path: decode whole bit planes */
  262|     34|    if (size <= 64)
  ------------------
  |  Branch (262:9): [True: 34, False: 0]
  ------------------
  263|     34|      return _t1(decode_few_ints_prec, UInt)(stream, maxprec, data, size); /* 1D, 2D, 3D blocks */
  ------------------
  |  |    9|     34|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|     34|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
  264|      0|    else
  265|      0|      return _t1(decode_many_ints_prec, UInt)(stream, maxprec, data, size); /* 4D blocks */
  ------------------
  |  |    9|      0|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|      0|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
  266|     34|  }
  267|     52|}
decode3f.c:decode_few_ints_uint32:
   70|     18|{
   71|       |  /* make a copy of bit stream to avoid aliasing */
   72|     18|  bitstream s = *stream;
   73|     18|  uint intprec = (uint)(CHAR_BIT * sizeof(UInt));
   74|     18|  uint kmin = intprec > maxprec ? intprec - maxprec : 0;
  ------------------
  |  Branch (74:15): [True: 0, False: 18]
  ------------------
   75|     18|  uint bits = maxbits;
   76|     18|  uint i, k, m, n;
   77|     18|  uint64 x;
   78|       |
   79|       |  /* initialize data array to all zeros */
   80|  1.17k|  for (i = 0; i < size; i++)
  ------------------
  |  Branch (80:15): [True: 1.15k, False: 18]
  ------------------
   81|  1.15k|    data[i] = 0;
   82|       |
   83|       |  /* decode one bit plane at a time from MSB to LSB */
   84|    254|  for (k = intprec, m = n = 0; bits && (m = 0, k-- > kmin);) {
  ------------------
  |  Branch (84:32): [True: 236, False: 18]
  |  Branch (84:40): [True: 236, False: 0]
  ------------------
   85|       |    /* step 1: decode first n bits of bit plane #k */
   86|    236|    m = MIN(n, bits);
  ------------------
  |  |    4|    236|#define MIN(x, y) ((x) < (y) ? (x) : (y))
  |  |  ------------------
  |  |  |  Branch (4:20): [True: 220, False: 16]
  |  |  ------------------
  ------------------
   87|    236|    bits -= m;
   88|    236|    x = stream_read_bits(&s, m);
   89|       |    /* step 2: unary run-length decode remainder of bit plane */
   90|    410|    for (; bits && n < size; n++, m = n) {
  ------------------
  |  Branch (90:12): [True: 392, False: 18]
  |  Branch (90:20): [True: 290, False: 102]
  ------------------
   91|    290|      bits--;
   92|    290|      if (stream_read_bit(&s)) {
  ------------------
  |  Branch (92:11): [True: 174, False: 116]
  ------------------
   93|       |        /* positive group test; scan for next one-bit */
   94|  1.03k|        for (; bits && n < size - 1; n++) {
  ------------------
  |  Branch (94:16): [True: 1.03k, False: 2]
  |  Branch (94:24): [True: 1.01k, False: 14]
  ------------------
   95|  1.01k|          bits--;
   96|  1.01k|          if (stream_read_bit(&s))
  ------------------
  |  Branch (96:15): [True: 158, False: 860]
  ------------------
   97|    158|            break;
   98|  1.01k|        }
   99|       |        /* set bit and continue decoding bit plane */
  100|    174|        x += (uint64)1 << n;
  101|    174|      }
  102|    116|      else {
  103|       |        /* negative group test; done with bit plane */
  104|    116|        m = size;
  105|    116|        break;
  106|    116|      }
  107|    290|    }
  108|       |    /* step 3: deposit bit plane from x */
  109|  9.56k|    for (i = 0; x; i++, x >>= 1)
  ------------------
  |  Branch (109:17): [True: 9.32k, False: 236]
  ------------------
  110|  9.32k|      data[i] += (UInt)(x & 1u) << k;
  111|    236|  }
  112|       |
  113|       |#if ZFP_ROUNDING_MODE == ZFP_ROUND_LAST
  114|       |  /* bias values to achieve proper rounding */
  115|       |  _t1(inv_round, UInt)(data, size, m, intprec - k);
  116|       |#endif
  117|       |
  118|     18|  *stream = s;
  119|     18|  return maxbits - bits;
  120|     18|}
decode3f.c:decode_few_ints_prec_uint32:
  178|     34|{
  179|       |  /* make a copy of bit stream to avoid aliasing */
  180|     34|  bitstream s = *stream;
  181|     34|  bitstream_offset offset = stream_rtell(&s);
  182|     34|  uint intprec = (uint)(CHAR_BIT * sizeof(UInt));
  183|     34|  uint kmin = intprec > maxprec ? intprec - maxprec : 0;
  ------------------
  |  Branch (183:15): [True: 12, False: 22]
  ------------------
  184|     34|  uint i, k, n;
  185|       |
  186|       |  /* initialize data array to all zeros */
  187|  2.21k|  for (i = 0; i < size; i++)
  ------------------
  |  Branch (187:15): [True: 2.17k, False: 34]
  ------------------
  188|  2.17k|    data[i] = 0;
  189|       |
  190|       |  /* decode one bit plane at a time from MSB to LSB */
  191|    858|  for (k = intprec, n = 0; k-- > kmin;) {
  ------------------
  |  Branch (191:28): [True: 824, False: 34]
  ------------------
  192|       |    /* step 1: decode first n bits of bit plane #k */
  193|    824|    uint64 x = stream_read_bits(&s, n);
  194|       |    /* step 2: unary run-length decode remainder of bit plane */
  195|  1.17k|    for (; n < size && stream_read_bit(&s); x += (uint64)1 << n, n++)
  ------------------
  |  Branch (195:12): [True: 626, False: 552]
  |  Branch (195:24): [True: 354, False: 272]
  ------------------
  196|  2.08k|      for (; n < size - 1 && !stream_read_bit(&s); n++)
  ------------------
  |  Branch (196:14): [True: 2.05k, False: 30]
  |  Branch (196:30): [True: 1.72k, False: 324]
  ------------------
  197|  1.72k|        ;
  198|       |    /* step 3: deposit bit plane from x */
  199|  38.4k|    for (i = 0; x; i++, x >>= 1)
  ------------------
  |  Branch (199:17): [True: 37.5k, False: 824]
  ------------------
  200|  37.5k|      data[i] += (UInt)(x & 1u) << k;
  201|    824|  }
  202|       |
  203|       |#if ZFP_ROUNDING_MODE == ZFP_ROUND_LAST
  204|       |  /* bias values to achieve proper rounding */
  205|       |  _t1(inv_round, UInt)(data, size, 0, intprec - k);
  206|       |#endif
  207|       |
  208|     34|  *stream = s;
  209|     34|  return (uint)(stream_rtell(&s) - offset);
  210|     34|}
decode3f.c:inv_order_int32:
   61|     52|{
   62|     52|  do
   63|  3.32k|    iblock[*perm++] = _t1(uint2int, UInt)(*ublock++);
  ------------------
  |  |    9|  3.32k|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|  3.32k|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
   64|  3.32k|  while (--n);
  ------------------
  |  Branch (64:10): [True: 3.27k, False: 52]
  ------------------
   65|     52|}
decode3f.c:uint2int_uint32:
   54|  3.32k|{
   55|  3.32k|  return (Int)((x ^ NBMASK) - NBMASK);
  ------------------
  |  |    8|  3.32k|#define NBMASK 0xaaaaaaaau /* negabinary mask */
  ------------------
                return (Int)((x ^ NBMASK) - NBMASK);
  ------------------
  |  |    8|  3.32k|#define NBMASK 0xaaaaaaaau /* negabinary mask */
  ------------------
   56|  3.32k|}
decode3f.c:inv_lift_int32:
   10|  2.49k|{
   11|  2.49k|  Int x, y, z, w;
  ------------------
  |  |    4|  2.49k|#define Int int32          /* corresponding signed integer type */
  ------------------
   12|  2.49k|  x = *p; p += s;
   13|  2.49k|  y = *p; p += s;
   14|  2.49k|  z = *p; p += s;
   15|  2.49k|  w = *p; p += s;
   16|       |
   17|       |  /*
   18|       |  ** non-orthogonal transform
   19|       |  **       ( 4  6 -4 -1) (x)
   20|       |  ** 1/4 * ( 4  2  4  5) (y)
   21|       |  **       ( 4 -2  4 -5) (z)
   22|       |  **       ( 4 -6 -4  1) (w)
   23|       |  */
   24|  2.49k|  y += w >> 1; w -= y >> 1;
   25|  2.49k|  y += w; w <<= 1; w -= y;
   26|  2.49k|  z += x; x <<= 1; x -= z;
   27|  2.49k|  y += z; z <<= 1; z -= y;
   28|  2.49k|  w += x; x <<= 1; x -= w;
   29|       |
   30|  2.49k|  p -= s; *p = w;
   31|  2.49k|  p -= s; *p = z;
   32|  2.49k|  p -= s; *p = y;
   33|  2.49k|  p -= s; *p = x;
   34|  2.49k|}
decode3d.c:decode_block_int64_3:
  272|     64|{
  273|     64|  uint bits;
  274|     64|  cache_align_(UInt ublock[BLOCK_SIZE]);
  ------------------
  |  |   42|     64|  #define cache_align_(x) x __attribute__((aligned(ZFP_CACHE_LINE_SIZE)))
  ------------------
  275|       |  /* decode integer coefficients */
  276|     64|  bits = _t1(decode_ints, UInt)(stream, maxbits, maxprec, ublock, BLOCK_SIZE);
  ------------------
  |  |    9|     64|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|     64|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
                bits = _t1(decode_ints, UInt)(stream, maxbits, maxprec, ublock, BLOCK_SIZE);
  ------------------
  |  |    2|     64|#define BLOCK_SIZE (1 << (2 * DIMS))   /* values per block */
  |  |  ------------------
  |  |  |  |    1|     64|#define DIMS 3
  |  |  ------------------
  ------------------
  277|       |  /* read at least minbits bits */
  278|     64|  if (bits < minbits) {
  ------------------
  |  Branch (278:7): [True: 0, False: 64]
  ------------------
  279|      0|    stream_skip(stream, minbits - bits);
  280|      0|    bits = minbits;
  281|      0|  }
  282|       |  /* reorder unsigned coefficients and convert to signed integer */
  283|     64|  _t1(inv_order, Int)(ublock, iblock, PERM, BLOCK_SIZE);
  ------------------
  |  |    9|     64|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|     64|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
                _t1(inv_order, Int)(ublock, iblock, PERM, BLOCK_SIZE);
  ------------------
  |  |    1|     64|#define PERM _t1(perm, DIMS)           /* coefficient order */
  |  |  ------------------
  |  |  |  |    9|     64|#define _t1(function, arg)        _cat2(function, arg)
  |  |  |  |  ------------------
  |  |  |  |  |  |    5|     64|#define _cat2(x, y)    x ## _ ## y
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                _t1(inv_order, Int)(ublock, iblock, PERM, BLOCK_SIZE);
  ------------------
  |  |    2|     64|#define BLOCK_SIZE (1 << (2 * DIMS))   /* values per block */
  |  |  ------------------
  |  |  |  |    1|     64|#define DIMS 3
  |  |  ------------------
  ------------------
  284|       |  /* perform decorrelating transform */
  285|     64|  _t2(inv_xform, Int, DIMS)(iblock);
  ------------------
  |  |   10|     64|#define _t2(function, type, dims) _cat3(function, type, dims)
  |  |  ------------------
  |  |  |  |    6|     64|#define _cat3(x, y, z) x ## _ ## y ## _ ## z
  |  |  ------------------
  ------------------
  286|     64|  return bits;
  287|     64|}
decode3d.c:decode_ints_uint64:
  251|     64|{
  252|       |  /* use fastest available decoder implementation */
  253|     64|  if (with_maxbits(maxbits, maxprec, size)) {
  ------------------
  |  Branch (253:7): [True: 32, False: 32]
  ------------------
  254|       |    /* rate constrained path: decode partial bit planes */
  255|     32|    if (size <= 64)
  ------------------
  |  Branch (255:9): [True: 32, False: 0]
  ------------------
  256|     32|      return _t1(decode_few_ints, UInt)(stream, maxbits, maxprec, data, size); /* 1D, 2D, 3D blocks */
  ------------------
  |  |    9|     32|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|     32|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
  257|      0|    else
  258|      0|      return _t1(decode_many_ints, UInt)(stream, maxbits, maxprec, data, size); /* 4D blocks */
  ------------------
  |  |    9|      0|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|      0|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
  259|     32|  }
  260|     32|  else {
  261|       |    /* variable-rate path: decode whole bit planes */
  262|     32|    if (size <= 64)
  ------------------
  |  Branch (262:9): [True: 32, False: 0]
  ------------------
  263|     32|      return _t1(decode_few_ints_prec, UInt)(stream, maxprec, data, size); /* 1D, 2D, 3D blocks */
  ------------------
  |  |    9|     32|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|     32|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
  264|      0|    else
  265|      0|      return _t1(decode_many_ints_prec, UInt)(stream, maxprec, data, size); /* 4D blocks */
  ------------------
  |  |    9|      0|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|      0|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
  266|     32|  }
  267|     64|}
decode3d.c:decode_few_ints_uint64:
   70|     32|{
   71|       |  /* make a copy of bit stream to avoid aliasing */
   72|     32|  bitstream s = *stream;
   73|     32|  uint intprec = (uint)(CHAR_BIT * sizeof(UInt));
   74|     32|  uint kmin = intprec > maxprec ? intprec - maxprec : 0;
  ------------------
  |  Branch (74:15): [True: 0, False: 32]
  ------------------
   75|     32|  uint bits = maxbits;
   76|     32|  uint i, k, m, n;
   77|     32|  uint64 x;
   78|       |
   79|       |  /* initialize data array to all zeros */
   80|  2.08k|  for (i = 0; i < size; i++)
  ------------------
  |  Branch (80:15): [True: 2.04k, False: 32]
  ------------------
   81|  2.04k|    data[i] = 0;
   82|       |
   83|       |  /* decode one bit plane at a time from MSB to LSB */
   84|    850|  for (k = intprec, m = n = 0; bits && (m = 0, k-- > kmin);) {
  ------------------
  |  Branch (84:32): [True: 818, False: 32]
  |  Branch (84:40): [True: 818, False: 0]
  ------------------
   85|       |    /* step 1: decode first n bits of bit plane #k */
   86|    818|    m = MIN(n, bits);
  ------------------
  |  |    4|    818|#define MIN(x, y) ((x) < (y) ? (x) : (y))
  |  |  ------------------
  |  |  |  Branch (4:20): [True: 786, False: 32]
  |  |  ------------------
  ------------------
   87|    818|    bits -= m;
   88|    818|    x = stream_read_bits(&s, m);
   89|       |    /* step 2: unary run-length decode remainder of bit plane */
   90|  1.28k|    for (; bits && n < size; n++, m = n) {
  ------------------
  |  Branch (90:12): [True: 1.25k, False: 32]
  |  Branch (90:20): [True: 706, False: 544]
  ------------------
   91|    706|      bits--;
   92|    706|      if (stream_read_bit(&s)) {
  ------------------
  |  Branch (92:11): [True: 464, False: 242]
  ------------------
   93|       |        /* positive group test; scan for next one-bit */
   94|  2.04k|        for (; bits && n < size - 1; n++) {
  ------------------
  |  Branch (94:16): [True: 2.04k, False: 0]
  |  Branch (94:24): [True: 2.01k, False: 32]
  ------------------
   95|  2.01k|          bits--;
   96|  2.01k|          if (stream_read_bit(&s))
  ------------------
  |  Branch (96:15): [True: 432, False: 1.58k]
  ------------------
   97|    432|            break;
   98|  2.01k|        }
   99|       |        /* set bit and continue decoding bit plane */
  100|    464|        x += (uint64)1 << n;
  101|    464|      }
  102|    242|      else {
  103|       |        /* negative group test; done with bit plane */
  104|    242|        m = size;
  105|    242|        break;
  106|    242|      }
  107|    706|    }
  108|       |    /* step 3: deposit bit plane from x */
  109|  38.9k|    for (i = 0; x; i++, x >>= 1)
  ------------------
  |  Branch (109:17): [True: 38.1k, False: 818]
  ------------------
  110|  38.1k|      data[i] += (UInt)(x & 1u) << k;
  111|    818|  }
  112|       |
  113|       |#if ZFP_ROUNDING_MODE == ZFP_ROUND_LAST
  114|       |  /* bias values to achieve proper rounding */
  115|       |  _t1(inv_round, UInt)(data, size, m, intprec - k);
  116|       |#endif
  117|       |
  118|     32|  *stream = s;
  119|     32|  return maxbits - bits;
  120|     32|}
decode3d.c:decode_few_ints_prec_uint64:
  178|     32|{
  179|       |  /* make a copy of bit stream to avoid aliasing */
  180|     32|  bitstream s = *stream;
  181|     32|  bitstream_offset offset = stream_rtell(&s);
  182|     32|  uint intprec = (uint)(CHAR_BIT * sizeof(UInt));
  183|     32|  uint kmin = intprec > maxprec ? intprec - maxprec : 0;
  ------------------
  |  Branch (183:15): [True: 32, False: 0]
  ------------------
  184|     32|  uint i, k, n;
  185|       |
  186|       |  /* initialize data array to all zeros */
  187|  2.08k|  for (i = 0; i < size; i++)
  ------------------
  |  Branch (187:15): [True: 2.04k, False: 32]
  ------------------
  188|  2.04k|    data[i] = 0;
  189|       |
  190|       |  /* decode one bit plane at a time from MSB to LSB */
  191|  1.52k|  for (k = intprec, n = 0; k-- > kmin;) {
  ------------------
  |  Branch (191:28): [True: 1.48k, False: 32]
  ------------------
  192|       |    /* step 1: decode first n bits of bit plane #k */
  193|  1.48k|    uint64 x = stream_read_bits(&s, n);
  194|       |    /* step 2: unary run-length decode remainder of bit plane */
  195|  1.98k|    for (; n < size && stream_read_bit(&s); x += (uint64)1 << n, n++)
  ------------------
  |  Branch (195:12): [True: 738, False: 1.24k]
  |  Branch (195:24): [True: 498, False: 240]
  ------------------
  196|  2.04k|      for (; n < size - 1 && !stream_read_bit(&s); n++)
  ------------------
  |  Branch (196:14): [True: 2.01k, False: 32]
  |  Branch (196:30): [True: 1.55k, False: 466]
  ------------------
  197|  1.55k|        ;
  198|       |    /* step 3: deposit bit plane from x */
  199|  68.4k|    for (i = 0; x; i++, x >>= 1)
  ------------------
  |  Branch (199:17): [True: 66.9k, False: 1.48k]
  ------------------
  200|  66.9k|      data[i] += (UInt)(x & 1u) << k;
  201|  1.48k|  }
  202|       |
  203|       |#if ZFP_ROUNDING_MODE == ZFP_ROUND_LAST
  204|       |  /* bias values to achieve proper rounding */
  205|       |  _t1(inv_round, UInt)(data, size, 0, intprec - k);
  206|       |#endif
  207|       |
  208|     32|  *stream = s;
  209|     32|  return (uint)(stream_rtell(&s) - offset);
  210|     32|}
decode3d.c:inv_order_int64:
   61|     64|{
   62|     64|  do
   63|  4.09k|    iblock[*perm++] = _t1(uint2int, UInt)(*ublock++);
  ------------------
  |  |    9|  4.09k|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|  4.09k|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
   64|  4.09k|  while (--n);
  ------------------
  |  Branch (64:10): [True: 4.03k, False: 64]
  ------------------
   65|     64|}
decode3d.c:uint2int_uint64:
   54|  4.09k|{
   55|  4.09k|  return (Int)((x ^ NBMASK) - NBMASK);
  ------------------
  |  |    8|  4.09k|#define NBMASK UINT64C(0xaaaaaaaaaaaaaaaa) /* negabinary mask */
  |  |  ------------------
  |  |  |  |   38|  4.09k|  #define UINT64C(x) UINT64_C(x)
  |  |  ------------------
  ------------------
                return (Int)((x ^ NBMASK) - NBMASK);
  ------------------
  |  |    8|  4.09k|#define NBMASK UINT64C(0xaaaaaaaaaaaaaaaa) /* negabinary mask */
  |  |  ------------------
  |  |  |  |   38|  4.09k|  #define UINT64C(x) UINT64_C(x)
  |  |  ------------------
  ------------------
   56|  4.09k|}
decode3d.c:inv_lift_int64:
   10|  3.07k|{
   11|  3.07k|  Int x, y, z, w;
  ------------------
  |  |    4|  3.07k|#define Int int64                          /* corresponding signed integer type */
  ------------------
   12|  3.07k|  x = *p; p += s;
   13|  3.07k|  y = *p; p += s;
   14|  3.07k|  z = *p; p += s;
   15|  3.07k|  w = *p; p += s;
   16|       |
   17|       |  /*
   18|       |  ** non-orthogonal transform
   19|       |  **       ( 4  6 -4 -1) (x)
   20|       |  ** 1/4 * ( 4  2  4  5) (y)
   21|       |  **       ( 4 -2  4 -5) (z)
   22|       |  **       ( 4 -6 -4  1) (w)
   23|       |  */
   24|  3.07k|  y += w >> 1; w -= y >> 1;
   25|  3.07k|  y += w; w <<= 1; w -= y;
   26|  3.07k|  z += x; x <<= 1; x -= z;
   27|  3.07k|  y += z; z <<= 1; z -= y;
   28|  3.07k|  w += x; x <<= 1; x -= w;
   29|       |
   30|  3.07k|  p -= s; *p = w;
   31|  3.07k|  p -= s; *p = z;
   32|  3.07k|  p -= s; *p = y;
   33|  3.07k|  p -= s; *p = x;
   34|  3.07k|}
decode4f.c:decode_block_int32_4:
  272|    116|{
  273|    116|  uint bits;
  274|    116|  cache_align_(UInt ublock[BLOCK_SIZE]);
  ------------------
  |  |   42|    116|  #define cache_align_(x) x __attribute__((aligned(ZFP_CACHE_LINE_SIZE)))
  ------------------
  275|       |  /* decode integer coefficients */
  276|    116|  bits = _t1(decode_ints, UInt)(stream, maxbits, maxprec, ublock, BLOCK_SIZE);
  ------------------
  |  |    9|    116|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|    116|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
                bits = _t1(decode_ints, UInt)(stream, maxbits, maxprec, ublock, BLOCK_SIZE);
  ------------------
  |  |    2|    116|#define BLOCK_SIZE (1 << (2 * DIMS))   /* values per block */
  |  |  ------------------
  |  |  |  |    1|    116|#define DIMS 4
  |  |  ------------------
  ------------------
  277|       |  /* read at least minbits bits */
  278|    116|  if (bits < minbits) {
  ------------------
  |  Branch (278:7): [True: 0, False: 116]
  ------------------
  279|      0|    stream_skip(stream, minbits - bits);
  280|      0|    bits = minbits;
  281|      0|  }
  282|       |  /* reorder unsigned coefficients and convert to signed integer */
  283|    116|  _t1(inv_order, Int)(ublock, iblock, PERM, BLOCK_SIZE);
  ------------------
  |  |    9|    116|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|    116|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
                _t1(inv_order, Int)(ublock, iblock, PERM, BLOCK_SIZE);
  ------------------
  |  |    1|    116|#define PERM _t1(perm, DIMS)           /* coefficient order */
  |  |  ------------------
  |  |  |  |    9|    116|#define _t1(function, arg)        _cat2(function, arg)
  |  |  |  |  ------------------
  |  |  |  |  |  |    5|    116|#define _cat2(x, y)    x ## _ ## y
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                _t1(inv_order, Int)(ublock, iblock, PERM, BLOCK_SIZE);
  ------------------
  |  |    2|    116|#define BLOCK_SIZE (1 << (2 * DIMS))   /* values per block */
  |  |  ------------------
  |  |  |  |    1|    116|#define DIMS 4
  |  |  ------------------
  ------------------
  284|       |  /* perform decorrelating transform */
  285|    116|  _t2(inv_xform, Int, DIMS)(iblock);
  ------------------
  |  |   10|    116|#define _t2(function, type, dims) _cat3(function, type, dims)
  |  |  ------------------
  |  |  |  |    6|    116|#define _cat3(x, y, z) x ## _ ## y ## _ ## z
  |  |  ------------------
  ------------------
  286|    116|  return bits;
  287|    116|}
decode4f.c:decode_ints_uint32:
  251|    116|{
  252|       |  /* use fastest available decoder implementation */
  253|    116|  if (with_maxbits(maxbits, maxprec, size)) {
  ------------------
  |  Branch (253:7): [True: 44, False: 72]
  ------------------
  254|       |    /* rate constrained path: decode partial bit planes */
  255|     44|    if (size <= 64)
  ------------------
  |  Branch (255:9): [True: 0, False: 44]
  ------------------
  256|      0|      return _t1(decode_few_ints, UInt)(stream, maxbits, maxprec, data, size); /* 1D, 2D, 3D blocks */
  ------------------
  |  |    9|      0|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|      0|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
  257|     44|    else
  258|     44|      return _t1(decode_many_ints, UInt)(stream, maxbits, maxprec, data, size); /* 4D blocks */
  ------------------
  |  |    9|     44|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|     44|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
  259|     44|  }
  260|     72|  else {
  261|       |    /* variable-rate path: decode whole bit planes */
  262|     72|    if (size <= 64)
  ------------------
  |  Branch (262:9): [True: 0, False: 72]
  ------------------
  263|      0|      return _t1(decode_few_ints_prec, UInt)(stream, maxprec, data, size); /* 1D, 2D, 3D blocks */
  ------------------
  |  |    9|      0|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|      0|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
  264|     72|    else
  265|     72|      return _t1(decode_many_ints_prec, UInt)(stream, maxprec, data, size); /* 4D blocks */
  ------------------
  |  |    9|     72|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|     72|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
  266|     72|  }
  267|    116|}
decode4f.c:decode_many_ints_uint32:
  125|     44|{
  126|       |  /* make a copy of bit stream to avoid aliasing */
  127|     44|  bitstream s = *stream;
  128|     44|  uint intprec = (uint)(CHAR_BIT * sizeof(UInt));
  129|     44|  uint kmin = intprec > maxprec ? intprec - maxprec : 0;
  ------------------
  |  Branch (129:15): [True: 0, False: 44]
  ------------------
  130|     44|  uint bits = maxbits;
  131|     44|  uint i, k, m, n;
  132|       |
  133|       |  /* initialize data array to all zeros */
  134|  11.3k|  for (i = 0; i < size; i++)
  ------------------
  |  Branch (134:15): [True: 11.2k, False: 44]
  ------------------
  135|  11.2k|    data[i] = 0;
  136|       |
  137|       |  /* decode one bit plane at a time from MSB to LSB */
  138|    186|  for (k = intprec, m = n = 0; bits && (m = 0, k-- > kmin);) {
  ------------------
  |  Branch (138:32): [True: 142, False: 44]
  |  Branch (138:40): [True: 142, False: 0]
  ------------------
  139|       |    /* step 1: decode first n bits of bit plane #k */
  140|    142|    m = MIN(n, bits);
  ------------------
  |  |    4|    142|#define MIN(x, y) ((x) < (y) ? (x) : (y))
  |  |  ------------------
  |  |  |  Branch (4:20): [True: 120, False: 22]
  |  |  ------------------
  ------------------
  141|    142|    bits -= m;
  142|  1.25k|    for (i = 0; i < m; i++)
  ------------------
  |  Branch (142:17): [True: 1.11k, False: 142]
  ------------------
  143|  1.11k|      if (stream_read_bit(&s))
  ------------------
  |  Branch (143:11): [True: 84, False: 1.02k]
  ------------------
  144|     84|        data[i] += (UInt)1 << k;
  145|       |    /* step 2: unary run-length decode remainder of bit plane */
  146|    270|    for (; bits && n < size; n++, m = n) {
  ------------------
  |  Branch (146:12): [True: 226, False: 44]
  |  Branch (146:20): [True: 226, False: 0]
  ------------------
  147|    226|      bits--;
  148|    226|      if (stream_read_bit(&s)) {
  ------------------
  |  Branch (148:11): [True: 128, False: 98]
  ------------------
  149|       |        /* positive group test; scan for next one-bit */
  150|  4.19k|        for (; bits && n < size - 1; n++) {
  ------------------
  |  Branch (150:16): [True: 4.17k, False: 22]
  |  Branch (150:24): [True: 4.17k, False: 0]
  ------------------
  151|  4.17k|          bits--;
  152|  4.17k|          if (stream_read_bit(&s))
  ------------------
  |  Branch (152:15): [True: 106, False: 4.06k]
  ------------------
  153|    106|            break;
  154|  4.17k|        }
  155|       |        /* set bit and continue decoding bit plane */
  156|    128|        data[n] += (UInt)1 << k;
  157|    128|      }
  158|     98|      else {
  159|       |        /* negative group test; done with bit plane */
  160|     98|        m = size;
  161|     98|        break;
  162|     98|      }
  163|    226|    }
  164|    142|  }
  165|       |
  166|       |#if ZFP_ROUNDING_MODE == ZFP_ROUND_LAST
  167|       |  /* bias values to achieve proper rounding */
  168|       |  _t1(inv_round, UInt)(data, size, m, intprec - k);
  169|       |#endif
  170|       |
  171|     44|  *stream = s;
  172|     44|  return maxbits - bits;
  173|     44|}
decode4f.c:decode_many_ints_prec_uint32:
  215|     72|{
  216|       |  /* make a copy of bit stream to avoid aliasing */
  217|     72|  bitstream s = *stream;
  218|     72|  bitstream_offset offset = stream_rtell(&s);
  219|     72|  uint intprec = (uint)(CHAR_BIT * sizeof(UInt));
  220|     72|  uint kmin = intprec > maxprec ? intprec - maxprec : 0;
  ------------------
  |  Branch (220:15): [True: 64, False: 8]
  ------------------
  221|     72|  uint i, k, n;
  222|       |
  223|       |  /* initialize data array to all zeros */
  224|  18.5k|  for (i = 0; i < size; i++)
  ------------------
  |  Branch (224:15): [True: 18.4k, False: 72]
  ------------------
  225|  18.4k|    data[i] = 0;
  226|       |
  227|       |  /* decode one bit plane at a time from MSB to LSB */
  228|  1.09k|  for (k = intprec, n = 0; k-- > kmin;) {
  ------------------
  |  Branch (228:28): [True: 1.02k, False: 72]
  ------------------
  229|       |    /* step 1: decode first n bits of bit plane #k */
  230|   173k|    for (i = 0; i < n; i++)
  ------------------
  |  Branch (230:17): [True: 172k, False: 1.02k]
  ------------------
  231|   172k|      if (stream_read_bit(&s))
  ------------------
  |  Branch (231:11): [True: 71.6k, False: 101k]
  ------------------
  232|  71.6k|        data[i] += (UInt)1 << k;
  233|       |    /* step 2: unary run-length decode remainder of bit plane */
  234|  2.12k|    for (; n < size && stream_read_bit(&s); data[n] += (UInt)1 << k, n++)
  ------------------
  |  Branch (234:12): [True: 1.56k, False: 558]
  |  Branch (234:24): [True: 1.10k, False: 466]
  ------------------
  235|  18.4k|      for (; n < size - 1 && !stream_read_bit(&s); n++)
  ------------------
  |  Branch (235:14): [True: 18.3k, False: 72]
  |  Branch (235:30): [True: 17.3k, False: 1.02k]
  ------------------
  236|  17.3k|        ;
  237|  1.02k|  }
  238|       |
  239|       |#if ZFP_ROUNDING_MODE == ZFP_ROUND_LAST
  240|       |  /* bias values to achieve proper rounding */
  241|       |  _t1(inv_round, UInt)(data, size, 0, intprec - k);
  242|       |#endif
  243|       |
  244|     72|  *stream = s;
  245|     72|  return (uint)(stream_rtell(&s) - offset);
  246|     72|}
decode4f.c:inv_order_int32:
   61|    116|{
   62|    116|  do
   63|  29.6k|    iblock[*perm++] = _t1(uint2int, UInt)(*ublock++);
  ------------------
  |  |    9|  29.6k|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|  29.6k|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
   64|  29.6k|  while (--n);
  ------------------
  |  Branch (64:10): [True: 29.5k, False: 116]
  ------------------
   65|    116|}
decode4f.c:uint2int_uint32:
   54|  29.6k|{
   55|  29.6k|  return (Int)((x ^ NBMASK) - NBMASK);
  ------------------
  |  |    8|  29.6k|#define NBMASK 0xaaaaaaaau /* negabinary mask */
  ------------------
                return (Int)((x ^ NBMASK) - NBMASK);
  ------------------
  |  |    8|  29.6k|#define NBMASK 0xaaaaaaaau /* negabinary mask */
  ------------------
   56|  29.6k|}
decode4f.c:inv_lift_int32:
   10|  29.6k|{
   11|  29.6k|  Int x, y, z, w;
  ------------------
  |  |    4|  29.6k|#define Int int32          /* corresponding signed integer type */
  ------------------
   12|  29.6k|  x = *p; p += s;
   13|  29.6k|  y = *p; p += s;
   14|  29.6k|  z = *p; p += s;
   15|  29.6k|  w = *p; p += s;
   16|       |
   17|       |  /*
   18|       |  ** non-orthogonal transform
   19|       |  **       ( 4  6 -4 -1) (x)
   20|       |  ** 1/4 * ( 4  2  4  5) (y)
   21|       |  **       ( 4 -2  4 -5) (z)
   22|       |  **       ( 4 -6 -4  1) (w)
   23|       |  */
   24|  29.6k|  y += w >> 1; w -= y >> 1;
   25|  29.6k|  y += w; w <<= 1; w -= y;
   26|  29.6k|  z += x; x <<= 1; x -= z;
   27|  29.6k|  y += z; z <<= 1; z -= y;
   28|  29.6k|  w += x; x <<= 1; x -= w;
   29|       |
   30|  29.6k|  p -= s; *p = w;
   31|  29.6k|  p -= s; *p = z;
   32|  29.6k|  p -= s; *p = y;
   33|  29.6k|  p -= s; *p = x;
   34|  29.6k|}

zfp_decode_block_strided_double_2:
   41|      4|{
   42|       |  /* decode contiguous block */
   43|      4|  cache_align_(Scalar block[16]);
  ------------------
  |  |   42|      4|  #define cache_align_(x) x __attribute__((aligned(ZFP_CACHE_LINE_SIZE)))
  ------------------
   44|      4|  size_t bits = _t2(zfp_decode_block, Scalar, 2)(stream, block);
  ------------------
  |  |   10|      4|#define _t2(function, type, dims) _cat3(function, type, dims)
  |  |  ------------------
  |  |  |  |    6|      4|#define _cat3(x, y, z) x ## _ ## y ## _ ## z
  |  |  ------------------
  ------------------
   45|       |  /* scatter block to strided array */
   46|      4|  _t2(scatter, Scalar, 2)(block, p, sx, sy);
  ------------------
  |  |   10|      4|#define _t2(function, type, dims) _cat3(function, type, dims)
  |  |  ------------------
  |  |  |  |    6|      4|#define _cat3(x, y, z) x ## _ ## y ## _ ## z
  |  |  ------------------
  ------------------
   47|      4|  return bits;
   48|      4|}
decode2d.c:inv_xform_int64_2:
   26|      4|{
   27|      4|  uint x, y;
   28|       |  /* transform along y */
   29|     20|  for (x = 0; x < 4; x++)
  ------------------
  |  Branch (29:15): [True: 16, False: 4]
  ------------------
   30|     16|    _t1(inv_lift, Int)(p + 1 * x, 4);
  ------------------
  |  |    9|     16|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|     16|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
   31|       |  /* transform along x */
   32|     20|  for (y = 0; y < 4; y++)
  ------------------
  |  Branch (32:15): [True: 16, False: 4]
  ------------------
   33|     16|    _t1(inv_lift, Int)(p + 4 * y, 1);
  ------------------
  |  |    9|     16|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|     16|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
   34|      4|}
decode2d.c:scatter_double_2:
    6|      4|{
    7|      4|  uint x, y;
    8|     20|  for (y = 0; y < 4; y++, p += sy - 4 * sx)
  ------------------
  |  Branch (8:15): [True: 16, False: 4]
  ------------------
    9|     80|    for (x = 0; x < 4; x++, p += sx)
  ------------------
  |  Branch (9:17): [True: 64, False: 16]
  ------------------
   10|     64|      *p = *q++;
   11|      4|}

zfp_decode_block_strided_float_3:
   49|     56|{
   50|       |  /* decode contiguous block */
   51|     56|  cache_align_(Scalar block[64]);
  ------------------
  |  |   42|     56|  #define cache_align_(x) x __attribute__((aligned(ZFP_CACHE_LINE_SIZE)))
  ------------------
   52|     56|  size_t bits = _t2(zfp_decode_block, Scalar, 3)(stream, block);
  ------------------
  |  |   10|     56|#define _t2(function, type, dims) _cat3(function, type, dims)
  |  |  ------------------
  |  |  |  |    6|     56|#define _cat3(x, y, z) x ## _ ## y ## _ ## z
  |  |  ------------------
  ------------------
   53|       |  /* scatter block to strided array */
   54|     56|  _t2(scatter, Scalar, 3)(block, p, sx, sy, sz);
  ------------------
  |  |   10|     56|#define _t2(function, type, dims) _cat3(function, type, dims)
  |  |  ------------------
  |  |  |  |    6|     56|#define _cat3(x, y, z) x ## _ ## y ## _ ## z
  |  |  ------------------
  ------------------
   55|     56|  return bits;
   56|     56|}
decode3f.c:inv_xform_int32_3:
   28|     52|{
   29|     52|  uint x, y, z;
   30|       |  /* transform along z */
   31|    260|  for (y = 0; y < 4; y++)
  ------------------
  |  Branch (31:15): [True: 208, False: 52]
  ------------------
   32|  1.04k|    for (x = 0; x < 4; x++)
  ------------------
  |  Branch (32:17): [True: 832, False: 208]
  ------------------
   33|    832|      _t1(inv_lift, Int)(p + 1 * x + 4 * y, 16);
  ------------------
  |  |    9|    832|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|    832|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
   34|       |  /* transform along y */
   35|    260|  for (x = 0; x < 4; x++)
  ------------------
  |  Branch (35:15): [True: 208, False: 52]
  ------------------
   36|  1.04k|    for (z = 0; z < 4; z++)
  ------------------
  |  Branch (36:17): [True: 832, False: 208]
  ------------------
   37|    832|      _t1(inv_lift, Int)(p + 16 * z + 1 * x, 4);
  ------------------
  |  |    9|    832|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|    832|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
   38|       |  /* transform along x */
   39|    260|  for (z = 0; z < 4; z++)
  ------------------
  |  Branch (39:15): [True: 208, False: 52]
  ------------------
   40|  1.04k|    for (y = 0; y < 4; y++)
  ------------------
  |  Branch (40:17): [True: 832, False: 208]
  ------------------
   41|    832|      _t1(inv_lift, Int)(p + 4 * y + 16 * z, 1);
  ------------------
  |  |    9|    832|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|    832|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
   42|     52|}
decode3f.c:scatter_float_3:
    6|     56|{
    7|     56|  uint x, y, z;
    8|    280|  for (z = 0; z < 4; z++, p += sz - 4 * sy)
  ------------------
  |  Branch (8:15): [True: 224, False: 56]
  ------------------
    9|  1.12k|    for (y = 0; y < 4; y++, p += sy - 4 * sx)
  ------------------
  |  Branch (9:17): [True: 896, False: 224]
  ------------------
   10|  4.48k|      for (x = 0; x < 4; x++, p += sx)
  ------------------
  |  Branch (10:19): [True: 3.58k, False: 896]
  ------------------
   11|  3.58k|        *p = *q++;
   12|     56|}
zfp_decode_block_strided_double_3:
   49|     64|{
   50|       |  /* decode contiguous block */
   51|     64|  cache_align_(Scalar block[64]);
  ------------------
  |  |   42|     64|  #define cache_align_(x) x __attribute__((aligned(ZFP_CACHE_LINE_SIZE)))
  ------------------
   52|     64|  size_t bits = _t2(zfp_decode_block, Scalar, 3)(stream, block);
  ------------------
  |  |   10|     64|#define _t2(function, type, dims) _cat3(function, type, dims)
  |  |  ------------------
  |  |  |  |    6|     64|#define _cat3(x, y, z) x ## _ ## y ## _ ## z
  |  |  ------------------
  ------------------
   53|       |  /* scatter block to strided array */
   54|     64|  _t2(scatter, Scalar, 3)(block, p, sx, sy, sz);
  ------------------
  |  |   10|     64|#define _t2(function, type, dims) _cat3(function, type, dims)
  |  |  ------------------
  |  |  |  |    6|     64|#define _cat3(x, y, z) x ## _ ## y ## _ ## z
  |  |  ------------------
  ------------------
   55|     64|  return bits;
   56|     64|}
decode3d.c:inv_xform_int64_3:
   28|     64|{
   29|     64|  uint x, y, z;
   30|       |  /* transform along z */
   31|    320|  for (y = 0; y < 4; y++)
  ------------------
  |  Branch (31:15): [True: 256, False: 64]
  ------------------
   32|  1.28k|    for (x = 0; x < 4; x++)
  ------------------
  |  Branch (32:17): [True: 1.02k, False: 256]
  ------------------
   33|  1.02k|      _t1(inv_lift, Int)(p + 1 * x + 4 * y, 16);
  ------------------
  |  |    9|  1.02k|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|  1.02k|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
   34|       |  /* transform along y */
   35|    320|  for (x = 0; x < 4; x++)
  ------------------
  |  Branch (35:15): [True: 256, False: 64]
  ------------------
   36|  1.28k|    for (z = 0; z < 4; z++)
  ------------------
  |  Branch (36:17): [True: 1.02k, False: 256]
  ------------------
   37|  1.02k|      _t1(inv_lift, Int)(p + 16 * z + 1 * x, 4);
  ------------------
  |  |    9|  1.02k|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|  1.02k|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
   38|       |  /* transform along x */
   39|    320|  for (z = 0; z < 4; z++)
  ------------------
  |  Branch (39:15): [True: 256, False: 64]
  ------------------
   40|  1.28k|    for (y = 0; y < 4; y++)
  ------------------
  |  Branch (40:17): [True: 1.02k, False: 256]
  ------------------
   41|  1.02k|      _t1(inv_lift, Int)(p + 4 * y + 16 * z, 1);
  ------------------
  |  |    9|  1.02k|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|  1.02k|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
   42|     64|}
decode3d.c:scatter_double_3:
    6|     64|{
    7|     64|  uint x, y, z;
    8|    320|  for (z = 0; z < 4; z++, p += sz - 4 * sy)
  ------------------
  |  Branch (8:15): [True: 256, False: 64]
  ------------------
    9|  1.28k|    for (y = 0; y < 4; y++, p += sy - 4 * sx)
  ------------------
  |  Branch (9:17): [True: 1.02k, False: 256]
  ------------------
   10|  5.12k|      for (x = 0; x < 4; x++, p += sx)
  ------------------
  |  Branch (10:19): [True: 4.09k, False: 1.02k]
  ------------------
   11|  4.09k|        *p = *q++;
   12|     64|}

zfp_decode_block_strided_float_4:
   59|    120|{
   60|       |  /* decode contiguous block */
   61|    120|  cache_align_(Scalar block[256]);
  ------------------
  |  |   42|    120|  #define cache_align_(x) x __attribute__((aligned(ZFP_CACHE_LINE_SIZE)))
  ------------------
   62|    120|  size_t bits = _t2(zfp_decode_block, Scalar, 4)(stream, block);
  ------------------
  |  |   10|    120|#define _t2(function, type, dims) _cat3(function, type, dims)
  |  |  ------------------
  |  |  |  |    6|    120|#define _cat3(x, y, z) x ## _ ## y ## _ ## z
  |  |  ------------------
  ------------------
   63|       |  /* scatter block to strided array */
   64|    120|  _t2(scatter, Scalar, 4)(block, p, sx, sy, sz, sw);
  ------------------
  |  |   10|    120|#define _t2(function, type, dims) _cat3(function, type, dims)
  |  |  ------------------
  |  |  |  |    6|    120|#define _cat3(x, y, z) x ## _ ## y ## _ ## z
  |  |  ------------------
  ------------------
   65|    120|  return bits;
   66|    120|}
decode4f.c:inv_xform_int32_4:
   30|    116|{
   31|    116|  uint x, y, z, w;
   32|       |  /* transform along w */
   33|    580|  for (z = 0; z < 4; z++)
  ------------------
  |  Branch (33:15): [True: 464, False: 116]
  ------------------
   34|  2.32k|    for (y = 0; y < 4; y++)
  ------------------
  |  Branch (34:17): [True: 1.85k, False: 464]
  ------------------
   35|  9.28k|      for (x = 0; x < 4; x++)
  ------------------
  |  Branch (35:19): [True: 7.42k, False: 1.85k]
  ------------------
   36|  7.42k|        _t1(inv_lift, Int)(p + 1 * x + 4 * y + 16 * z, 64);
  ------------------
  |  |    9|  7.42k|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|  7.42k|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
   37|       |  /* transform along z */
   38|    580|  for (y = 0; y < 4; y++)
  ------------------
  |  Branch (38:15): [True: 464, False: 116]
  ------------------
   39|  2.32k|    for (x = 0; x < 4; x++)
  ------------------
  |  Branch (39:17): [True: 1.85k, False: 464]
  ------------------
   40|  9.28k|      for (w = 0; w < 4; w++)
  ------------------
  |  Branch (40:19): [True: 7.42k, False: 1.85k]
  ------------------
   41|  7.42k|        _t1(inv_lift, Int)(p + 64 * w + 1 * x + 4 * y, 16);
  ------------------
  |  |    9|  7.42k|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|  7.42k|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
   42|       |  /* transform along y */
   43|    580|  for (x = 0; x < 4; x++)
  ------------------
  |  Branch (43:15): [True: 464, False: 116]
  ------------------
   44|  2.32k|    for (w = 0; w < 4; w++)
  ------------------
  |  Branch (44:17): [True: 1.85k, False: 464]
  ------------------
   45|  9.28k|      for (z = 0; z < 4; z++)
  ------------------
  |  Branch (45:19): [True: 7.42k, False: 1.85k]
  ------------------
   46|  7.42k|        _t1(inv_lift, Int)(p + 16 * z + 64 * w + 1 * x, 4);
  ------------------
  |  |    9|  7.42k|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|  7.42k|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
   47|       |  /* transform along x */
   48|    580|  for (w = 0; w < 4; w++)
  ------------------
  |  Branch (48:15): [True: 464, False: 116]
  ------------------
   49|  2.32k|    for (z = 0; z < 4; z++)
  ------------------
  |  Branch (49:17): [True: 1.85k, False: 464]
  ------------------
   50|  9.28k|      for (y = 0; y < 4; y++)
  ------------------
  |  Branch (50:19): [True: 7.42k, False: 1.85k]
  ------------------
   51|  7.42k|        _t1(inv_lift, Int)(p + 4 * y + 16 * z + 64 * w, 1);
  ------------------
  |  |    9|  7.42k|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|  7.42k|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
   52|    116|}
decode4f.c:scatter_float_4:
    6|    120|{
    7|    120|  uint x, y, z, w;
    8|    600|  for (w = 0; w < 4; w++, p += sw - 4 * sz)
  ------------------
  |  Branch (8:15): [True: 480, False: 120]
  ------------------
    9|  2.40k|    for (z = 0; z < 4; z++, p += sz - 4 * sy)
  ------------------
  |  Branch (9:17): [True: 1.92k, False: 480]
  ------------------
   10|  9.60k|      for (y = 0; y < 4; y++, p += sy - 4 * sx)
  ------------------
  |  Branch (10:19): [True: 7.68k, False: 1.92k]
  ------------------
   11|  38.4k|        for (x = 0; x < 4; x++, p += sx)
  ------------------
  |  Branch (11:21): [True: 30.7k, False: 7.68k]
  ------------------
   12|  30.7k|          *p = *q++;
   13|    120|}
zfp_decode_block_strided_double_4:
   59|     14|{
   60|       |  /* decode contiguous block */
   61|     14|  cache_align_(Scalar block[256]);
  ------------------
  |  |   42|     14|  #define cache_align_(x) x __attribute__((aligned(ZFP_CACHE_LINE_SIZE)))
  ------------------
   62|     14|  size_t bits = _t2(zfp_decode_block, Scalar, 4)(stream, block);
  ------------------
  |  |   10|     14|#define _t2(function, type, dims) _cat3(function, type, dims)
  |  |  ------------------
  |  |  |  |    6|     14|#define _cat3(x, y, z) x ## _ ## y ## _ ## z
  |  |  ------------------
  ------------------
   63|       |  /* scatter block to strided array */
   64|     14|  _t2(scatter, Scalar, 4)(block, p, sx, sy, sz, sw);
  ------------------
  |  |   10|     14|#define _t2(function, type, dims) _cat3(function, type, dims)
  |  |  ------------------
  |  |  |  |    6|     14|#define _cat3(x, y, z) x ## _ ## y ## _ ## z
  |  |  ------------------
  ------------------
   65|     14|  return bits;
   66|     14|}
decode4d.c:scatter_double_4:
    6|     14|{
    7|     14|  uint x, y, z, w;
    8|     70|  for (w = 0; w < 4; w++, p += sw - 4 * sz)
  ------------------
  |  Branch (8:15): [True: 56, False: 14]
  ------------------
    9|    280|    for (z = 0; z < 4; z++, p += sz - 4 * sy)
  ------------------
  |  Branch (9:17): [True: 224, False: 56]
  ------------------
   10|  1.12k|      for (y = 0; y < 4; y++, p += sy - 4 * sx)
  ------------------
  |  Branch (10:19): [True: 896, False: 224]
  ------------------
   11|  4.48k|        for (x = 0; x < 4; x++, p += sx)
  ------------------
  |  Branch (11:21): [True: 3.58k, False: 896]
  ------------------
   12|  3.58k|          *p = *q++;
   13|     14|}

zfp_decode_block_double_2:
   42|      4|{
   43|      4|  return REVERSIBLE(zfp) ? _t2(rev_decode_block, Scalar, DIMS)(zfp, fblock) : _t2(decode_block, Scalar, DIMS)(zfp, fblock);
  ------------------
  |  |    4|      4|#define REVERSIBLE(zfp) ((zfp)->minexp < ZFP_MIN_EXP) /* reversible mode? */
  |  |  ------------------
  |  |  |  |   21|      4|#define ZFP_MIN_EXP  -1074 /* minimum floating-point base-2 exponent */
  |  |  ------------------
  |  |  |  Branch (4:25): [True: 0, False: 4]
  |  |  ------------------
  ------------------
                return REVERSIBLE(zfp) ? _t2(rev_decode_block, Scalar, DIMS)(zfp, fblock) : _t2(decode_block, Scalar, DIMS)(zfp, fblock);
  ------------------
  |  |   10|      0|#define _t2(function, type, dims) _cat3(function, type, dims)
  |  |  ------------------
  |  |  |  |    6|      0|#define _cat3(x, y, z) x ## _ ## y ## _ ## z
  |  |  ------------------
  ------------------
                return REVERSIBLE(zfp) ? _t2(rev_decode_block, Scalar, DIMS)(zfp, fblock) : _t2(decode_block, Scalar, DIMS)(zfp, fblock);
  ------------------
  |  |   10|      4|#define _t2(function, type, dims) _cat3(function, type, dims)
  |  |  ------------------
  |  |  |  |    6|      4|#define _cat3(x, y, z) x ## _ ## y ## _ ## z
  |  |  ------------------
  ------------------
   44|      4|}
decode2d.c:decode_block_double_2:
    8|      4|{
    9|      4|  uint bits = 1;
   10|       |  /* test if block has nonzero values */
   11|      4|  if (stream_read_bit(zfp->stream)) {
  ------------------
  |  Branch (11:7): [True: 4, False: 0]
  ------------------
   12|      4|    cache_align_(Int iblock[BLOCK_SIZE]);
  ------------------
  |  |   42|      4|  #define cache_align_(x) x __attribute__((aligned(ZFP_CACHE_LINE_SIZE)))
  ------------------
   13|      4|    uint maxprec;
   14|      4|    int emax;
   15|       |    /* decode common exponent */
   16|      4|    bits += EBITS;
  ------------------
  |  |    6|      4|#define EBITS 11                           /* number of exponent bits */
  ------------------
   17|      4|    emax = (int)stream_read_bits(zfp->stream, EBITS) - EBIAS;
  ------------------
  |  |    6|      4|#define EBITS 11                           /* number of exponent bits */
  ------------------
                  emax = (int)stream_read_bits(zfp->stream, EBITS) - EBIAS;
  ------------------
  |  |    3|      4|#define EBIAS ((1 << (EBITS - 1)) - 1) /* exponent bias */
  |  |  ------------------
  |  |  |  |    6|      4|#define EBITS 11                           /* number of exponent bits */
  |  |  ------------------
  ------------------
   18|      4|    maxprec = precision(emax, zfp->maxprec, zfp->minexp, DIMS);
  ------------------
  |  |    1|      4|#define DIMS 2
  ------------------
   19|       |    /* decode integer block */
   20|      4|    bits += _t2(decode_block, Int, DIMS)(zfp->stream, zfp->minbits - MIN(bits, zfp->minbits), zfp->maxbits - bits, maxprec, iblock);
  ------------------
  |  |   10|      4|#define _t2(function, type, dims) _cat3(function, type, dims)
  |  |  ------------------
  |  |  |  |    6|      4|#define _cat3(x, y, z) x ## _ ## y ## _ ## z
  |  |  ------------------
  ------------------
                  bits += _t2(decode_block, Int, DIMS)(zfp->stream, zfp->minbits - MIN(bits, zfp->minbits), zfp->maxbits - bits, maxprec, iblock);
  ------------------
  |  |    4|      4|#define MIN(x, y) ((x) < (y) ? (x) : (y))
  |  |  ------------------
  |  |  |  Branch (4:20): [True: 0, False: 4]
  |  |  ------------------
  ------------------
   21|       |    /* perform inverse block-floating-point transform */
   22|      4|    _t1(inv_cast, Scalar)(iblock, fblock, BLOCK_SIZE, emax);
  ------------------
  |  |    9|      4|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|      4|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
                  _t1(inv_cast, Scalar)(iblock, fblock, BLOCK_SIZE, emax);
  ------------------
  |  |    2|      4|#define BLOCK_SIZE (1 << (2 * DIMS))   /* values per block */
  |  |  ------------------
  |  |  |  |    1|      4|#define DIMS 2
  |  |  ------------------
  ------------------
   23|      4|  }
   24|      0|  else {
   25|       |    /* set all values to zero */
   26|      0|    uint i;
   27|      0|    for (i = 0; i < BLOCK_SIZE; i++)
  ------------------
  |  |    2|      0|#define BLOCK_SIZE (1 << (2 * DIMS))   /* values per block */
  |  |  ------------------
  |  |  |  |    1|      0|#define DIMS 2
  |  |  ------------------
  ------------------
  |  Branch (27:17): [True: 0, False: 0]
  ------------------
   28|      0|      *fblock++ = 0;
   29|      0|    if (zfp->minbits > bits) {
  ------------------
  |  Branch (29:9): [True: 0, False: 0]
  ------------------
   30|      0|      stream_skip(zfp->stream, zfp->minbits - bits);
   31|      0|      bits = zfp->minbits;
   32|      0|    }
   33|      0|  }
   34|      4|  return bits;
   35|      4|}
zfp_decode_block_float_3:
   42|     56|{
   43|     56|  return REVERSIBLE(zfp) ? _t2(rev_decode_block, Scalar, DIMS)(zfp, fblock) : _t2(decode_block, Scalar, DIMS)(zfp, fblock);
  ------------------
  |  |    4|     56|#define REVERSIBLE(zfp) ((zfp)->minexp < ZFP_MIN_EXP) /* reversible mode? */
  |  |  ------------------
  |  |  |  |   21|     56|#define ZFP_MIN_EXP  -1074 /* minimum floating-point base-2 exponent */
  |  |  ------------------
  |  |  |  Branch (4:25): [True: 0, False: 56]
  |  |  ------------------
  ------------------
                return REVERSIBLE(zfp) ? _t2(rev_decode_block, Scalar, DIMS)(zfp, fblock) : _t2(decode_block, Scalar, DIMS)(zfp, fblock);
  ------------------
  |  |   10|      0|#define _t2(function, type, dims) _cat3(function, type, dims)
  |  |  ------------------
  |  |  |  |    6|      0|#define _cat3(x, y, z) x ## _ ## y ## _ ## z
  |  |  ------------------
  ------------------
                return REVERSIBLE(zfp) ? _t2(rev_decode_block, Scalar, DIMS)(zfp, fblock) : _t2(decode_block, Scalar, DIMS)(zfp, fblock);
  ------------------
  |  |   10|     56|#define _t2(function, type, dims) _cat3(function, type, dims)
  |  |  ------------------
  |  |  |  |    6|     56|#define _cat3(x, y, z) x ## _ ## y ## _ ## z
  |  |  ------------------
  ------------------
   44|     56|}
decode3f.c:decode_block_float_3:
    8|     56|{
    9|     56|  uint bits = 1;
   10|       |  /* test if block has nonzero values */
   11|     56|  if (stream_read_bit(zfp->stream)) {
  ------------------
  |  Branch (11:7): [True: 52, False: 4]
  ------------------
   12|     52|    cache_align_(Int iblock[BLOCK_SIZE]);
  ------------------
  |  |   42|     52|  #define cache_align_(x) x __attribute__((aligned(ZFP_CACHE_LINE_SIZE)))
  ------------------
   13|     52|    uint maxprec;
   14|     52|    int emax;
   15|       |    /* decode common exponent */
   16|     52|    bits += EBITS;
  ------------------
  |  |    6|     52|#define EBITS 8            /* number of exponent bits */
  ------------------
   17|     52|    emax = (int)stream_read_bits(zfp->stream, EBITS) - EBIAS;
  ------------------
  |  |    6|     52|#define EBITS 8            /* number of exponent bits */
  ------------------
                  emax = (int)stream_read_bits(zfp->stream, EBITS) - EBIAS;
  ------------------
  |  |    3|     52|#define EBIAS ((1 << (EBITS - 1)) - 1) /* exponent bias */
  |  |  ------------------
  |  |  |  |    6|     52|#define EBITS 8            /* number of exponent bits */
  |  |  ------------------
  ------------------
   18|     52|    maxprec = precision(emax, zfp->maxprec, zfp->minexp, DIMS);
  ------------------
  |  |    1|     52|#define DIMS 3
  ------------------
   19|       |    /* decode integer block */
   20|     52|    bits += _t2(decode_block, Int, DIMS)(zfp->stream, zfp->minbits - MIN(bits, zfp->minbits), zfp->maxbits - bits, maxprec, iblock);
  ------------------
  |  |   10|     52|#define _t2(function, type, dims) _cat3(function, type, dims)
  |  |  ------------------
  |  |  |  |    6|     52|#define _cat3(x, y, z) x ## _ ## y ## _ ## z
  |  |  ------------------
  ------------------
                  bits += _t2(decode_block, Int, DIMS)(zfp->stream, zfp->minbits - MIN(bits, zfp->minbits), zfp->maxbits - bits, maxprec, iblock);
  ------------------
  |  |    4|     52|#define MIN(x, y) ((x) < (y) ? (x) : (y))
  |  |  ------------------
  |  |  |  Branch (4:20): [True: 18, False: 34]
  |  |  ------------------
  ------------------
   21|       |    /* perform inverse block-floating-point transform */
   22|     52|    _t1(inv_cast, Scalar)(iblock, fblock, BLOCK_SIZE, emax);
  ------------------
  |  |    9|     52|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|     52|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
                  _t1(inv_cast, Scalar)(iblock, fblock, BLOCK_SIZE, emax);
  ------------------
  |  |    2|     52|#define BLOCK_SIZE (1 << (2 * DIMS))   /* values per block */
  |  |  ------------------
  |  |  |  |    1|     52|#define DIMS 3
  |  |  ------------------
  ------------------
   23|     52|  }
   24|      4|  else {
   25|       |    /* set all values to zero */
   26|      4|    uint i;
   27|    260|    for (i = 0; i < BLOCK_SIZE; i++)
  ------------------
  |  |    2|    260|#define BLOCK_SIZE (1 << (2 * DIMS))   /* values per block */
  |  |  ------------------
  |  |  |  |    1|    260|#define DIMS 3
  |  |  ------------------
  ------------------
  |  Branch (27:17): [True: 256, False: 4]
  ------------------
   28|    256|      *fblock++ = 0;
   29|      4|    if (zfp->minbits > bits) {
  ------------------
  |  Branch (29:9): [True: 0, False: 4]
  ------------------
   30|      0|      stream_skip(zfp->stream, zfp->minbits - bits);
   31|      0|      bits = zfp->minbits;
   32|      0|    }
   33|      4|  }
   34|     56|  return bits;
   35|     56|}
zfp_decode_block_double_3:
   42|     64|{
   43|     64|  return REVERSIBLE(zfp) ? _t2(rev_decode_block, Scalar, DIMS)(zfp, fblock) : _t2(decode_block, Scalar, DIMS)(zfp, fblock);
  ------------------
  |  |    4|     64|#define REVERSIBLE(zfp) ((zfp)->minexp < ZFP_MIN_EXP) /* reversible mode? */
  |  |  ------------------
  |  |  |  |   21|     64|#define ZFP_MIN_EXP  -1074 /* minimum floating-point base-2 exponent */
  |  |  ------------------
  |  |  |  Branch (4:25): [True: 0, False: 64]
  |  |  ------------------
  ------------------
                return REVERSIBLE(zfp) ? _t2(rev_decode_block, Scalar, DIMS)(zfp, fblock) : _t2(decode_block, Scalar, DIMS)(zfp, fblock);
  ------------------
  |  |   10|      0|#define _t2(function, type, dims) _cat3(function, type, dims)
  |  |  ------------------
  |  |  |  |    6|      0|#define _cat3(x, y, z) x ## _ ## y ## _ ## z
  |  |  ------------------
  ------------------
                return REVERSIBLE(zfp) ? _t2(rev_decode_block, Scalar, DIMS)(zfp, fblock) : _t2(decode_block, Scalar, DIMS)(zfp, fblock);
  ------------------
  |  |   10|     64|#define _t2(function, type, dims) _cat3(function, type, dims)
  |  |  ------------------
  |  |  |  |    6|     64|#define _cat3(x, y, z) x ## _ ## y ## _ ## z
  |  |  ------------------
  ------------------
   44|     64|}
decode3d.c:decode_block_double_3:
    8|     64|{
    9|     64|  uint bits = 1;
   10|       |  /* test if block has nonzero values */
   11|     64|  if (stream_read_bit(zfp->stream)) {
  ------------------
  |  Branch (11:7): [True: 64, False: 0]
  ------------------
   12|     64|    cache_align_(Int iblock[BLOCK_SIZE]);
  ------------------
  |  |   42|     64|  #define cache_align_(x) x __attribute__((aligned(ZFP_CACHE_LINE_SIZE)))
  ------------------
   13|     64|    uint maxprec;
   14|     64|    int emax;
   15|       |    /* decode common exponent */
   16|     64|    bits += EBITS;
  ------------------
  |  |    6|     64|#define EBITS 11                           /* number of exponent bits */
  ------------------
   17|     64|    emax = (int)stream_read_bits(zfp->stream, EBITS) - EBIAS;
  ------------------
  |  |    6|     64|#define EBITS 11                           /* number of exponent bits */
  ------------------
                  emax = (int)stream_read_bits(zfp->stream, EBITS) - EBIAS;
  ------------------
  |  |    3|     64|#define EBIAS ((1 << (EBITS - 1)) - 1) /* exponent bias */
  |  |  ------------------
  |  |  |  |    6|     64|#define EBITS 11                           /* number of exponent bits */
  |  |  ------------------
  ------------------
   18|     64|    maxprec = precision(emax, zfp->maxprec, zfp->minexp, DIMS);
  ------------------
  |  |    1|     64|#define DIMS 3
  ------------------
   19|       |    /* decode integer block */
   20|     64|    bits += _t2(decode_block, Int, DIMS)(zfp->stream, zfp->minbits - MIN(bits, zfp->minbits), zfp->maxbits - bits, maxprec, iblock);
  ------------------
  |  |   10|     64|#define _t2(function, type, dims) _cat3(function, type, dims)
  |  |  ------------------
  |  |  |  |    6|     64|#define _cat3(x, y, z) x ## _ ## y ## _ ## z
  |  |  ------------------
  ------------------
                  bits += _t2(decode_block, Int, DIMS)(zfp->stream, zfp->minbits - MIN(bits, zfp->minbits), zfp->maxbits - bits, maxprec, iblock);
  ------------------
  |  |    4|     64|#define MIN(x, y) ((x) < (y) ? (x) : (y))
  |  |  ------------------
  |  |  |  Branch (4:20): [True: 32, False: 32]
  |  |  ------------------
  ------------------
   21|       |    /* perform inverse block-floating-point transform */
   22|     64|    _t1(inv_cast, Scalar)(iblock, fblock, BLOCK_SIZE, emax);
  ------------------
  |  |    9|     64|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|     64|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
                  _t1(inv_cast, Scalar)(iblock, fblock, BLOCK_SIZE, emax);
  ------------------
  |  |    2|     64|#define BLOCK_SIZE (1 << (2 * DIMS))   /* values per block */
  |  |  ------------------
  |  |  |  |    1|     64|#define DIMS 3
  |  |  ------------------
  ------------------
   23|     64|  }
   24|      0|  else {
   25|       |    /* set all values to zero */
   26|      0|    uint i;
   27|      0|    for (i = 0; i < BLOCK_SIZE; i++)
  ------------------
  |  |    2|      0|#define BLOCK_SIZE (1 << (2 * DIMS))   /* values per block */
  |  |  ------------------
  |  |  |  |    1|      0|#define DIMS 3
  |  |  ------------------
  ------------------
  |  Branch (27:17): [True: 0, False: 0]
  ------------------
   28|      0|      *fblock++ = 0;
   29|      0|    if (zfp->minbits > bits) {
  ------------------
  |  Branch (29:9): [True: 0, False: 0]
  ------------------
   30|      0|      stream_skip(zfp->stream, zfp->minbits - bits);
   31|      0|      bits = zfp->minbits;
   32|      0|    }
   33|      0|  }
   34|     64|  return bits;
   35|     64|}
zfp_decode_block_float_4:
   42|    120|{
   43|    120|  return REVERSIBLE(zfp) ? _t2(rev_decode_block, Scalar, DIMS)(zfp, fblock) : _t2(decode_block, Scalar, DIMS)(zfp, fblock);
  ------------------
  |  |    4|    120|#define REVERSIBLE(zfp) ((zfp)->minexp < ZFP_MIN_EXP) /* reversible mode? */
  |  |  ------------------
  |  |  |  |   21|    120|#define ZFP_MIN_EXP  -1074 /* minimum floating-point base-2 exponent */
  |  |  ------------------
  |  |  |  Branch (4:25): [True: 0, False: 120]
  |  |  ------------------
  ------------------
                return REVERSIBLE(zfp) ? _t2(rev_decode_block, Scalar, DIMS)(zfp, fblock) : _t2(decode_block, Scalar, DIMS)(zfp, fblock);
  ------------------
  |  |   10|      0|#define _t2(function, type, dims) _cat3(function, type, dims)
  |  |  ------------------
  |  |  |  |    6|      0|#define _cat3(x, y, z) x ## _ ## y ## _ ## z
  |  |  ------------------
  ------------------
                return REVERSIBLE(zfp) ? _t2(rev_decode_block, Scalar, DIMS)(zfp, fblock) : _t2(decode_block, Scalar, DIMS)(zfp, fblock);
  ------------------
  |  |   10|    120|#define _t2(function, type, dims) _cat3(function, type, dims)
  |  |  ------------------
  |  |  |  |    6|    120|#define _cat3(x, y, z) x ## _ ## y ## _ ## z
  |  |  ------------------
  ------------------
   44|    120|}
decode4f.c:decode_block_float_4:
    8|    120|{
    9|    120|  uint bits = 1;
   10|       |  /* test if block has nonzero values */
   11|    120|  if (stream_read_bit(zfp->stream)) {
  ------------------
  |  Branch (11:7): [True: 116, False: 4]
  ------------------
   12|    116|    cache_align_(Int iblock[BLOCK_SIZE]);
  ------------------
  |  |   42|    116|  #define cache_align_(x) x __attribute__((aligned(ZFP_CACHE_LINE_SIZE)))
  ------------------
   13|    116|    uint maxprec;
   14|    116|    int emax;
   15|       |    /* decode common exponent */
   16|    116|    bits += EBITS;
  ------------------
  |  |    6|    116|#define EBITS 8            /* number of exponent bits */
  ------------------
   17|    116|    emax = (int)stream_read_bits(zfp->stream, EBITS) - EBIAS;
  ------------------
  |  |    6|    116|#define EBITS 8            /* number of exponent bits */
  ------------------
                  emax = (int)stream_read_bits(zfp->stream, EBITS) - EBIAS;
  ------------------
  |  |    3|    116|#define EBIAS ((1 << (EBITS - 1)) - 1) /* exponent bias */
  |  |  ------------------
  |  |  |  |    6|    116|#define EBITS 8            /* number of exponent bits */
  |  |  ------------------
  ------------------
   18|    116|    maxprec = precision(emax, zfp->maxprec, zfp->minexp, DIMS);
  ------------------
  |  |    1|    116|#define DIMS 4
  ------------------
   19|       |    /* decode integer block */
   20|    116|    bits += _t2(decode_block, Int, DIMS)(zfp->stream, zfp->minbits - MIN(bits, zfp->minbits), zfp->maxbits - bits, maxprec, iblock);
  ------------------
  |  |   10|    116|#define _t2(function, type, dims) _cat3(function, type, dims)
  |  |  ------------------
  |  |  |  |    6|    116|#define _cat3(x, y, z) x ## _ ## y ## _ ## z
  |  |  ------------------
  ------------------
                  bits += _t2(decode_block, Int, DIMS)(zfp->stream, zfp->minbits - MIN(bits, zfp->minbits), zfp->maxbits - bits, maxprec, iblock);
  ------------------
  |  |    4|    116|#define MIN(x, y) ((x) < (y) ? (x) : (y))
  |  |  ------------------
  |  |  |  Branch (4:20): [True: 44, False: 72]
  |  |  ------------------
  ------------------
   21|       |    /* perform inverse block-floating-point transform */
   22|    116|    _t1(inv_cast, Scalar)(iblock, fblock, BLOCK_SIZE, emax);
  ------------------
  |  |    9|    116|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|    116|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
                  _t1(inv_cast, Scalar)(iblock, fblock, BLOCK_SIZE, emax);
  ------------------
  |  |    2|    116|#define BLOCK_SIZE (1 << (2 * DIMS))   /* values per block */
  |  |  ------------------
  |  |  |  |    1|    116|#define DIMS 4
  |  |  ------------------
  ------------------
   23|    116|  }
   24|      4|  else {
   25|       |    /* set all values to zero */
   26|      4|    uint i;
   27|  1.02k|    for (i = 0; i < BLOCK_SIZE; i++)
  ------------------
  |  |    2|  1.02k|#define BLOCK_SIZE (1 << (2 * DIMS))   /* values per block */
  |  |  ------------------
  |  |  |  |    1|  1.02k|#define DIMS 4
  |  |  ------------------
  ------------------
  |  Branch (27:17): [True: 1.02k, False: 4]
  ------------------
   28|  1.02k|      *fblock++ = 0;
   29|      4|    if (zfp->minbits > bits) {
  ------------------
  |  Branch (29:9): [True: 4, False: 0]
  ------------------
   30|      4|      stream_skip(zfp->stream, zfp->minbits - bits);
   31|      4|      bits = zfp->minbits;
   32|      4|    }
   33|      4|  }
   34|    120|  return bits;
   35|    120|}
zfp_decode_block_double_4:
   42|     14|{
   43|     14|  return REVERSIBLE(zfp) ? _t2(rev_decode_block, Scalar, DIMS)(zfp, fblock) : _t2(decode_block, Scalar, DIMS)(zfp, fblock);
  ------------------
  |  |    4|     14|#define REVERSIBLE(zfp) ((zfp)->minexp < ZFP_MIN_EXP) /* reversible mode? */
  |  |  ------------------
  |  |  |  |   21|     14|#define ZFP_MIN_EXP  -1074 /* minimum floating-point base-2 exponent */
  |  |  ------------------
  |  |  |  Branch (4:25): [True: 0, False: 14]
  |  |  ------------------
  ------------------
                return REVERSIBLE(zfp) ? _t2(rev_decode_block, Scalar, DIMS)(zfp, fblock) : _t2(decode_block, Scalar, DIMS)(zfp, fblock);
  ------------------
  |  |   10|      0|#define _t2(function, type, dims) _cat3(function, type, dims)
  |  |  ------------------
  |  |  |  |    6|      0|#define _cat3(x, y, z) x ## _ ## y ## _ ## z
  |  |  ------------------
  ------------------
                return REVERSIBLE(zfp) ? _t2(rev_decode_block, Scalar, DIMS)(zfp, fblock) : _t2(decode_block, Scalar, DIMS)(zfp, fblock);
  ------------------
  |  |   10|     14|#define _t2(function, type, dims) _cat3(function, type, dims)
  |  |  ------------------
  |  |  |  |    6|     14|#define _cat3(x, y, z) x ## _ ## y ## _ ## z
  |  |  ------------------
  ------------------
   44|     14|}
decode4d.c:decode_block_double_4:
    8|     14|{
    9|     14|  uint bits = 1;
   10|       |  /* test if block has nonzero values */
   11|     14|  if (stream_read_bit(zfp->stream)) {
  ------------------
  |  Branch (11:7): [True: 0, False: 14]
  ------------------
   12|      0|    cache_align_(Int iblock[BLOCK_SIZE]);
  ------------------
  |  |   42|      0|  #define cache_align_(x) x __attribute__((aligned(ZFP_CACHE_LINE_SIZE)))
  ------------------
   13|      0|    uint maxprec;
   14|      0|    int emax;
   15|       |    /* decode common exponent */
   16|      0|    bits += EBITS;
  ------------------
  |  |    6|      0|#define EBITS 11                           /* number of exponent bits */
  ------------------
   17|      0|    emax = (int)stream_read_bits(zfp->stream, EBITS) - EBIAS;
  ------------------
  |  |    6|      0|#define EBITS 11                           /* number of exponent bits */
  ------------------
                  emax = (int)stream_read_bits(zfp->stream, EBITS) - EBIAS;
  ------------------
  |  |    3|      0|#define EBIAS ((1 << (EBITS - 1)) - 1) /* exponent bias */
  |  |  ------------------
  |  |  |  |    6|      0|#define EBITS 11                           /* number of exponent bits */
  |  |  ------------------
  ------------------
   18|      0|    maxprec = precision(emax, zfp->maxprec, zfp->minexp, DIMS);
  ------------------
  |  |    1|      0|#define DIMS 4
  ------------------
   19|       |    /* decode integer block */
   20|      0|    bits += _t2(decode_block, Int, DIMS)(zfp->stream, zfp->minbits - MIN(bits, zfp->minbits), zfp->maxbits - bits, maxprec, iblock);
  ------------------
  |  |   10|      0|#define _t2(function, type, dims) _cat3(function, type, dims)
  |  |  ------------------
  |  |  |  |    6|      0|#define _cat3(x, y, z) x ## _ ## y ## _ ## z
  |  |  ------------------
  ------------------
                  bits += _t2(decode_block, Int, DIMS)(zfp->stream, zfp->minbits - MIN(bits, zfp->minbits), zfp->maxbits - bits, maxprec, iblock);
  ------------------
  |  |    4|      0|#define MIN(x, y) ((x) < (y) ? (x) : (y))
  |  |  ------------------
  |  |  |  Branch (4:20): [True: 0, False: 0]
  |  |  ------------------
  ------------------
   21|       |    /* perform inverse block-floating-point transform */
   22|      0|    _t1(inv_cast, Scalar)(iblock, fblock, BLOCK_SIZE, emax);
  ------------------
  |  |    9|      0|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|      0|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
                  _t1(inv_cast, Scalar)(iblock, fblock, BLOCK_SIZE, emax);
  ------------------
  |  |    2|      0|#define BLOCK_SIZE (1 << (2 * DIMS))   /* values per block */
  |  |  ------------------
  |  |  |  |    1|      0|#define DIMS 4
  |  |  ------------------
  ------------------
   23|      0|  }
   24|     14|  else {
   25|       |    /* set all values to zero */
   26|     14|    uint i;
   27|  3.59k|    for (i = 0; i < BLOCK_SIZE; i++)
  ------------------
  |  |    2|  3.59k|#define BLOCK_SIZE (1 << (2 * DIMS))   /* values per block */
  |  |  ------------------
  |  |  |  |    1|  3.59k|#define DIMS 4
  |  |  ------------------
  ------------------
  |  Branch (27:17): [True: 3.58k, False: 14]
  ------------------
   28|  3.58k|      *fblock++ = 0;
   29|     14|    if (zfp->minbits > bits) {
  ------------------
  |  Branch (29:9): [True: 0, False: 14]
  ------------------
   30|      0|      stream_skip(zfp->stream, zfp->minbits - bits);
   31|      0|      bits = zfp->minbits;
   32|      0|    }
   33|     14|  }
   34|     14|  return bits;
   35|     14|}

zfp.c:decompress_strided_double_2:
   39|      4|{
   40|      4|  Scalar* data = (Scalar*)field->data;
  ------------------
  |  |   78|      4|#define Scalar double
  ------------------
   41|      4|  size_t nx = field->nx;
   42|      4|  size_t ny = field->ny;
   43|      4|  ptrdiff_t sx = field->sx ? field->sx : 1;
  ------------------
  |  Branch (43:18): [True: 0, False: 4]
  ------------------
   44|      4|  ptrdiff_t sy = field->sy ? field->sy : (ptrdiff_t)nx;
  ------------------
  |  Branch (44:18): [True: 0, False: 4]
  ------------------
   45|      4|  size_t x, y;
   46|       |
   47|       |  /* decompress array one block of 4x4 values at a time */
   48|      8|  for (y = 0; y < ny; y += 4)
  ------------------
  |  Branch (48:15): [True: 4, False: 4]
  ------------------
   49|      8|    for (x = 0; x < nx; x += 4) {
  ------------------
  |  Branch (49:17): [True: 4, False: 4]
  ------------------
   50|      4|      Scalar* p = data + sx * (ptrdiff_t)x + sy * (ptrdiff_t)y;
  ------------------
  |  |   78|      4|#define Scalar double
  ------------------
   51|      4|      if (nx - x < 4 || ny - y < 4)
  ------------------
  |  Branch (51:11): [True: 0, False: 4]
  |  Branch (51:25): [True: 0, False: 4]
  ------------------
   52|      0|        _t2(zfp_decode_partial_block_strided, Scalar, 2)(stream, p, MIN(nx - x, 4u), MIN(ny - y, 4u), sx, sy);
  ------------------
  |  |   10|      0|#define _t2(function, type, dims) _cat3(function, type, dims)
  |  |  ------------------
  |  |  |  |    6|      0|#define _cat3(x, y, z) x ## _ ## y ## _ ## z
  |  |  ------------------
  ------------------
                      _t2(zfp_decode_partial_block_strided, Scalar, 2)(stream, p, MIN(nx - x, 4u), MIN(ny - y, 4u), sx, sy);
  ------------------
  |  |    4|      0|#define MIN(x, y) ((x) < (y) ? (x) : (y))
  |  |  ------------------
  |  |  |  Branch (4:20): [True: 0, False: 0]
  |  |  ------------------
  ------------------
                      _t2(zfp_decode_partial_block_strided, Scalar, 2)(stream, p, MIN(nx - x, 4u), MIN(ny - y, 4u), sx, sy);
  ------------------
  |  |    4|      0|#define MIN(x, y) ((x) < (y) ? (x) : (y))
  |  |  ------------------
  |  |  |  Branch (4:20): [True: 0, False: 0]
  |  |  ------------------
  ------------------
   53|      4|      else
   54|      4|        _t2(zfp_decode_block_strided, Scalar, 2)(stream, p, sx, sy);
  ------------------
  |  |   10|      4|#define _t2(function, type, dims) _cat3(function, type, dims)
  |  |  ------------------
  |  |  |  |    6|      4|#define _cat3(x, y, z) x ## _ ## y ## _ ## z
  |  |  ------------------
  ------------------
   55|      4|    }
   56|      4|}
zfp.c:decompress_strided_float_3:
   61|     56|{
   62|     56|  Scalar* data = (Scalar*)field->data;
  ------------------
  |  |   70|     56|#define Scalar float
  ------------------
   63|     56|  size_t nx = field->nx;
   64|     56|  size_t ny = field->ny;
   65|     56|  size_t nz = field->nz;
   66|     56|  ptrdiff_t sx = field->sx ? field->sx : 1;
  ------------------
  |  Branch (66:18): [True: 0, False: 56]
  ------------------
   67|     56|  ptrdiff_t sy = field->sy ? field->sy : (ptrdiff_t)nx;
  ------------------
  |  Branch (67:18): [True: 0, False: 56]
  ------------------
   68|     56|  ptrdiff_t sz = field->sz ? field->sz : (ptrdiff_t)(nx * ny);
  ------------------
  |  Branch (68:18): [True: 0, False: 56]
  ------------------
   69|     56|  size_t x, y, z;
   70|       |
   71|       |  /* decompress array one block of 4x4x4 values at a time */
   72|    112|  for (z = 0; z < nz; z += 4)
  ------------------
  |  Branch (72:15): [True: 56, False: 56]
  ------------------
   73|    112|    for (y = 0; y < ny; y += 4)
  ------------------
  |  Branch (73:17): [True: 56, False: 56]
  ------------------
   74|    112|      for (x = 0; x < nx; x += 4) {
  ------------------
  |  Branch (74:19): [True: 56, False: 56]
  ------------------
   75|     56|        Scalar* p = data + sx * (ptrdiff_t)x + sy * (ptrdiff_t)y + sz * (ptrdiff_t)z;
  ------------------
  |  |   70|     56|#define Scalar float
  ------------------
   76|     56|        if (nx - x < 4 || ny - y < 4 || nz - z < 4)
  ------------------
  |  Branch (76:13): [True: 0, False: 56]
  |  Branch (76:27): [True: 0, False: 56]
  |  Branch (76:41): [True: 0, False: 56]
  ------------------
   77|      0|          _t2(zfp_decode_partial_block_strided, Scalar, 3)(stream, p, MIN(nx - x, 4u), MIN(ny - y, 4u), MIN(nz - z, 4u), sx, sy, sz);
  ------------------
  |  |   10|      0|#define _t2(function, type, dims) _cat3(function, type, dims)
  |  |  ------------------
  |  |  |  |    6|      0|#define _cat3(x, y, z) x ## _ ## y ## _ ## z
  |  |  ------------------
  ------------------
                        _t2(zfp_decode_partial_block_strided, Scalar, 3)(stream, p, MIN(nx - x, 4u), MIN(ny - y, 4u), MIN(nz - z, 4u), sx, sy, sz);
  ------------------
  |  |    4|      0|#define MIN(x, y) ((x) < (y) ? (x) : (y))
  |  |  ------------------
  |  |  |  Branch (4:20): [True: 0, False: 0]
  |  |  ------------------
  ------------------
                        _t2(zfp_decode_partial_block_strided, Scalar, 3)(stream, p, MIN(nx - x, 4u), MIN(ny - y, 4u), MIN(nz - z, 4u), sx, sy, sz);
  ------------------
  |  |    4|      0|#define MIN(x, y) ((x) < (y) ? (x) : (y))
  |  |  ------------------
  |  |  |  Branch (4:20): [True: 0, False: 0]
  |  |  ------------------
  ------------------
                        _t2(zfp_decode_partial_block_strided, Scalar, 3)(stream, p, MIN(nx - x, 4u), MIN(ny - y, 4u), MIN(nz - z, 4u), sx, sy, sz);
  ------------------
  |  |    4|      0|#define MIN(x, y) ((x) < (y) ? (x) : (y))
  |  |  ------------------
  |  |  |  Branch (4:20): [True: 0, False: 0]
  |  |  ------------------
  ------------------
   78|     56|        else
   79|     56|          _t2(zfp_decode_block_strided, Scalar, 3)(stream, p, sx, sy, sz);
  ------------------
  |  |   10|     56|#define _t2(function, type, dims) _cat3(function, type, dims)
  |  |  ------------------
  |  |  |  |    6|     56|#define _cat3(x, y, z) x ## _ ## y ## _ ## z
  |  |  ------------------
  ------------------
   80|     56|      }
   81|     56|}
zfp.c:decompress_strided_double_3:
   61|     64|{
   62|     64|  Scalar* data = (Scalar*)field->data;
  ------------------
  |  |   78|     64|#define Scalar double
  ------------------
   63|     64|  size_t nx = field->nx;
   64|     64|  size_t ny = field->ny;
   65|     64|  size_t nz = field->nz;
   66|     64|  ptrdiff_t sx = field->sx ? field->sx : 1;
  ------------------
  |  Branch (66:18): [True: 0, False: 64]
  ------------------
   67|     64|  ptrdiff_t sy = field->sy ? field->sy : (ptrdiff_t)nx;
  ------------------
  |  Branch (67:18): [True: 0, False: 64]
  ------------------
   68|     64|  ptrdiff_t sz = field->sz ? field->sz : (ptrdiff_t)(nx * ny);
  ------------------
  |  Branch (68:18): [True: 0, False: 64]
  ------------------
   69|     64|  size_t x, y, z;
   70|       |
   71|       |  /* decompress array one block of 4x4x4 values at a time */
   72|    128|  for (z = 0; z < nz; z += 4)
  ------------------
  |  Branch (72:15): [True: 64, False: 64]
  ------------------
   73|    128|    for (y = 0; y < ny; y += 4)
  ------------------
  |  Branch (73:17): [True: 64, False: 64]
  ------------------
   74|    128|      for (x = 0; x < nx; x += 4) {
  ------------------
  |  Branch (74:19): [True: 64, False: 64]
  ------------------
   75|     64|        Scalar* p = data + sx * (ptrdiff_t)x + sy * (ptrdiff_t)y + sz * (ptrdiff_t)z;
  ------------------
  |  |   78|     64|#define Scalar double
  ------------------
   76|     64|        if (nx - x < 4 || ny - y < 4 || nz - z < 4)
  ------------------
  |  Branch (76:13): [True: 0, False: 64]
  |  Branch (76:27): [True: 0, False: 64]
  |  Branch (76:41): [True: 0, False: 64]
  ------------------
   77|      0|          _t2(zfp_decode_partial_block_strided, Scalar, 3)(stream, p, MIN(nx - x, 4u), MIN(ny - y, 4u), MIN(nz - z, 4u), sx, sy, sz);
  ------------------
  |  |   10|      0|#define _t2(function, type, dims) _cat3(function, type, dims)
  |  |  ------------------
  |  |  |  |    6|      0|#define _cat3(x, y, z) x ## _ ## y ## _ ## z
  |  |  ------------------
  ------------------
                        _t2(zfp_decode_partial_block_strided, Scalar, 3)(stream, p, MIN(nx - x, 4u), MIN(ny - y, 4u), MIN(nz - z, 4u), sx, sy, sz);
  ------------------
  |  |    4|      0|#define MIN(x, y) ((x) < (y) ? (x) : (y))
  |  |  ------------------
  |  |  |  Branch (4:20): [True: 0, False: 0]
  |  |  ------------------
  ------------------
                        _t2(zfp_decode_partial_block_strided, Scalar, 3)(stream, p, MIN(nx - x, 4u), MIN(ny - y, 4u), MIN(nz - z, 4u), sx, sy, sz);
  ------------------
  |  |    4|      0|#define MIN(x, y) ((x) < (y) ? (x) : (y))
  |  |  ------------------
  |  |  |  Branch (4:20): [True: 0, False: 0]
  |  |  ------------------
  ------------------
                        _t2(zfp_decode_partial_block_strided, Scalar, 3)(stream, p, MIN(nx - x, 4u), MIN(ny - y, 4u), MIN(nz - z, 4u), sx, sy, sz);
  ------------------
  |  |    4|      0|#define MIN(x, y) ((x) < (y) ? (x) : (y))
  |  |  ------------------
  |  |  |  Branch (4:20): [True: 0, False: 0]
  |  |  ------------------
  ------------------
   78|     64|        else
   79|     64|          _t2(zfp_decode_block_strided, Scalar, 3)(stream, p, sx, sy, sz);
  ------------------
  |  |   10|     64|#define _t2(function, type, dims) _cat3(function, type, dims)
  |  |  ------------------
  |  |  |  |    6|     64|#define _cat3(x, y, z) x ## _ ## y ## _ ## z
  |  |  ------------------
  ------------------
   80|     64|      }
   81|     64|}
zfp.c:decompress_strided_float_4:
   86|    120|{
   87|    120|  Scalar* data = field->data;
  ------------------
  |  |   70|    120|#define Scalar float
  ------------------
   88|    120|  size_t nx = field->nx;
   89|    120|  size_t ny = field->ny;
   90|    120|  size_t nz = field->nz;
   91|    120|  size_t nw = field->nw;
   92|    120|  ptrdiff_t sx = field->sx ? field->sx : 1;
  ------------------
  |  Branch (92:18): [True: 0, False: 120]
  ------------------
   93|    120|  ptrdiff_t sy = field->sy ? field->sy : (ptrdiff_t)nx;
  ------------------
  |  Branch (93:18): [True: 0, False: 120]
  ------------------
   94|    120|  ptrdiff_t sz = field->sz ? field->sz : (ptrdiff_t)(nx * ny);
  ------------------
  |  Branch (94:18): [True: 0, False: 120]
  ------------------
   95|    120|  ptrdiff_t sw = field->sw ? field->sw : (ptrdiff_t)(nx * ny * nz);
  ------------------
  |  Branch (95:18): [True: 0, False: 120]
  ------------------
   96|    120|  size_t x, y, z, w;
   97|       |
   98|       |  /* decompress array one block of 4x4x4x4 values at a time */
   99|    240|  for (w = 0; w < nw; w += 4)
  ------------------
  |  Branch (99:15): [True: 120, False: 120]
  ------------------
  100|    240|    for (z = 0; z < nz; z += 4)
  ------------------
  |  Branch (100:17): [True: 120, False: 120]
  ------------------
  101|    240|      for (y = 0; y < ny; y += 4)
  ------------------
  |  Branch (101:19): [True: 120, False: 120]
  ------------------
  102|    240|        for (x = 0; x < nx; x += 4) {
  ------------------
  |  Branch (102:21): [True: 120, False: 120]
  ------------------
  103|    120|          Scalar* p = data + sx * (ptrdiff_t)x + sy * (ptrdiff_t)y + sz * (ptrdiff_t)z + sw * (ptrdiff_t)w;
  ------------------
  |  |   70|    120|#define Scalar float
  ------------------
  104|    120|          if (nx - x < 4 || ny - y < 4 || nz - z < 4 || nw - w < 4)
  ------------------
  |  Branch (104:15): [True: 0, False: 120]
  |  Branch (104:29): [True: 0, False: 120]
  |  Branch (104:43): [True: 0, False: 120]
  |  Branch (104:57): [True: 0, False: 120]
  ------------------
  105|      0|            _t2(zfp_decode_partial_block_strided, Scalar, 4)(stream, p, MIN(nx - x, 4u), MIN(ny - y, 4u), MIN(nz - z, 4u), MIN(nw - w, 4u), sx, sy, sz, sw);
  ------------------
  |  |   10|      0|#define _t2(function, type, dims) _cat3(function, type, dims)
  |  |  ------------------
  |  |  |  |    6|      0|#define _cat3(x, y, z) x ## _ ## y ## _ ## z
  |  |  ------------------
  ------------------
                          _t2(zfp_decode_partial_block_strided, Scalar, 4)(stream, p, MIN(nx - x, 4u), MIN(ny - y, 4u), MIN(nz - z, 4u), MIN(nw - w, 4u), sx, sy, sz, sw);
  ------------------
  |  |    4|      0|#define MIN(x, y) ((x) < (y) ? (x) : (y))
  |  |  ------------------
  |  |  |  Branch (4:20): [True: 0, False: 0]
  |  |  ------------------
  ------------------
                          _t2(zfp_decode_partial_block_strided, Scalar, 4)(stream, p, MIN(nx - x, 4u), MIN(ny - y, 4u), MIN(nz - z, 4u), MIN(nw - w, 4u), sx, sy, sz, sw);
  ------------------
  |  |    4|      0|#define MIN(x, y) ((x) < (y) ? (x) : (y))
  |  |  ------------------
  |  |  |  Branch (4:20): [True: 0, False: 0]
  |  |  ------------------
  ------------------
                          _t2(zfp_decode_partial_block_strided, Scalar, 4)(stream, p, MIN(nx - x, 4u), MIN(ny - y, 4u), MIN(nz - z, 4u), MIN(nw - w, 4u), sx, sy, sz, sw);
  ------------------
  |  |    4|      0|#define MIN(x, y) ((x) < (y) ? (x) : (y))
  |  |  ------------------
  |  |  |  Branch (4:20): [True: 0, False: 0]
  |  |  ------------------
  ------------------
                          _t2(zfp_decode_partial_block_strided, Scalar, 4)(stream, p, MIN(nx - x, 4u), MIN(ny - y, 4u), MIN(nz - z, 4u), MIN(nw - w, 4u), sx, sy, sz, sw);
  ------------------
  |  |    4|      0|#define MIN(x, y) ((x) < (y) ? (x) : (y))
  |  |  ------------------
  |  |  |  Branch (4:20): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  106|    120|          else
  107|    120|            _t2(zfp_decode_block_strided, Scalar, 4)(stream, p, sx, sy, sz, sw);
  ------------------
  |  |   10|    120|#define _t2(function, type, dims) _cat3(function, type, dims)
  |  |  ------------------
  |  |  |  |    6|    120|#define _cat3(x, y, z) x ## _ ## y ## _ ## z
  |  |  ------------------
  ------------------
  108|    120|        }
  109|    120|}
zfp.c:decompress_strided_double_4:
   86|     14|{
   87|     14|  Scalar* data = field->data;
  ------------------
  |  |   78|     14|#define Scalar double
  ------------------
   88|     14|  size_t nx = field->nx;
   89|     14|  size_t ny = field->ny;
   90|     14|  size_t nz = field->nz;
   91|     14|  size_t nw = field->nw;
   92|     14|  ptrdiff_t sx = field->sx ? field->sx : 1;
  ------------------
  |  Branch (92:18): [True: 0, False: 14]
  ------------------
   93|     14|  ptrdiff_t sy = field->sy ? field->sy : (ptrdiff_t)nx;
  ------------------
  |  Branch (93:18): [True: 0, False: 14]
  ------------------
   94|     14|  ptrdiff_t sz = field->sz ? field->sz : (ptrdiff_t)(nx * ny);
  ------------------
  |  Branch (94:18): [True: 0, False: 14]
  ------------------
   95|     14|  ptrdiff_t sw = field->sw ? field->sw : (ptrdiff_t)(nx * ny * nz);
  ------------------
  |  Branch (95:18): [True: 0, False: 14]
  ------------------
   96|     14|  size_t x, y, z, w;
   97|       |
   98|       |  /* decompress array one block of 4x4x4x4 values at a time */
   99|     28|  for (w = 0; w < nw; w += 4)
  ------------------
  |  Branch (99:15): [True: 14, False: 14]
  ------------------
  100|     28|    for (z = 0; z < nz; z += 4)
  ------------------
  |  Branch (100:17): [True: 14, False: 14]
  ------------------
  101|     28|      for (y = 0; y < ny; y += 4)
  ------------------
  |  Branch (101:19): [True: 14, False: 14]
  ------------------
  102|     28|        for (x = 0; x < nx; x += 4) {
  ------------------
  |  Branch (102:21): [True: 14, False: 14]
  ------------------
  103|     14|          Scalar* p = data + sx * (ptrdiff_t)x + sy * (ptrdiff_t)y + sz * (ptrdiff_t)z + sw * (ptrdiff_t)w;
  ------------------
  |  |   78|     14|#define Scalar double
  ------------------
  104|     14|          if (nx - x < 4 || ny - y < 4 || nz - z < 4 || nw - w < 4)
  ------------------
  |  Branch (104:15): [True: 0, False: 14]
  |  Branch (104:29): [True: 0, False: 14]
  |  Branch (104:43): [True: 0, False: 14]
  |  Branch (104:57): [True: 0, False: 14]
  ------------------
  105|      0|            _t2(zfp_decode_partial_block_strided, Scalar, 4)(stream, p, MIN(nx - x, 4u), MIN(ny - y, 4u), MIN(nz - z, 4u), MIN(nw - w, 4u), sx, sy, sz, sw);
  ------------------
  |  |   10|      0|#define _t2(function, type, dims) _cat3(function, type, dims)
  |  |  ------------------
  |  |  |  |    6|      0|#define _cat3(x, y, z) x ## _ ## y ## _ ## z
  |  |  ------------------
  ------------------
                          _t2(zfp_decode_partial_block_strided, Scalar, 4)(stream, p, MIN(nx - x, 4u), MIN(ny - y, 4u), MIN(nz - z, 4u), MIN(nw - w, 4u), sx, sy, sz, sw);
  ------------------
  |  |    4|      0|#define MIN(x, y) ((x) < (y) ? (x) : (y))
  |  |  ------------------
  |  |  |  Branch (4:20): [True: 0, False: 0]
  |  |  ------------------
  ------------------
                          _t2(zfp_decode_partial_block_strided, Scalar, 4)(stream, p, MIN(nx - x, 4u), MIN(ny - y, 4u), MIN(nz - z, 4u), MIN(nw - w, 4u), sx, sy, sz, sw);
  ------------------
  |  |    4|      0|#define MIN(x, y) ((x) < (y) ? (x) : (y))
  |  |  ------------------
  |  |  |  Branch (4:20): [True: 0, False: 0]
  |  |  ------------------
  ------------------
                          _t2(zfp_decode_partial_block_strided, Scalar, 4)(stream, p, MIN(nx - x, 4u), MIN(ny - y, 4u), MIN(nz - z, 4u), MIN(nw - w, 4u), sx, sy, sz, sw);
  ------------------
  |  |    4|      0|#define MIN(x, y) ((x) < (y) ? (x) : (y))
  |  |  ------------------
  |  |  |  Branch (4:20): [True: 0, False: 0]
  |  |  ------------------
  ------------------
                          _t2(zfp_decode_partial_block_strided, Scalar, 4)(stream, p, MIN(nx - x, 4u), MIN(ny - y, 4u), MIN(nz - z, 4u), MIN(nw - w, 4u), sx, sy, sz, sw);
  ------------------
  |  |    4|      0|#define MIN(x, y) ((x) < (y) ? (x) : (y))
  |  |  ------------------
  |  |  |  Branch (4:20): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  106|     14|          else
  107|     14|            _t2(zfp_decode_block_strided, Scalar, 4)(stream, p, sx, sy, sz, sw);
  ------------------
  |  |   10|     14|#define _t2(function, type, dims) _cat3(function, type, dims)
  |  |  ------------------
  |  |  |  |    6|     14|#define _cat3(x, y, z) x ## _ ## y ## _ ## z
  |  |  ------------------
  ------------------
  108|     14|        }
  109|     14|}

encode2d.c:encode_block_int64_2:
  261|      2|{
  262|      2|  uint bits;
  263|      2|  cache_align_(UInt ublock[BLOCK_SIZE]);
  ------------------
  |  |   42|      2|  #define cache_align_(x) x __attribute__((aligned(ZFP_CACHE_LINE_SIZE)))
  ------------------
  264|       |  /* perform decorrelating transform */
  265|      2|  _t2(fwd_xform, Int, DIMS)(iblock);
  ------------------
  |  |   10|      2|#define _t2(function, type, dims) _cat3(function, type, dims)
  |  |  ------------------
  |  |  |  |    6|      2|#define _cat3(x, y, z) x ## _ ## y ## _ ## z
  |  |  ------------------
  ------------------
  266|       |#if ZFP_ROUNDING_MODE == ZFP_ROUND_FIRST
  267|       |  /* bias values to achieve proper rounding */
  268|       |  _t1(fwd_round, Int)(iblock, BLOCK_SIZE, maxprec);
  269|       |#endif
  270|       |  /* reorder signed coefficients and convert to unsigned integer */
  271|      2|  _t1(fwd_order, Int)(ublock, iblock, PERM, BLOCK_SIZE);
  ------------------
  |  |    9|      2|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|      2|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
                _t1(fwd_order, Int)(ublock, iblock, PERM, BLOCK_SIZE);
  ------------------
  |  |    1|      2|#define PERM _t1(perm, DIMS)           /* coefficient order */
  |  |  ------------------
  |  |  |  |    9|      2|#define _t1(function, arg)        _cat2(function, arg)
  |  |  |  |  ------------------
  |  |  |  |  |  |    5|      2|#define _cat2(x, y)    x ## _ ## y
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                _t1(fwd_order, Int)(ublock, iblock, PERM, BLOCK_SIZE);
  ------------------
  |  |    2|      2|#define BLOCK_SIZE (1 << (2 * DIMS))   /* values per block */
  |  |  ------------------
  |  |  |  |    1|      2|#define DIMS 2
  |  |  ------------------
  ------------------
  272|       |  /* encode integer coefficients */
  273|      2|  bits = _t1(encode_ints, UInt)(stream, maxbits, maxprec, ublock, BLOCK_SIZE);
  ------------------
  |  |    9|      2|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|      2|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
                bits = _t1(encode_ints, UInt)(stream, maxbits, maxprec, ublock, BLOCK_SIZE);
  ------------------
  |  |    2|      2|#define BLOCK_SIZE (1 << (2 * DIMS))   /* values per block */
  |  |  ------------------
  |  |  |  |    1|      2|#define DIMS 2
  |  |  ------------------
  ------------------
  274|       |  /* write at least minbits bits by padding with zeros */
  275|      2|  if (bits < minbits) {
  ------------------
  |  Branch (275:7): [True: 0, False: 2]
  ------------------
  276|      0|    stream_pad(stream, minbits - bits);
  277|      0|    bits = minbits;
  278|      0|  }
  279|      2|  return bits;
  280|      2|}
encode2d.c:fwd_lift_int64:
   32|     16|{
   33|     16|  Int x, y, z, w;
  ------------------
  |  |    4|     16|#define Int int64                          /* corresponding signed integer type */
  ------------------
   34|     16|  x = *p; p += s;
   35|     16|  y = *p; p += s;
   36|     16|  z = *p; p += s;
   37|     16|  w = *p; p += s;
   38|       |
   39|       |  /*
   40|       |  ** non-orthogonal transform
   41|       |  **        ( 4  4  4  4) (x)
   42|       |  ** 1/16 * ( 5  1 -1 -5) (y)
   43|       |  **        (-4  4  4 -4) (z)
   44|       |  **        (-2  6 -6  2) (w)
   45|       |  */
   46|     16|  x += w; x >>= 1; w -= x;
   47|     16|  z += y; z >>= 1; y -= z;
   48|     16|  x += z; x >>= 1; z -= x;
   49|     16|  w += y; w >>= 1; y -= w;
   50|     16|  w += y >> 1; y -= w >> 1;
   51|       |
   52|     16|  p -= s; *p = w;
   53|     16|  p -= s; *p = z;
   54|     16|  p -= s; *p = y;
   55|     16|  p -= s; *p = x;
   56|     16|}
encode2d.c:fwd_order_int64:
   84|      2|{
   85|      2|  do
   86|     32|    *ublock++ = _t1(int2uint, Int)(iblock[*perm++]);
  ------------------
  |  |    9|     32|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|     32|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
   87|     32|  while (--n);
  ------------------
  |  Branch (87:10): [True: 30, False: 2]
  ------------------
   88|      2|}
encode2d.c:int2uint_int64:
   77|     32|{
   78|     32|  return ((UInt)x + NBMASK) ^ NBMASK;
  ------------------
  |  |    8|     32|#define NBMASK UINT64C(0xaaaaaaaaaaaaaaaa) /* negabinary mask */
  |  |  ------------------
  |  |  |  |   38|     32|  #define UINT64C(x) UINT64_C(x)
  |  |  ------------------
  ------------------
                return ((UInt)x + NBMASK) ^ NBMASK;
  ------------------
  |  |    8|     32|#define NBMASK UINT64C(0xaaaaaaaaaaaaaaaa) /* negabinary mask */
  |  |  ------------------
  |  |  |  |   38|     32|  #define UINT64C(x) UINT64_C(x)
  |  |  ------------------
  ------------------
   79|     32|}
encode2d.c:encode_ints_uint64:
  240|      2|{
  241|       |  /* use fastest available encoder implementation */
  242|      2|  if (with_maxbits(maxbits, maxprec, size)) {
  ------------------
  |  Branch (242:7): [True: 0, False: 2]
  ------------------
  243|       |    /* rate constrained path: encode partial bit planes */
  244|      0|    if (size <= 64)
  ------------------
  |  Branch (244:9): [True: 0, False: 0]
  ------------------
  245|      0|      return _t1(encode_few_ints, UInt)(stream, maxbits, maxprec, data, size); /* 1D, 2D, 3D blocks */
  ------------------
  |  |    9|      0|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|      0|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
  246|      0|    else
  247|      0|      return _t1(encode_many_ints, UInt)(stream, maxbits, maxprec, data, size); /* 4D blocks */
  ------------------
  |  |    9|      0|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|      0|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
  248|      0|  }
  249|      2|  else {
  250|       |    /* variable-rate path: encode whole bit planes */
  251|      2|    if (size <= 64)
  ------------------
  |  Branch (251:9): [True: 2, False: 0]
  ------------------
  252|      2|      return _t1(encode_few_ints_prec, UInt)(stream, maxprec, data, size); /* 1D, 2D, 3D blocks */
  ------------------
  |  |    9|      2|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|      2|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
  253|      0|    else
  254|      0|      return _t1(encode_many_ints_prec, UInt)(stream, maxprec, data, size); /* 4D blocks */
  ------------------
  |  |    9|      0|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|      0|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
  255|      2|  }
  256|      2|}
encode2d.c:encode_few_ints_prec_uint64:
  181|      2|{
  182|       |  /* make a copy of bit stream to avoid aliasing */
  183|      2|  bitstream s = *stream;
  184|      2|  bitstream_offset offset = stream_wtell(&s);
  185|      2|  uint intprec = (uint)(CHAR_BIT * sizeof(UInt));
  186|      2|  uint kmin = intprec > maxprec ? intprec - maxprec : 0;
  ------------------
  |  Branch (186:15): [True: 2, False: 0]
  ------------------
  187|      2|  uint i, k, n;
  188|       |
  189|       |  /* encode one bit plane at a time from MSB to LSB */
  190|     20|  for (k = intprec, n = 0; k-- > kmin;) {
  ------------------
  |  Branch (190:28): [True: 18, False: 2]
  ------------------
  191|       |    /* step 1: extract bit plane #k to x */
  192|     18|    uint64 x = 0;
  193|    306|    for (i = 0; i < size; i++)
  ------------------
  |  Branch (193:17): [True: 288, False: 18]
  ------------------
  194|    288|      x += (uint64)((data[i] >> k) & 1u) << i;
  195|       |    /* step 2: encode first n bits of bit plane */
  196|     18|    x = stream_write_bits(&s, x, n);
  197|       |    /* step 3: unary run-length encode remainder of bit plane */
  198|     25|    for (; n < size && stream_write_bit(&s, !!x); x >>= 1, n++)
  ------------------
  |  Branch (198:12): [True: 16, False: 9]
  |  Branch (198:24): [True: 7, False: 9]
  ------------------
  199|     32|      for (; n < size - 1 && !stream_write_bit(&s, x & 1u); x >>= 1, n++)
  ------------------
  |  Branch (199:14): [True: 30, False: 2]
  |  Branch (199:30): [True: 25, False: 5]
  ------------------
  200|     25|        ;
  201|     18|  }
  202|       |
  203|      2|  *stream = s;
  204|      2|  return (uint)(stream_wtell(&s) - offset);
  205|      2|}
encode3f.c:encode_block_int32_3:
  261|     27|{
  262|     27|  uint bits;
  263|     27|  cache_align_(UInt ublock[BLOCK_SIZE]);
  ------------------
  |  |   42|     27|  #define cache_align_(x) x __attribute__((aligned(ZFP_CACHE_LINE_SIZE)))
  ------------------
  264|       |  /* perform decorrelating transform */
  265|     27|  _t2(fwd_xform, Int, DIMS)(iblock);
  ------------------
  |  |   10|     27|#define _t2(function, type, dims) _cat3(function, type, dims)
  |  |  ------------------
  |  |  |  |    6|     27|#define _cat3(x, y, z) x ## _ ## y ## _ ## z
  |  |  ------------------
  ------------------
  266|       |#if ZFP_ROUNDING_MODE == ZFP_ROUND_FIRST
  267|       |  /* bias values to achieve proper rounding */
  268|       |  _t1(fwd_round, Int)(iblock, BLOCK_SIZE, maxprec);
  269|       |#endif
  270|       |  /* reorder signed coefficients and convert to unsigned integer */
  271|     27|  _t1(fwd_order, Int)(ublock, iblock, PERM, BLOCK_SIZE);
  ------------------
  |  |    9|     27|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|     27|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
                _t1(fwd_order, Int)(ublock, iblock, PERM, BLOCK_SIZE);
  ------------------
  |  |    1|     27|#define PERM _t1(perm, DIMS)           /* coefficient order */
  |  |  ------------------
  |  |  |  |    9|     27|#define _t1(function, arg)        _cat2(function, arg)
  |  |  |  |  ------------------
  |  |  |  |  |  |    5|     27|#define _cat2(x, y)    x ## _ ## y
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                _t1(fwd_order, Int)(ublock, iblock, PERM, BLOCK_SIZE);
  ------------------
  |  |    2|     27|#define BLOCK_SIZE (1 << (2 * DIMS))   /* values per block */
  |  |  ------------------
  |  |  |  |    1|     27|#define DIMS 3
  |  |  ------------------
  ------------------
  272|       |  /* encode integer coefficients */
  273|     27|  bits = _t1(encode_ints, UInt)(stream, maxbits, maxprec, ublock, BLOCK_SIZE);
  ------------------
  |  |    9|     27|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|     27|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
                bits = _t1(encode_ints, UInt)(stream, maxbits, maxprec, ublock, BLOCK_SIZE);
  ------------------
  |  |    2|     27|#define BLOCK_SIZE (1 << (2 * DIMS))   /* values per block */
  |  |  ------------------
  |  |  |  |    1|     27|#define DIMS 3
  |  |  ------------------
  ------------------
  274|       |  /* write at least minbits bits by padding with zeros */
  275|     27|  if (bits < minbits) {
  ------------------
  |  Branch (275:7): [True: 0, False: 27]
  ------------------
  276|      0|    stream_pad(stream, minbits - bits);
  277|      0|    bits = minbits;
  278|      0|  }
  279|     27|  return bits;
  280|     27|}
encode3f.c:fwd_lift_int32:
   32|  1.29k|{
   33|  1.29k|  Int x, y, z, w;
  ------------------
  |  |    4|  1.29k|#define Int int32          /* corresponding signed integer type */
  ------------------
   34|  1.29k|  x = *p; p += s;
   35|  1.29k|  y = *p; p += s;
   36|  1.29k|  z = *p; p += s;
   37|  1.29k|  w = *p; p += s;
   38|       |
   39|       |  /*
   40|       |  ** non-orthogonal transform
   41|       |  **        ( 4  4  4  4) (x)
   42|       |  ** 1/16 * ( 5  1 -1 -5) (y)
   43|       |  **        (-4  4  4 -4) (z)
   44|       |  **        (-2  6 -6  2) (w)
   45|       |  */
   46|  1.29k|  x += w; x >>= 1; w -= x;
   47|  1.29k|  z += y; z >>= 1; y -= z;
   48|  1.29k|  x += z; x >>= 1; z -= x;
   49|  1.29k|  w += y; w >>= 1; y -= w;
   50|  1.29k|  w += y >> 1; y -= w >> 1;
   51|       |
   52|  1.29k|  p -= s; *p = w;
   53|  1.29k|  p -= s; *p = z;
   54|  1.29k|  p -= s; *p = y;
   55|  1.29k|  p -= s; *p = x;
   56|  1.29k|}
encode3f.c:fwd_order_int32:
   84|     27|{
   85|     27|  do
   86|  1.72k|    *ublock++ = _t1(int2uint, Int)(iblock[*perm++]);
  ------------------
  |  |    9|  1.72k|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|  1.72k|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
   87|  1.72k|  while (--n);
  ------------------
  |  Branch (87:10): [True: 1.70k, False: 27]
  ------------------
   88|     27|}
encode3f.c:int2uint_int32:
   77|  1.72k|{
   78|  1.72k|  return ((UInt)x + NBMASK) ^ NBMASK;
  ------------------
  |  |    8|  1.72k|#define NBMASK 0xaaaaaaaau /* negabinary mask */
  ------------------
                return ((UInt)x + NBMASK) ^ NBMASK;
  ------------------
  |  |    8|  1.72k|#define NBMASK 0xaaaaaaaau /* negabinary mask */
  ------------------
   79|  1.72k|}
encode3f.c:encode_ints_uint32:
  240|     27|{
  241|       |  /* use fastest available encoder implementation */
  242|     27|  if (with_maxbits(maxbits, maxprec, size)) {
  ------------------
  |  Branch (242:7): [True: 9, False: 18]
  ------------------
  243|       |    /* rate constrained path: encode partial bit planes */
  244|      9|    if (size <= 64)
  ------------------
  |  Branch (244:9): [True: 9, False: 0]
  ------------------
  245|      9|      return _t1(encode_few_ints, UInt)(stream, maxbits, maxprec, data, size); /* 1D, 2D, 3D blocks */
  ------------------
  |  |    9|      9|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|      9|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
  246|      0|    else
  247|      0|      return _t1(encode_many_ints, UInt)(stream, maxbits, maxprec, data, size); /* 4D blocks */
  ------------------
  |  |    9|      0|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|      0|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
  248|      9|  }
  249|     18|  else {
  250|       |    /* variable-rate path: encode whole bit planes */
  251|     18|    if (size <= 64)
  ------------------
  |  Branch (251:9): [True: 18, False: 0]
  ------------------
  252|     18|      return _t1(encode_few_ints_prec, UInt)(stream, maxprec, data, size); /* 1D, 2D, 3D blocks */
  ------------------
  |  |    9|     18|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|     18|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
  253|      0|    else
  254|      0|      return _t1(encode_many_ints_prec, UInt)(stream, maxprec, data, size); /* 4D blocks */
  ------------------
  |  |    9|      0|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|      0|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
  255|     18|  }
  256|     27|}
encode3f.c:encode_few_ints_uint32:
   93|      9|{
   94|       |  /* make a copy of bit stream to avoid aliasing */
   95|      9|  bitstream s = *stream;
   96|      9|  uint intprec = (uint)(CHAR_BIT * sizeof(UInt));
   97|      9|  uint kmin = intprec > maxprec ? intprec - maxprec : 0;
  ------------------
  |  Branch (97:15): [True: 0, False: 9]
  ------------------
   98|      9|  uint bits = maxbits;
   99|      9|  uint i, k, m, n;
  100|      9|  uint64 x;
  101|       |
  102|       |  /* encode one bit plane at a time from MSB to LSB */
  103|    127|  for (k = intprec, n = 0; bits && k-- > kmin;) {
  ------------------
  |  Branch (103:28): [True: 118, False: 9]
  |  Branch (103:36): [True: 118, False: 0]
  ------------------
  104|       |    /* step 1: extract bit plane #k to x */
  105|    118|    x = 0;
  106|  7.67k|    for (i = 0; i < size; i++)
  ------------------
  |  Branch (106:17): [True: 7.55k, False: 118]
  ------------------
  107|  7.55k|      x += (uint64)((data[i] >> k) & 1u) << i;
  108|       |    /* step 2: encode first n bits of bit plane */
  109|    118|    m = MIN(n, bits);
  ------------------
  |  |    4|    118|#define MIN(x, y) ((x) < (y) ? (x) : (y))
  |  |  ------------------
  |  |  |  Branch (4:20): [True: 110, False: 8]
  |  |  ------------------
  ------------------
  110|    118|    bits -= m;
  111|    118|    x = stream_write_bits(&s, x, m);
  112|       |    /* step 3: unary run-length encode remainder of bit plane */
  113|    205|    for (; bits && n < size; x >>= 1, n++) {
  ------------------
  |  Branch (113:12): [True: 196, False: 9]
  |  Branch (113:20): [True: 145, False: 51]
  ------------------
  114|    145|      bits--;
  115|    145|      if (stream_write_bit(&s, !!x)) {
  ------------------
  |  Branch (115:11): [True: 87, False: 58]
  ------------------
  116|       |        /* positive group test (x != 0); scan for one-bit */
  117|    517|        for (; bits && n < size - 1; x >>= 1, n++) {
  ------------------
  |  Branch (117:16): [True: 516, False: 1]
  |  Branch (117:24): [True: 509, False: 7]
  ------------------
  118|    509|          bits--;
  119|    509|          if (stream_write_bit(&s, x & 1u))
  ------------------
  |  Branch (119:15): [True: 79, False: 430]
  ------------------
  120|     79|            break;
  121|    509|        }
  122|     87|      }
  123|     58|      else {
  124|       |        /* negative group test (x == 0); done with bit plane */
  125|     58|        break;
  126|     58|      }
  127|    145|    }
  128|    118|  }
  129|       |
  130|      9|  *stream = s;
  131|      9|  return maxbits - bits;
  132|      9|}
encode3f.c:encode_few_ints_prec_uint32:
  181|     18|{
  182|       |  /* make a copy of bit stream to avoid aliasing */
  183|     18|  bitstream s = *stream;
  184|     18|  bitstream_offset offset = stream_wtell(&s);
  185|     18|  uint intprec = (uint)(CHAR_BIT * sizeof(UInt));
  186|     18|  uint kmin = intprec > maxprec ? intprec - maxprec : 0;
  ------------------
  |  Branch (186:15): [True: 6, False: 12]
  ------------------
  187|     18|  uint i, k, n;
  188|       |
  189|       |  /* encode one bit plane at a time from MSB to LSB */
  190|    462|  for (k = intprec, n = 0; k-- > kmin;) {
  ------------------
  |  Branch (190:28): [True: 444, False: 18]
  ------------------
  191|       |    /* step 1: extract bit plane #k to x */
  192|    444|    uint64 x = 0;
  193|  28.8k|    for (i = 0; i < size; i++)
  ------------------
  |  Branch (193:17): [True: 28.4k, False: 444]
  ------------------
  194|  28.4k|      x += (uint64)((data[i] >> k) & 1u) << i;
  195|       |    /* step 2: encode first n bits of bit plane */
  196|    444|    x = stream_write_bits(&s, x, n);
  197|       |    /* step 3: unary run-length encode remainder of bit plane */
  198|    623|    for (; n < size && stream_write_bit(&s, !!x); x >>= 1, n++)
  ------------------
  |  Branch (198:12): [True: 316, False: 307]
  |  Branch (198:24): [True: 179, False: 137]
  ------------------
  199|  1.10k|      for (; n < size - 1 && !stream_write_bit(&s, x & 1u); x >>= 1, n++)
  ------------------
  |  Branch (199:14): [True: 1.08k, False: 16]
  |  Branch (199:30): [True: 926, False: 163]
  ------------------
  200|    926|        ;
  201|    444|  }
  202|       |
  203|     18|  *stream = s;
  204|     18|  return (uint)(stream_wtell(&s) - offset);
  205|     18|}
encode3d.c:encode_block_int64_3:
  261|     32|{
  262|     32|  uint bits;
  263|     32|  cache_align_(UInt ublock[BLOCK_SIZE]);
  ------------------
  |  |   42|     32|  #define cache_align_(x) x __attribute__((aligned(ZFP_CACHE_LINE_SIZE)))
  ------------------
  264|       |  /* perform decorrelating transform */
  265|     32|  _t2(fwd_xform, Int, DIMS)(iblock);
  ------------------
  |  |   10|     32|#define _t2(function, type, dims) _cat3(function, type, dims)
  |  |  ------------------
  |  |  |  |    6|     32|#define _cat3(x, y, z) x ## _ ## y ## _ ## z
  |  |  ------------------
  ------------------
  266|       |#if ZFP_ROUNDING_MODE == ZFP_ROUND_FIRST
  267|       |  /* bias values to achieve proper rounding */
  268|       |  _t1(fwd_round, Int)(iblock, BLOCK_SIZE, maxprec);
  269|       |#endif
  270|       |  /* reorder signed coefficients and convert to unsigned integer */
  271|     32|  _t1(fwd_order, Int)(ublock, iblock, PERM, BLOCK_SIZE);
  ------------------
  |  |    9|     32|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|     32|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
                _t1(fwd_order, Int)(ublock, iblock, PERM, BLOCK_SIZE);
  ------------------
  |  |    1|     32|#define PERM _t1(perm, DIMS)           /* coefficient order */
  |  |  ------------------
  |  |  |  |    9|     32|#define _t1(function, arg)        _cat2(function, arg)
  |  |  |  |  ------------------
  |  |  |  |  |  |    5|     32|#define _cat2(x, y)    x ## _ ## y
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                _t1(fwd_order, Int)(ublock, iblock, PERM, BLOCK_SIZE);
  ------------------
  |  |    2|     32|#define BLOCK_SIZE (1 << (2 * DIMS))   /* values per block */
  |  |  ------------------
  |  |  |  |    1|     32|#define DIMS 3
  |  |  ------------------
  ------------------
  272|       |  /* encode integer coefficients */
  273|     32|  bits = _t1(encode_ints, UInt)(stream, maxbits, maxprec, ublock, BLOCK_SIZE);
  ------------------
  |  |    9|     32|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|     32|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
                bits = _t1(encode_ints, UInt)(stream, maxbits, maxprec, ublock, BLOCK_SIZE);
  ------------------
  |  |    2|     32|#define BLOCK_SIZE (1 << (2 * DIMS))   /* values per block */
  |  |  ------------------
  |  |  |  |    1|     32|#define DIMS 3
  |  |  ------------------
  ------------------
  274|       |  /* write at least minbits bits by padding with zeros */
  275|     32|  if (bits < minbits) {
  ------------------
  |  Branch (275:7): [True: 0, False: 32]
  ------------------
  276|      0|    stream_pad(stream, minbits - bits);
  277|      0|    bits = minbits;
  278|      0|  }
  279|     32|  return bits;
  280|     32|}
encode3d.c:fwd_lift_int64:
   32|  1.53k|{
   33|  1.53k|  Int x, y, z, w;
  ------------------
  |  |    4|  1.53k|#define Int int64                          /* corresponding signed integer type */
  ------------------
   34|  1.53k|  x = *p; p += s;
   35|  1.53k|  y = *p; p += s;
   36|  1.53k|  z = *p; p += s;
   37|  1.53k|  w = *p; p += s;
   38|       |
   39|       |  /*
   40|       |  ** non-orthogonal transform
   41|       |  **        ( 4  4  4  4) (x)
   42|       |  ** 1/16 * ( 5  1 -1 -5) (y)
   43|       |  **        (-4  4  4 -4) (z)
   44|       |  **        (-2  6 -6  2) (w)
   45|       |  */
   46|  1.53k|  x += w; x >>= 1; w -= x;
   47|  1.53k|  z += y; z >>= 1; y -= z;
   48|  1.53k|  x += z; x >>= 1; z -= x;
   49|  1.53k|  w += y; w >>= 1; y -= w;
   50|  1.53k|  w += y >> 1; y -= w >> 1;
   51|       |
   52|  1.53k|  p -= s; *p = w;
   53|  1.53k|  p -= s; *p = z;
   54|  1.53k|  p -= s; *p = y;
   55|  1.53k|  p -= s; *p = x;
   56|  1.53k|}
encode3d.c:fwd_order_int64:
   84|     32|{
   85|     32|  do
   86|  2.04k|    *ublock++ = _t1(int2uint, Int)(iblock[*perm++]);
  ------------------
  |  |    9|  2.04k|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|  2.04k|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
   87|  2.04k|  while (--n);
  ------------------
  |  Branch (87:10): [True: 2.01k, False: 32]
  ------------------
   88|     32|}
encode3d.c:int2uint_int64:
   77|  2.04k|{
   78|  2.04k|  return ((UInt)x + NBMASK) ^ NBMASK;
  ------------------
  |  |    8|  2.04k|#define NBMASK UINT64C(0xaaaaaaaaaaaaaaaa) /* negabinary mask */
  |  |  ------------------
  |  |  |  |   38|  2.04k|  #define UINT64C(x) UINT64_C(x)
  |  |  ------------------
  ------------------
                return ((UInt)x + NBMASK) ^ NBMASK;
  ------------------
  |  |    8|  2.04k|#define NBMASK UINT64C(0xaaaaaaaaaaaaaaaa) /* negabinary mask */
  |  |  ------------------
  |  |  |  |   38|  2.04k|  #define UINT64C(x) UINT64_C(x)
  |  |  ------------------
  ------------------
   79|  2.04k|}
encode3d.c:encode_ints_uint64:
  240|     32|{
  241|       |  /* use fastest available encoder implementation */
  242|     32|  if (with_maxbits(maxbits, maxprec, size)) {
  ------------------
  |  Branch (242:7): [True: 16, False: 16]
  ------------------
  243|       |    /* rate constrained path: encode partial bit planes */
  244|     16|    if (size <= 64)
  ------------------
  |  Branch (244:9): [True: 16, False: 0]
  ------------------
  245|     16|      return _t1(encode_few_ints, UInt)(stream, maxbits, maxprec, data, size); /* 1D, 2D, 3D blocks */
  ------------------
  |  |    9|     16|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|     16|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
  246|      0|    else
  247|      0|      return _t1(encode_many_ints, UInt)(stream, maxbits, maxprec, data, size); /* 4D blocks */
  ------------------
  |  |    9|      0|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|      0|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
  248|     16|  }
  249|     16|  else {
  250|       |    /* variable-rate path: encode whole bit planes */
  251|     16|    if (size <= 64)
  ------------------
  |  Branch (251:9): [True: 16, False: 0]
  ------------------
  252|     16|      return _t1(encode_few_ints_prec, UInt)(stream, maxprec, data, size); /* 1D, 2D, 3D blocks */
  ------------------
  |  |    9|     16|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|     16|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
  253|      0|    else
  254|      0|      return _t1(encode_many_ints_prec, UInt)(stream, maxprec, data, size); /* 4D blocks */
  ------------------
  |  |    9|      0|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|      0|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
  255|     16|  }
  256|     32|}
encode3d.c:encode_few_ints_uint64:
   93|     16|{
   94|       |  /* make a copy of bit stream to avoid aliasing */
   95|     16|  bitstream s = *stream;
   96|     16|  uint intprec = (uint)(CHAR_BIT * sizeof(UInt));
   97|     16|  uint kmin = intprec > maxprec ? intprec - maxprec : 0;
  ------------------
  |  Branch (97:15): [True: 0, False: 16]
  ------------------
   98|     16|  uint bits = maxbits;
   99|     16|  uint i, k, m, n;
  100|     16|  uint64 x;
  101|       |
  102|       |  /* encode one bit plane at a time from MSB to LSB */
  103|    425|  for (k = intprec, n = 0; bits && k-- > kmin;) {
  ------------------
  |  Branch (103:28): [True: 409, False: 16]
  |  Branch (103:36): [True: 409, False: 0]
  ------------------
  104|       |    /* step 1: extract bit plane #k to x */
  105|    409|    x = 0;
  106|  26.5k|    for (i = 0; i < size; i++)
  ------------------
  |  Branch (106:17): [True: 26.1k, False: 409]
  ------------------
  107|  26.1k|      x += (uint64)((data[i] >> k) & 1u) << i;
  108|       |    /* step 2: encode first n bits of bit plane */
  109|    409|    m = MIN(n, bits);
  ------------------
  |  |    4|    409|#define MIN(x, y) ((x) < (y) ? (x) : (y))
  |  |  ------------------
  |  |  |  Branch (4:20): [True: 393, False: 16]
  |  |  ------------------
  ------------------
  110|    409|    bits -= m;
  111|    409|    x = stream_write_bits(&s, x, m);
  112|       |    /* step 3: unary run-length encode remainder of bit plane */
  113|    641|    for (; bits && n < size; x >>= 1, n++) {
  ------------------
  |  Branch (113:12): [True: 625, False: 16]
  |  Branch (113:20): [True: 353, False: 272]
  ------------------
  114|    353|      bits--;
  115|    353|      if (stream_write_bit(&s, !!x)) {
  ------------------
  |  Branch (115:11): [True: 232, False: 121]
  ------------------
  116|       |        /* positive group test (x != 0); scan for one-bit */
  117|  1.02k|        for (; bits && n < size - 1; x >>= 1, n++) {
  ------------------
  |  Branch (117:16): [True: 1.02k, False: 0]
  |  Branch (117:24): [True: 1.00k, False: 16]
  ------------------
  118|  1.00k|          bits--;
  119|  1.00k|          if (stream_write_bit(&s, x & 1u))
  ------------------
  |  Branch (119:15): [True: 216, False: 792]
  ------------------
  120|    216|            break;
  121|  1.00k|        }
  122|    232|      }
  123|    121|      else {
  124|       |        /* negative group test (x == 0); done with bit plane */
  125|    121|        break;
  126|    121|      }
  127|    353|    }
  128|    409|  }
  129|       |
  130|     16|  *stream = s;
  131|     16|  return maxbits - bits;
  132|     16|}
encode3d.c:encode_few_ints_prec_uint64:
  181|     16|{
  182|       |  /* make a copy of bit stream to avoid aliasing */
  183|     16|  bitstream s = *stream;
  184|     16|  bitstream_offset offset = stream_wtell(&s);
  185|     16|  uint intprec = (uint)(CHAR_BIT * sizeof(UInt));
  186|     16|  uint kmin = intprec > maxprec ? intprec - maxprec : 0;
  ------------------
  |  Branch (186:15): [True: 16, False: 0]
  ------------------
  187|     16|  uint i, k, n;
  188|       |
  189|       |  /* encode one bit plane at a time from MSB to LSB */
  190|    760|  for (k = intprec, n = 0; k-- > kmin;) {
  ------------------
  |  Branch (190:28): [True: 744, False: 16]
  ------------------
  191|       |    /* step 1: extract bit plane #k to x */
  192|    744|    uint64 x = 0;
  193|  48.3k|    for (i = 0; i < size; i++)
  ------------------
  |  Branch (193:17): [True: 47.6k, False: 744]
  ------------------
  194|  47.6k|      x += (uint64)((data[i] >> k) & 1u) << i;
  195|       |    /* step 2: encode first n bits of bit plane */
  196|    744|    x = stream_write_bits(&s, x, n);
  197|       |    /* step 3: unary run-length encode remainder of bit plane */
  198|    993|    for (; n < size && stream_write_bit(&s, !!x); x >>= 1, n++)
  ------------------
  |  Branch (198:12): [True: 369, False: 624]
  |  Branch (198:24): [True: 249, False: 120]
  ------------------
  199|  1.02k|      for (; n < size - 1 && !stream_write_bit(&s, x & 1u); x >>= 1, n++)
  ------------------
  |  Branch (199:14): [True: 1.00k, False: 16]
  |  Branch (199:30): [True: 775, False: 233]
  ------------------
  200|    775|        ;
  201|    744|  }
  202|       |
  203|     16|  *stream = s;
  204|     16|  return (uint)(stream_wtell(&s) - offset);
  205|     16|}
encode4f.c:encode_block_int32_4:
  261|     58|{
  262|     58|  uint bits;
  263|     58|  cache_align_(UInt ublock[BLOCK_SIZE]);
  ------------------
  |  |   42|     58|  #define cache_align_(x) x __attribute__((aligned(ZFP_CACHE_LINE_SIZE)))
  ------------------
  264|       |  /* perform decorrelating transform */
  265|     58|  _t2(fwd_xform, Int, DIMS)(iblock);
  ------------------
  |  |   10|     58|#define _t2(function, type, dims) _cat3(function, type, dims)
  |  |  ------------------
  |  |  |  |    6|     58|#define _cat3(x, y, z) x ## _ ## y ## _ ## z
  |  |  ------------------
  ------------------
  266|       |#if ZFP_ROUNDING_MODE == ZFP_ROUND_FIRST
  267|       |  /* bias values to achieve proper rounding */
  268|       |  _t1(fwd_round, Int)(iblock, BLOCK_SIZE, maxprec);
  269|       |#endif
  270|       |  /* reorder signed coefficients and convert to unsigned integer */
  271|     58|  _t1(fwd_order, Int)(ublock, iblock, PERM, BLOCK_SIZE);
  ------------------
  |  |    9|     58|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|     58|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
                _t1(fwd_order, Int)(ublock, iblock, PERM, BLOCK_SIZE);
  ------------------
  |  |    1|     58|#define PERM _t1(perm, DIMS)           /* coefficient order */
  |  |  ------------------
  |  |  |  |    9|     58|#define _t1(function, arg)        _cat2(function, arg)
  |  |  |  |  ------------------
  |  |  |  |  |  |    5|     58|#define _cat2(x, y)    x ## _ ## y
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                _t1(fwd_order, Int)(ublock, iblock, PERM, BLOCK_SIZE);
  ------------------
  |  |    2|     58|#define BLOCK_SIZE (1 << (2 * DIMS))   /* values per block */
  |  |  ------------------
  |  |  |  |    1|     58|#define DIMS 4
  |  |  ------------------
  ------------------
  272|       |  /* encode integer coefficients */
  273|     58|  bits = _t1(encode_ints, UInt)(stream, maxbits, maxprec, ublock, BLOCK_SIZE);
  ------------------
  |  |    9|     58|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|     58|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
                bits = _t1(encode_ints, UInt)(stream, maxbits, maxprec, ublock, BLOCK_SIZE);
  ------------------
  |  |    2|     58|#define BLOCK_SIZE (1 << (2 * DIMS))   /* values per block */
  |  |  ------------------
  |  |  |  |    1|     58|#define DIMS 4
  |  |  ------------------
  ------------------
  274|       |  /* write at least minbits bits by padding with zeros */
  275|     58|  if (bits < minbits) {
  ------------------
  |  Branch (275:7): [True: 0, False: 58]
  ------------------
  276|      0|    stream_pad(stream, minbits - bits);
  277|      0|    bits = minbits;
  278|      0|  }
  279|     58|  return bits;
  280|     58|}
encode4f.c:fwd_lift_int32:
   32|  14.8k|{
   33|  14.8k|  Int x, y, z, w;
  ------------------
  |  |    4|  14.8k|#define Int int32          /* corresponding signed integer type */
  ------------------
   34|  14.8k|  x = *p; p += s;
   35|  14.8k|  y = *p; p += s;
   36|  14.8k|  z = *p; p += s;
   37|  14.8k|  w = *p; p += s;
   38|       |
   39|       |  /*
   40|       |  ** non-orthogonal transform
   41|       |  **        ( 4  4  4  4) (x)
   42|       |  ** 1/16 * ( 5  1 -1 -5) (y)
   43|       |  **        (-4  4  4 -4) (z)
   44|       |  **        (-2  6 -6  2) (w)
   45|       |  */
   46|  14.8k|  x += w; x >>= 1; w -= x;
   47|  14.8k|  z += y; z >>= 1; y -= z;
   48|  14.8k|  x += z; x >>= 1; z -= x;
   49|  14.8k|  w += y; w >>= 1; y -= w;
   50|  14.8k|  w += y >> 1; y -= w >> 1;
   51|       |
   52|  14.8k|  p -= s; *p = w;
   53|  14.8k|  p -= s; *p = z;
   54|  14.8k|  p -= s; *p = y;
   55|  14.8k|  p -= s; *p = x;
   56|  14.8k|}
encode4f.c:fwd_order_int32:
   84|     58|{
   85|     58|  do
   86|  14.8k|    *ublock++ = _t1(int2uint, Int)(iblock[*perm++]);
  ------------------
  |  |    9|  14.8k|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|  14.8k|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
   87|  14.8k|  while (--n);
  ------------------
  |  Branch (87:10): [True: 14.7k, False: 58]
  ------------------
   88|     58|}
encode4f.c:int2uint_int32:
   77|  14.8k|{
   78|  14.8k|  return ((UInt)x + NBMASK) ^ NBMASK;
  ------------------
  |  |    8|  14.8k|#define NBMASK 0xaaaaaaaau /* negabinary mask */
  ------------------
                return ((UInt)x + NBMASK) ^ NBMASK;
  ------------------
  |  |    8|  14.8k|#define NBMASK 0xaaaaaaaau /* negabinary mask */
  ------------------
   79|  14.8k|}
encode4f.c:encode_ints_uint32:
  240|     58|{
  241|       |  /* use fastest available encoder implementation */
  242|     58|  if (with_maxbits(maxbits, maxprec, size)) {
  ------------------
  |  Branch (242:7): [True: 22, False: 36]
  ------------------
  243|       |    /* rate constrained path: encode partial bit planes */
  244|     22|    if (size <= 64)
  ------------------
  |  Branch (244:9): [True: 0, False: 22]
  ------------------
  245|      0|      return _t1(encode_few_ints, UInt)(stream, maxbits, maxprec, data, size); /* 1D, 2D, 3D blocks */
  ------------------
  |  |    9|      0|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|      0|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
  246|     22|    else
  247|     22|      return _t1(encode_many_ints, UInt)(stream, maxbits, maxprec, data, size); /* 4D blocks */
  ------------------
  |  |    9|     22|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|     22|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
  248|     22|  }
  249|     36|  else {
  250|       |    /* variable-rate path: encode whole bit planes */
  251|     36|    if (size <= 64)
  ------------------
  |  Branch (251:9): [True: 0, False: 36]
  ------------------
  252|      0|      return _t1(encode_few_ints_prec, UInt)(stream, maxprec, data, size); /* 1D, 2D, 3D blocks */
  ------------------
  |  |    9|      0|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|      0|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
  253|     36|    else
  254|     36|      return _t1(encode_many_ints_prec, UInt)(stream, maxprec, data, size); /* 4D blocks */
  ------------------
  |  |    9|     36|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|     36|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
  255|     36|  }
  256|     58|}
encode4f.c:encode_many_ints_uint32:
  137|     22|{
  138|       |  /* make a copy of bit stream to avoid aliasing */
  139|     22|  bitstream s = *stream;
  140|     22|  uint intprec = (uint)(CHAR_BIT * sizeof(UInt));
  141|     22|  uint kmin = intprec > maxprec ? intprec - maxprec : 0;
  ------------------
  |  Branch (141:15): [True: 0, False: 22]
  ------------------
  142|     22|  uint bits = maxbits;
  143|     22|  uint i, k, m, n, c;
  144|       |
  145|       |  /* encode one bit plane at a time from MSB to LSB */
  146|     93|  for (k = intprec, n = 0; bits && k-- > kmin;) {
  ------------------
  |  Branch (146:28): [True: 71, False: 22]
  |  Branch (146:36): [True: 71, False: 0]
  ------------------
  147|       |    /* step 1: encode first n bits of bit plane #k */
  148|     71|    m = MIN(n, bits);
  ------------------
  |  |    4|     71|#define MIN(x, y) ((x) < (y) ? (x) : (y))
  |  |  ------------------
  |  |  |  Branch (4:20): [True: 60, False: 11]
  |  |  ------------------
  ------------------
  149|     71|    bits -= m;
  150|    626|    for (i = 0; i < m; i++)
  ------------------
  |  Branch (150:17): [True: 555, False: 71]
  ------------------
  151|    555|      stream_write_bit(&s, (data[i] >> k) & 1u);
  152|       |    /* step 2: count remaining one-bits in bit plane */
  153|     71|    c = 0;
  154|  17.6k|    for (i = m; i < size; i++)
  ------------------
  |  Branch (154:17): [True: 17.6k, False: 71]
  ------------------
  155|  17.6k|      c += (data[i] >> k) & 1u;
  156|       |    /* step 3: unary run-length encode remainder of bit plane */
  157|    135|    for (; bits && n < size; n++) {
  ------------------
  |  Branch (157:12): [True: 113, False: 22]
  |  Branch (157:20): [True: 113, False: 0]
  ------------------
  158|    113|      bits--;
  159|    113|      if (stream_write_bit(&s, !!c)) {
  ------------------
  |  Branch (159:11): [True: 64, False: 49]
  ------------------
  160|       |        /* positive group test (c > 0); scan for one-bit */
  161|  2.09k|        for (c--; bits && n < size - 1; n++) {
  ------------------
  |  Branch (161:19): [True: 2.08k, False: 11]
  |  Branch (161:27): [True: 2.08k, False: 0]
  ------------------
  162|  2.08k|          bits--;
  163|  2.08k|          if (stream_write_bit(&s, (data[n] >> k) & 1u))
  ------------------
  |  Branch (163:15): [True: 53, False: 2.03k]
  ------------------
  164|     53|            break;
  165|  2.08k|        }
  166|     64|      }
  167|     49|      else {
  168|       |        /* negative group test (c == 0); done with bit plane */
  169|     49|        break;
  170|     49|      }
  171|    113|    }
  172|     71|  }
  173|       |
  174|     22|  *stream = s;
  175|     22|  return maxbits - bits;
  176|     22|}
encode4f.c:encode_many_ints_prec_uint32:
  210|     36|{
  211|       |  /* make a copy of bit stream to avoid aliasing */
  212|     36|  bitstream s = *stream;
  213|     36|  bitstream_offset offset = stream_wtell(&s);
  214|     36|  uint intprec = (uint)(CHAR_BIT * sizeof(UInt));
  215|     36|  uint kmin = intprec > maxprec ? intprec - maxprec : 0;
  ------------------
  |  Branch (215:15): [True: 32, False: 4]
  ------------------
  216|     36|  uint i, k, n, c;
  217|       |
  218|       |  /* encode one bit plane at a time from MSB to LSB */
  219|    548|  for (k = intprec, n = 0; k-- > kmin;) {
  ------------------
  |  Branch (219:28): [True: 512, False: 36]
  ------------------
  220|       |    /* step 1: encode first n bits of bit plane #k */
  221|  86.9k|    for (i = 0; i < n; i++)
  ------------------
  |  Branch (221:17): [True: 86.4k, False: 512]
  ------------------
  222|  86.4k|      stream_write_bit(&s, (data[i] >> k) & 1u);
  223|       |    /* step 2: count remaining one-bits in bit plane */
  224|    512|    c = 0;
  225|  45.1k|    for (i = n; i < size; i++)
  ------------------
  |  Branch (225:17): [True: 44.6k, False: 512]
  ------------------
  226|  44.6k|      c += (data[i] >> k) & 1u;
  227|       |    /* step 3: unary run-length encode remainder of bit plane */
  228|  1.06k|    for (; n < size && stream_write_bit(&s, !!c); n++)
  ------------------
  |  Branch (228:12): [True: 783, False: 279]
  |  Branch (228:24): [True: 550, False: 233]
  ------------------
  229|  9.21k|      for (c--; n < size - 1 && !stream_write_bit(&s, (data[n] >> k) & 1u); n++)
  ------------------
  |  Branch (229:17): [True: 9.18k, False: 36]
  |  Branch (229:33): [True: 8.66k, False: 514]
  ------------------
  230|  8.66k|        ;
  231|    512|  }
  232|       |
  233|     36|  *stream = s;
  234|     36|  return (uint)(stream_wtell(&s) - offset);
  235|     36|}

zfp_encode_block_strided_double_2:
   45|      2|{
   46|       |  /* gather block from strided array */
   47|      2|  cache_align_(Scalar block[16]);
  ------------------
  |  |   42|      2|  #define cache_align_(x) x __attribute__((aligned(ZFP_CACHE_LINE_SIZE)))
  ------------------
   48|      2|  _t2(gather, Scalar, 2)(block, p, sx, sy);
  ------------------
  |  |   10|      2|#define _t2(function, type, dims) _cat3(function, type, dims)
  |  |  ------------------
  |  |  |  |    6|      2|#define _cat3(x, y, z) x ## _ ## y ## _ ## z
  |  |  ------------------
  ------------------
   49|       |  /* encode block */
   50|      2|  return _t2(zfp_encode_block, Scalar, 2)(stream, block);
  ------------------
  |  |   10|      2|#define _t2(function, type, dims) _cat3(function, type, dims)
  |  |  ------------------
  |  |  |  |    6|      2|#define _cat3(x, y, z) x ## _ ## y ## _ ## z
  |  |  ------------------
  ------------------
   51|      2|}
encode2d.c:fwd_xform_int64_2:
   30|      2|{
   31|      2|  uint x, y;
   32|       |  /* transform along x */
   33|     10|  for (y = 0; y < 4; y++)
  ------------------
  |  Branch (33:15): [True: 8, False: 2]
  ------------------
   34|      8|    _t1(fwd_lift, Int)(p + 4 * y, 1);
  ------------------
  |  |    9|      8|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|      8|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
   35|       |  /* transform along y */
   36|     10|  for (x = 0; x < 4; x++)
  ------------------
  |  Branch (36:15): [True: 8, False: 2]
  ------------------
   37|      8|    _t1(fwd_lift, Int)(p + 1 * x, 4);
  ------------------
  |  |    9|      8|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|      8|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
   38|      2|}
encode2d.c:gather_double_2:
    6|      2|{
    7|      2|  uint x, y;
    8|     10|  for (y = 0; y < 4; y++, p += sy - 4 * sx)
  ------------------
  |  Branch (8:15): [True: 8, False: 2]
  ------------------
    9|     40|    for (x = 0; x < 4; x++, p += sx)
  ------------------
  |  Branch (9:17): [True: 32, False: 8]
  ------------------
   10|     32|      *q++ = *p;
   11|      2|}

zfp_encode_block_strided_float_3:
   57|     29|{
   58|       |  /* gather block from strided array */
   59|     29|  cache_align_(Scalar block[64]);
  ------------------
  |  |   42|     29|  #define cache_align_(x) x __attribute__((aligned(ZFP_CACHE_LINE_SIZE)))
  ------------------
   60|     29|  _t2(gather, Scalar, 3)(block, p, sx, sy, sz);
  ------------------
  |  |   10|     29|#define _t2(function, type, dims) _cat3(function, type, dims)
  |  |  ------------------
  |  |  |  |    6|     29|#define _cat3(x, y, z) x ## _ ## y ## _ ## z
  |  |  ------------------
  ------------------
   61|       |  /* encode block */
   62|     29|  return _t2(zfp_encode_block, Scalar, 3)(stream, block);
  ------------------
  |  |   10|     29|#define _t2(function, type, dims) _cat3(function, type, dims)
  |  |  ------------------
  |  |  |  |    6|     29|#define _cat3(x, y, z) x ## _ ## y ## _ ## z
  |  |  ------------------
  ------------------
   63|     29|}
encode3f.c:fwd_xform_int32_3:
   36|     27|{
   37|     27|  uint x, y, z;
   38|       |  /* transform along x */
   39|    135|  for (z = 0; z < 4; z++)
  ------------------
  |  Branch (39:15): [True: 108, False: 27]
  ------------------
   40|    540|    for (y = 0; y < 4; y++)
  ------------------
  |  Branch (40:17): [True: 432, False: 108]
  ------------------
   41|    432|      _t1(fwd_lift, Int)(p + 4 * y + 16 * z, 1);
  ------------------
  |  |    9|    432|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|    432|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
   42|       |  /* transform along y */
   43|    135|  for (x = 0; x < 4; x++)
  ------------------
  |  Branch (43:15): [True: 108, False: 27]
  ------------------
   44|    540|    for (z = 0; z < 4; z++)
  ------------------
  |  Branch (44:17): [True: 432, False: 108]
  ------------------
   45|    432|      _t1(fwd_lift, Int)(p + 16 * z + 1 * x, 4);
  ------------------
  |  |    9|    432|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|    432|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
   46|       |  /* transform along z */
   47|    135|  for (y = 0; y < 4; y++)
  ------------------
  |  Branch (47:15): [True: 108, False: 27]
  ------------------
   48|    540|    for (x = 0; x < 4; x++)
  ------------------
  |  Branch (48:17): [True: 432, False: 108]
  ------------------
   49|    432|      _t1(fwd_lift, Int)(p + 1 * x + 4 * y, 16);
  ------------------
  |  |    9|    432|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|    432|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
   50|     27|}
encode3f.c:gather_float_3:
    6|     29|{
    7|     29|  uint x, y, z;
    8|    145|  for (z = 0; z < 4; z++, p += sz - 4 * sy)
  ------------------
  |  Branch (8:15): [True: 116, False: 29]
  ------------------
    9|    580|    for (y = 0; y < 4; y++, p += sy - 4 * sx)
  ------------------
  |  Branch (9:17): [True: 464, False: 116]
  ------------------
   10|  2.32k|      for (x = 0; x < 4; x++, p += sx)
  ------------------
  |  Branch (10:19): [True: 1.85k, False: 464]
  ------------------
   11|  1.85k|        *q++ = *p;
   12|     29|}
zfp_encode_block_strided_double_3:
   57|     32|{
   58|       |  /* gather block from strided array */
   59|     32|  cache_align_(Scalar block[64]);
  ------------------
  |  |   42|     32|  #define cache_align_(x) x __attribute__((aligned(ZFP_CACHE_LINE_SIZE)))
  ------------------
   60|     32|  _t2(gather, Scalar, 3)(block, p, sx, sy, sz);
  ------------------
  |  |   10|     32|#define _t2(function, type, dims) _cat3(function, type, dims)
  |  |  ------------------
  |  |  |  |    6|     32|#define _cat3(x, y, z) x ## _ ## y ## _ ## z
  |  |  ------------------
  ------------------
   61|       |  /* encode block */
   62|     32|  return _t2(zfp_encode_block, Scalar, 3)(stream, block);
  ------------------
  |  |   10|     32|#define _t2(function, type, dims) _cat3(function, type, dims)
  |  |  ------------------
  |  |  |  |    6|     32|#define _cat3(x, y, z) x ## _ ## y ## _ ## z
  |  |  ------------------
  ------------------
   63|     32|}
encode3d.c:fwd_xform_int64_3:
   36|     32|{
   37|     32|  uint x, y, z;
   38|       |  /* transform along x */
   39|    160|  for (z = 0; z < 4; z++)
  ------------------
  |  Branch (39:15): [True: 128, False: 32]
  ------------------
   40|    640|    for (y = 0; y < 4; y++)
  ------------------
  |  Branch (40:17): [True: 512, False: 128]
  ------------------
   41|    512|      _t1(fwd_lift, Int)(p + 4 * y + 16 * z, 1);
  ------------------
  |  |    9|    512|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|    512|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
   42|       |  /* transform along y */
   43|    160|  for (x = 0; x < 4; x++)
  ------------------
  |  Branch (43:15): [True: 128, False: 32]
  ------------------
   44|    640|    for (z = 0; z < 4; z++)
  ------------------
  |  Branch (44:17): [True: 512, False: 128]
  ------------------
   45|    512|      _t1(fwd_lift, Int)(p + 16 * z + 1 * x, 4);
  ------------------
  |  |    9|    512|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|    512|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
   46|       |  /* transform along z */
   47|    160|  for (y = 0; y < 4; y++)
  ------------------
  |  Branch (47:15): [True: 128, False: 32]
  ------------------
   48|    640|    for (x = 0; x < 4; x++)
  ------------------
  |  Branch (48:17): [True: 512, False: 128]
  ------------------
   49|    512|      _t1(fwd_lift, Int)(p + 1 * x + 4 * y, 16);
  ------------------
  |  |    9|    512|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|    512|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
   50|     32|}
encode3d.c:gather_double_3:
    6|     32|{
    7|     32|  uint x, y, z;
    8|    160|  for (z = 0; z < 4; z++, p += sz - 4 * sy)
  ------------------
  |  Branch (8:15): [True: 128, False: 32]
  ------------------
    9|    640|    for (y = 0; y < 4; y++, p += sy - 4 * sx)
  ------------------
  |  Branch (9:17): [True: 512, False: 128]
  ------------------
   10|  2.56k|      for (x = 0; x < 4; x++, p += sx)
  ------------------
  |  Branch (10:19): [True: 2.04k, False: 512]
  ------------------
   11|  2.04k|        *q++ = *p;
   12|     32|}

zfp_encode_block_strided_float_4:
   72|     60|{
   73|       |  /* gather block from strided array */
   74|     60|  cache_align_(Scalar block[256]);
  ------------------
  |  |   42|     60|  #define cache_align_(x) x __attribute__((aligned(ZFP_CACHE_LINE_SIZE)))
  ------------------
   75|     60|  _t2(gather, Scalar, 4)(block, p, sx, sy, sz, sw);
  ------------------
  |  |   10|     60|#define _t2(function, type, dims) _cat3(function, type, dims)
  |  |  ------------------
  |  |  |  |    6|     60|#define _cat3(x, y, z) x ## _ ## y ## _ ## z
  |  |  ------------------
  ------------------
   76|       |  /* encode block */
   77|     60|  return _t2(zfp_encode_block, Scalar, 4)(stream, block);
  ------------------
  |  |   10|     60|#define _t2(function, type, dims) _cat3(function, type, dims)
  |  |  ------------------
  |  |  |  |    6|     60|#define _cat3(x, y, z) x ## _ ## y ## _ ## z
  |  |  ------------------
  ------------------
   78|     60|}
encode4f.c:fwd_xform_int32_4:
   43|     58|{
   44|     58|  uint x, y, z, w;
   45|       |  /* transform along x */
   46|    290|  for (w = 0; w < 4; w++)
  ------------------
  |  Branch (46:15): [True: 232, False: 58]
  ------------------
   47|  1.16k|    for (z = 0; z < 4; z++)
  ------------------
  |  Branch (47:17): [True: 928, False: 232]
  ------------------
   48|  4.64k|      for (y = 0; y < 4; y++)
  ------------------
  |  Branch (48:19): [True: 3.71k, False: 928]
  ------------------
   49|  3.71k|        _t1(fwd_lift, Int)(p + 4 * y + 16 * z + 64 * w, 1);
  ------------------
  |  |    9|  3.71k|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|  3.71k|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
   50|       |  /* transform along y */
   51|    290|  for (x = 0; x < 4; x++)
  ------------------
  |  Branch (51:15): [True: 232, False: 58]
  ------------------
   52|  1.16k|    for (w = 0; w < 4; w++)
  ------------------
  |  Branch (52:17): [True: 928, False: 232]
  ------------------
   53|  4.64k|      for (z = 0; z < 4; z++)
  ------------------
  |  Branch (53:19): [True: 3.71k, False: 928]
  ------------------
   54|  3.71k|        _t1(fwd_lift, Int)(p + 16 * z + 64 * w + 1 * x, 4);
  ------------------
  |  |    9|  3.71k|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|  3.71k|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
   55|       |  /* transform along z */
   56|    290|  for (y = 0; y < 4; y++)
  ------------------
  |  Branch (56:15): [True: 232, False: 58]
  ------------------
   57|  1.16k|    for (x = 0; x < 4; x++)
  ------------------
  |  Branch (57:17): [True: 928, False: 232]
  ------------------
   58|  4.64k|      for (w = 0; w < 4; w++)
  ------------------
  |  Branch (58:19): [True: 3.71k, False: 928]
  ------------------
   59|  3.71k|        _t1(fwd_lift, Int)(p + 64 * w + 1 * x + 4 * y, 16);
  ------------------
  |  |    9|  3.71k|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|  3.71k|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
   60|       |  /* transform along w */
   61|    290|  for (z = 0; z < 4; z++)
  ------------------
  |  Branch (61:15): [True: 232, False: 58]
  ------------------
   62|  1.16k|    for (y = 0; y < 4; y++)
  ------------------
  |  Branch (62:17): [True: 928, False: 232]
  ------------------
   63|  4.64k|      for (x = 0; x < 4; x++)
  ------------------
  |  Branch (63:19): [True: 3.71k, False: 928]
  ------------------
   64|  3.71k|        _t1(fwd_lift, Int)(p + 1 * x + 4 * y + 16 * z, 64);
  ------------------
  |  |    9|  3.71k|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|  3.71k|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
   65|     58|}
encode4f.c:gather_float_4:
    6|     60|{
    7|     60|  uint x, y, z, w;
    8|    300|  for (w = 0; w < 4; w++, p += sw - 4 * sz)
  ------------------
  |  Branch (8:15): [True: 240, False: 60]
  ------------------
    9|  1.20k|    for (z = 0; z < 4; z++, p += sz - 4 * sy)
  ------------------
  |  Branch (9:17): [True: 960, False: 240]
  ------------------
   10|  4.80k|      for (y = 0; y < 4; y++, p += sy - 4 * sx)
  ------------------
  |  Branch (10:19): [True: 3.84k, False: 960]
  ------------------
   11|  19.2k|        for (x = 0; x < 4; x++, p += sx)
  ------------------
  |  Branch (11:21): [True: 15.3k, False: 3.84k]
  ------------------
   12|  15.3k|          *q++ = *p;
   13|     60|}
zfp_encode_block_strided_double_4:
   72|      7|{
   73|       |  /* gather block from strided array */
   74|      7|  cache_align_(Scalar block[256]);
  ------------------
  |  |   42|      7|  #define cache_align_(x) x __attribute__((aligned(ZFP_CACHE_LINE_SIZE)))
  ------------------
   75|      7|  _t2(gather, Scalar, 4)(block, p, sx, sy, sz, sw);
  ------------------
  |  |   10|      7|#define _t2(function, type, dims) _cat3(function, type, dims)
  |  |  ------------------
  |  |  |  |    6|      7|#define _cat3(x, y, z) x ## _ ## y ## _ ## z
  |  |  ------------------
  ------------------
   76|       |  /* encode block */
   77|      7|  return _t2(zfp_encode_block, Scalar, 4)(stream, block);
  ------------------
  |  |   10|      7|#define _t2(function, type, dims) _cat3(function, type, dims)
  |  |  ------------------
  |  |  |  |    6|      7|#define _cat3(x, y, z) x ## _ ## y ## _ ## z
  |  |  ------------------
  ------------------
   78|      7|}
encode4d.c:gather_double_4:
    6|      7|{
    7|      7|  uint x, y, z, w;
    8|     35|  for (w = 0; w < 4; w++, p += sw - 4 * sz)
  ------------------
  |  Branch (8:15): [True: 28, False: 7]
  ------------------
    9|    140|    for (z = 0; z < 4; z++, p += sz - 4 * sy)
  ------------------
  |  Branch (9:17): [True: 112, False: 28]
  ------------------
   10|    560|      for (y = 0; y < 4; y++, p += sy - 4 * sx)
  ------------------
  |  Branch (10:19): [True: 448, False: 112]
  ------------------
   11|  2.24k|        for (x = 0; x < 4; x++, p += sx)
  ------------------
  |  Branch (11:21): [True: 1.79k, False: 448]
  ------------------
   12|  1.79k|          *q++ = *p;
   13|      7|}

zfp_encode_block_double_2:
   97|      2|{
   98|      2|  return REVERSIBLE(zfp) ? _t2(rev_encode_block, Scalar, DIMS)(zfp, fblock) : _t2(encode_block, Scalar, DIMS)(zfp, fblock);
  ------------------
  |  |    4|      2|#define REVERSIBLE(zfp) ((zfp)->minexp < ZFP_MIN_EXP) /* reversible mode? */
  |  |  ------------------
  |  |  |  |   21|      2|#define ZFP_MIN_EXP  -1074 /* minimum floating-point base-2 exponent */
  |  |  ------------------
  |  |  |  Branch (4:25): [True: 0, False: 2]
  |  |  ------------------
  ------------------
                return REVERSIBLE(zfp) ? _t2(rev_encode_block, Scalar, DIMS)(zfp, fblock) : _t2(encode_block, Scalar, DIMS)(zfp, fblock);
  ------------------
  |  |   10|      0|#define _t2(function, type, dims) _cat3(function, type, dims)
  |  |  ------------------
  |  |  |  |    6|      0|#define _cat3(x, y, z) x ## _ ## y ## _ ## z
  |  |  ------------------
  ------------------
                return REVERSIBLE(zfp) ? _t2(rev_encode_block, Scalar, DIMS)(zfp, fblock) : _t2(encode_block, Scalar, DIMS)(zfp, fblock);
  ------------------
  |  |   10|      2|#define _t2(function, type, dims) _cat3(function, type, dims)
  |  |  ------------------
  |  |  |  |    6|      2|#define _cat3(x, y, z) x ## _ ## y ## _ ## z
  |  |  ------------------
  ------------------
   99|      2|}
encode2d.c:encode_block_double_2:
   64|      2|{
   65|      2|  uint bits = 1;
   66|       |  /* compute maximum exponent */
   67|      2|  int emax = _t1(exponent_block, Scalar)(fblock, BLOCK_SIZE);
  ------------------
  |  |    9|      2|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|      2|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
                int emax = _t1(exponent_block, Scalar)(fblock, BLOCK_SIZE);
  ------------------
  |  |    2|      2|#define BLOCK_SIZE (1 << (2 * DIMS))   /* values per block */
  |  |  ------------------
  |  |  |  |    1|      2|#define DIMS 2
  |  |  ------------------
  ------------------
   68|      2|  uint maxprec = precision(emax, zfp->maxprec, zfp->minexp, DIMS);
  ------------------
  |  |    1|      2|#define DIMS 2
  ------------------
   69|      2|  uint e = maxprec ? (uint)(emax + EBIAS) : 0;
  ------------------
  |  |    3|      2|#define EBIAS ((1 << (EBITS - 1)) - 1) /* exponent bias */
  |  |  ------------------
  |  |  |  |    6|      2|#define EBITS 11                           /* number of exponent bits */
  |  |  ------------------
  ------------------
  |  Branch (69:12): [True: 2, False: 0]
  ------------------
   70|       |  /* encode block only if biased exponent is nonzero */
   71|      2|  if (e) {
  ------------------
  |  Branch (71:7): [True: 2, False: 0]
  ------------------
   72|      2|    cache_align_(Int iblock[BLOCK_SIZE]);
  ------------------
  |  |   42|      2|  #define cache_align_(x) x __attribute__((aligned(ZFP_CACHE_LINE_SIZE)))
  ------------------
   73|       |    /* encode common exponent; LSB indicates that exponent is nonzero */
   74|      2|    bits += EBITS;
  ------------------
  |  |    6|      2|#define EBITS 11                           /* number of exponent bits */
  ------------------
   75|      2|    stream_write_bits(zfp->stream, 2 * e + 1, bits);
   76|       |    /* perform forward block-floating-point transform */
   77|      2|    _t1(fwd_cast, Scalar)(iblock, fblock, BLOCK_SIZE, emax);
  ------------------
  |  |    9|      2|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|      2|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
                  _t1(fwd_cast, Scalar)(iblock, fblock, BLOCK_SIZE, emax);
  ------------------
  |  |    2|      2|#define BLOCK_SIZE (1 << (2 * DIMS))   /* values per block */
  |  |  ------------------
  |  |  |  |    1|      2|#define DIMS 2
  |  |  ------------------
  ------------------
   78|       |    /* encode integer block */
   79|      2|    bits += _t2(encode_block, Int, DIMS)(zfp->stream, zfp->minbits - MIN(bits, zfp->minbits), zfp->maxbits - bits, maxprec, iblock);
  ------------------
  |  |   10|      2|#define _t2(function, type, dims) _cat3(function, type, dims)
  |  |  ------------------
  |  |  |  |    6|      2|#define _cat3(x, y, z) x ## _ ## y ## _ ## z
  |  |  ------------------
  ------------------
                  bits += _t2(encode_block, Int, DIMS)(zfp->stream, zfp->minbits - MIN(bits, zfp->minbits), zfp->maxbits - bits, maxprec, iblock);
  ------------------
  |  |    4|      2|#define MIN(x, y) ((x) < (y) ? (x) : (y))
  |  |  ------------------
  |  |  |  Branch (4:20): [True: 0, False: 2]
  |  |  ------------------
  ------------------
   80|      2|  }
   81|      0|  else {
   82|       |    /* write single zero-bit to indicate that all values are zero */
   83|      0|    stream_write_bit(zfp->stream, 0);
   84|      0|    if (zfp->minbits > bits) {
  ------------------
  |  Branch (84:9): [True: 0, False: 0]
  ------------------
   85|      0|      stream_pad(zfp->stream, zfp->minbits - bits);
   86|      0|      bits = zfp->minbits;
   87|      0|    }
   88|      0|  }
   89|      2|  return bits;
   90|      2|}
encode2d.c:exponent_block_double:
   32|      2|{
   33|      2|  Scalar max = 0;
  ------------------
  |  |    3|      2|#define Scalar double                      /* floating-point type */
  ------------------
   34|     32|  do {
   35|     32|    Scalar f = FABS(*p++);
  ------------------
  |  |    3|     32|#define Scalar double                      /* floating-point type */
  ------------------
                  Scalar f = FABS(*p++);
  ------------------
  |  |   12|     32|#define FABS(x) fabs(x)
  ------------------
   36|     32|    if (max < f)
  ------------------
  |  Branch (36:9): [True: 7, False: 25]
  ------------------
   37|      7|      max = f;
   38|     32|  } while (--n);
  ------------------
  |  Branch (38:12): [True: 30, False: 2]
  ------------------
   39|      2|  return _t1(exponent, Scalar)(max);
  ------------------
  |  |    9|      2|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|      2|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
   40|      2|}
encode2d.c:exponent_double:
   12|      2|{
   13|       |  /* use e = -EBIAS when x = 0 */
   14|      2|  int e = -EBIAS;
  ------------------
  |  |    3|      2|#define EBIAS ((1 << (EBITS - 1)) - 1) /* exponent bias */
  |  |  ------------------
  |  |  |  |    6|      2|#define EBITS 11                           /* number of exponent bits */
  |  |  ------------------
  ------------------
   15|       |#ifdef ZFP_WITH_DAZ
   16|       |  /* treat subnormals as zero; resolves issue #119 by avoiding overflow */
   17|       |  if (x >= SCALAR_MIN)
   18|       |    FREXP(x, &e);
   19|       |#else
   20|      2|  if (x > 0) {
  ------------------
  |  Branch (20:7): [True: 2, False: 0]
  ------------------
   21|      2|    FREXP(x, &e);
  ------------------
  |  |   13|      2|#define FREXP(x, e) frexp(x, e)
  ------------------
   22|       |    /* clamp exponent in case x is subnormal; may still result in overflow */
   23|      2|    e = MAX(e, 1 - EBIAS);
  ------------------
  |  |    5|      2|#define MAX(x, y) ((x) > (y) ? (x) : (y))
  |  |  ------------------
  |  |  |  Branch (5:20): [True: 2, False: 0]
  |  |  ------------------
  ------------------
   24|      2|  }
   25|      2|#endif
   26|      2|  return e;
   27|      2|}
encode2d.c:fwd_cast_double:
   52|      2|{
   53|       |  /* compute power-of-two scale factor s */
   54|      2|  Scalar s = _t1(quantize, Scalar)(1, emax);
  ------------------
  |  |    3|      2|#define Scalar double                      /* floating-point type */
  ------------------
                Scalar s = _t1(quantize, Scalar)(1, emax);
  ------------------
  |  |    9|      2|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|      2|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
   55|       |  /* compute p-bit int y = s*x where x is floating and |y| <= 2^(p-2) - 1 */
   56|      2|  do
   57|     32|    *iblock++ = (Int)(s * *fblock++);
   58|     32|  while (--n);
  ------------------
  |  Branch (58:10): [True: 30, False: 2]
  ------------------
   59|      2|}
encode2d.c:quantize_double:
   45|      2|{
   46|      2|  return LDEXP(x, ((int)(CHAR_BIT * sizeof(Scalar)) - 2) - e);
  ------------------
  |  |   14|      2|#define LDEXP(x, e) ldexp(x, e)
  ------------------
   47|      2|}
zfp_encode_block_float_3:
   97|     29|{
   98|     29|  return REVERSIBLE(zfp) ? _t2(rev_encode_block, Scalar, DIMS)(zfp, fblock) : _t2(encode_block, Scalar, DIMS)(zfp, fblock);
  ------------------
  |  |    4|     29|#define REVERSIBLE(zfp) ((zfp)->minexp < ZFP_MIN_EXP) /* reversible mode? */
  |  |  ------------------
  |  |  |  |   21|     29|#define ZFP_MIN_EXP  -1074 /* minimum floating-point base-2 exponent */
  |  |  ------------------
  |  |  |  Branch (4:25): [True: 0, False: 29]
  |  |  ------------------
  ------------------
                return REVERSIBLE(zfp) ? _t2(rev_encode_block, Scalar, DIMS)(zfp, fblock) : _t2(encode_block, Scalar, DIMS)(zfp, fblock);
  ------------------
  |  |   10|      0|#define _t2(function, type, dims) _cat3(function, type, dims)
  |  |  ------------------
  |  |  |  |    6|      0|#define _cat3(x, y, z) x ## _ ## y ## _ ## z
  |  |  ------------------
  ------------------
                return REVERSIBLE(zfp) ? _t2(rev_encode_block, Scalar, DIMS)(zfp, fblock) : _t2(encode_block, Scalar, DIMS)(zfp, fblock);
  ------------------
  |  |   10|     29|#define _t2(function, type, dims) _cat3(function, type, dims)
  |  |  ------------------
  |  |  |  |    6|     29|#define _cat3(x, y, z) x ## _ ## y ## _ ## z
  |  |  ------------------
  ------------------
   99|     29|}
encode3f.c:encode_block_float_3:
   64|     29|{
   65|     29|  uint bits = 1;
   66|       |  /* compute maximum exponent */
   67|     29|  int emax = _t1(exponent_block, Scalar)(fblock, BLOCK_SIZE);
  ------------------
  |  |    9|     29|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|     29|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
                int emax = _t1(exponent_block, Scalar)(fblock, BLOCK_SIZE);
  ------------------
  |  |    2|     29|#define BLOCK_SIZE (1 << (2 * DIMS))   /* values per block */
  |  |  ------------------
  |  |  |  |    1|     29|#define DIMS 3
  |  |  ------------------
  ------------------
   68|     29|  uint maxprec = precision(emax, zfp->maxprec, zfp->minexp, DIMS);
  ------------------
  |  |    1|     29|#define DIMS 3
  ------------------
   69|     29|  uint e = maxprec ? (uint)(emax + EBIAS) : 0;
  ------------------
  |  |    3|     27|#define EBIAS ((1 << (EBITS - 1)) - 1) /* exponent bias */
  |  |  ------------------
  |  |  |  |    6|     27|#define EBITS 8            /* number of exponent bits */
  |  |  ------------------
  ------------------
  |  Branch (69:12): [True: 27, False: 2]
  ------------------
   70|       |  /* encode block only if biased exponent is nonzero */
   71|     29|  if (e) {
  ------------------
  |  Branch (71:7): [True: 27, False: 2]
  ------------------
   72|     27|    cache_align_(Int iblock[BLOCK_SIZE]);
  ------------------
  |  |   42|     27|  #define cache_align_(x) x __attribute__((aligned(ZFP_CACHE_LINE_SIZE)))
  ------------------
   73|       |    /* encode common exponent; LSB indicates that exponent is nonzero */
   74|     27|    bits += EBITS;
  ------------------
  |  |    6|     27|#define EBITS 8            /* number of exponent bits */
  ------------------
   75|     27|    stream_write_bits(zfp->stream, 2 * e + 1, bits);
   76|       |    /* perform forward block-floating-point transform */
   77|     27|    _t1(fwd_cast, Scalar)(iblock, fblock, BLOCK_SIZE, emax);
  ------------------
  |  |    9|     27|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|     27|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
                  _t1(fwd_cast, Scalar)(iblock, fblock, BLOCK_SIZE, emax);
  ------------------
  |  |    2|     27|#define BLOCK_SIZE (1 << (2 * DIMS))   /* values per block */
  |  |  ------------------
  |  |  |  |    1|     27|#define DIMS 3
  |  |  ------------------
  ------------------
   78|       |    /* encode integer block */
   79|     27|    bits += _t2(encode_block, Int, DIMS)(zfp->stream, zfp->minbits - MIN(bits, zfp->minbits), zfp->maxbits - bits, maxprec, iblock);
  ------------------
  |  |   10|     27|#define _t2(function, type, dims) _cat3(function, type, dims)
  |  |  ------------------
  |  |  |  |    6|     27|#define _cat3(x, y, z) x ## _ ## y ## _ ## z
  |  |  ------------------
  ------------------
                  bits += _t2(encode_block, Int, DIMS)(zfp->stream, zfp->minbits - MIN(bits, zfp->minbits), zfp->maxbits - bits, maxprec, iblock);
  ------------------
  |  |    4|     27|#define MIN(x, y) ((x) < (y) ? (x) : (y))
  |  |  ------------------
  |  |  |  Branch (4:20): [True: 9, False: 18]
  |  |  ------------------
  ------------------
   80|     27|  }
   81|      2|  else {
   82|       |    /* write single zero-bit to indicate that all values are zero */
   83|      2|    stream_write_bit(zfp->stream, 0);
   84|      2|    if (zfp->minbits > bits) {
  ------------------
  |  Branch (84:9): [True: 0, False: 2]
  ------------------
   85|      0|      stream_pad(zfp->stream, zfp->minbits - bits);
   86|      0|      bits = zfp->minbits;
   87|      0|    }
   88|      2|  }
   89|     29|  return bits;
   90|     29|}
encode3f.c:exponent_block_float:
   32|     29|{
   33|     29|  Scalar max = 0;
  ------------------
  |  |    3|     29|#define Scalar float       /* floating-point type */
  ------------------
   34|  1.85k|  do {
   35|  1.85k|    Scalar f = FABS(*p++);
  ------------------
  |  |    3|  1.85k|#define Scalar float       /* floating-point type */
  ------------------
                  Scalar f = FABS(*p++);
  ------------------
  |  |   13|  1.85k|  #define FABS(x)     fabsf(x)
  ------------------
   36|  1.85k|    if (max < f)
  ------------------
  |  Branch (36:9): [True: 453, False: 1.40k]
  ------------------
   37|    453|      max = f;
   38|  1.85k|  } while (--n);
  ------------------
  |  Branch (38:12): [True: 1.82k, False: 29]
  ------------------
   39|     29|  return _t1(exponent, Scalar)(max);
  ------------------
  |  |    9|     29|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|     29|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
   40|     29|}
encode3f.c:exponent_float:
   12|     29|{
   13|       |  /* use e = -EBIAS when x = 0 */
   14|     29|  int e = -EBIAS;
  ------------------
  |  |    3|     29|#define EBIAS ((1 << (EBITS - 1)) - 1) /* exponent bias */
  |  |  ------------------
  |  |  |  |    6|     29|#define EBITS 8            /* number of exponent bits */
  |  |  ------------------
  ------------------
   15|       |#ifdef ZFP_WITH_DAZ
   16|       |  /* treat subnormals as zero; resolves issue #119 by avoiding overflow */
   17|       |  if (x >= SCALAR_MIN)
   18|       |    FREXP(x, &e);
   19|       |#else
   20|     29|  if (x > 0) {
  ------------------
  |  Branch (20:7): [True: 29, False: 0]
  ------------------
   21|     29|    FREXP(x, &e);
  ------------------
  |  |   14|     29|  #define FREXP(x, e) frexpf(x, e)
  ------------------
   22|       |    /* clamp exponent in case x is subnormal; may still result in overflow */
   23|     29|    e = MAX(e, 1 - EBIAS);
  ------------------
  |  |    5|     29|#define MAX(x, y) ((x) > (y) ? (x) : (y))
  |  |  ------------------
  |  |  |  Branch (5:20): [True: 27, False: 2]
  |  |  ------------------
  ------------------
   24|     29|  }
   25|     29|#endif
   26|     29|  return e;
   27|     29|}
encode3f.c:fwd_cast_float:
   52|     27|{
   53|       |  /* compute power-of-two scale factor s */
   54|     27|  Scalar s = _t1(quantize, Scalar)(1, emax);
  ------------------
  |  |    3|     27|#define Scalar float       /* floating-point type */
  ------------------
                Scalar s = _t1(quantize, Scalar)(1, emax);
  ------------------
  |  |    9|     27|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|     27|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
   55|       |  /* compute p-bit int y = s*x where x is floating and |y| <= 2^(p-2) - 1 */
   56|     27|  do
   57|  1.72k|    *iblock++ = (Int)(s * *fblock++);
   58|  1.72k|  while (--n);
  ------------------
  |  Branch (58:10): [True: 1.70k, False: 27]
  ------------------
   59|     27|}
encode3f.c:quantize_float:
   45|     27|{
   46|     27|  return LDEXP(x, ((int)(CHAR_BIT * sizeof(Scalar)) - 2) - e);
  ------------------
  |  |   15|     27|  #define LDEXP(x, e) ldexpf(x, e)
  ------------------
   47|     27|}
zfp_encode_block_double_3:
   97|     32|{
   98|     32|  return REVERSIBLE(zfp) ? _t2(rev_encode_block, Scalar, DIMS)(zfp, fblock) : _t2(encode_block, Scalar, DIMS)(zfp, fblock);
  ------------------
  |  |    4|     32|#define REVERSIBLE(zfp) ((zfp)->minexp < ZFP_MIN_EXP) /* reversible mode? */
  |  |  ------------------
  |  |  |  |   21|     32|#define ZFP_MIN_EXP  -1074 /* minimum floating-point base-2 exponent */
  |  |  ------------------
  |  |  |  Branch (4:25): [True: 0, False: 32]
  |  |  ------------------
  ------------------
                return REVERSIBLE(zfp) ? _t2(rev_encode_block, Scalar, DIMS)(zfp, fblock) : _t2(encode_block, Scalar, DIMS)(zfp, fblock);
  ------------------
  |  |   10|      0|#define _t2(function, type, dims) _cat3(function, type, dims)
  |  |  ------------------
  |  |  |  |    6|      0|#define _cat3(x, y, z) x ## _ ## y ## _ ## z
  |  |  ------------------
  ------------------
                return REVERSIBLE(zfp) ? _t2(rev_encode_block, Scalar, DIMS)(zfp, fblock) : _t2(encode_block, Scalar, DIMS)(zfp, fblock);
  ------------------
  |  |   10|     32|#define _t2(function, type, dims) _cat3(function, type, dims)
  |  |  ------------------
  |  |  |  |    6|     32|#define _cat3(x, y, z) x ## _ ## y ## _ ## z
  |  |  ------------------
  ------------------
   99|     32|}
encode3d.c:encode_block_double_3:
   64|     32|{
   65|     32|  uint bits = 1;
   66|       |  /* compute maximum exponent */
   67|     32|  int emax = _t1(exponent_block, Scalar)(fblock, BLOCK_SIZE);
  ------------------
  |  |    9|     32|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|     32|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
                int emax = _t1(exponent_block, Scalar)(fblock, BLOCK_SIZE);
  ------------------
  |  |    2|     32|#define BLOCK_SIZE (1 << (2 * DIMS))   /* values per block */
  |  |  ------------------
  |  |  |  |    1|     32|#define DIMS 3
  |  |  ------------------
  ------------------
   68|     32|  uint maxprec = precision(emax, zfp->maxprec, zfp->minexp, DIMS);
  ------------------
  |  |    1|     32|#define DIMS 3
  ------------------
   69|     32|  uint e = maxprec ? (uint)(emax + EBIAS) : 0;
  ------------------
  |  |    3|     32|#define EBIAS ((1 << (EBITS - 1)) - 1) /* exponent bias */
  |  |  ------------------
  |  |  |  |    6|     32|#define EBITS 11                           /* number of exponent bits */
  |  |  ------------------
  ------------------
  |  Branch (69:12): [True: 32, False: 0]
  ------------------
   70|       |  /* encode block only if biased exponent is nonzero */
   71|     32|  if (e) {
  ------------------
  |  Branch (71:7): [True: 32, False: 0]
  ------------------
   72|     32|    cache_align_(Int iblock[BLOCK_SIZE]);
  ------------------
  |  |   42|     32|  #define cache_align_(x) x __attribute__((aligned(ZFP_CACHE_LINE_SIZE)))
  ------------------
   73|       |    /* encode common exponent; LSB indicates that exponent is nonzero */
   74|     32|    bits += EBITS;
  ------------------
  |  |    6|     32|#define EBITS 11                           /* number of exponent bits */
  ------------------
   75|     32|    stream_write_bits(zfp->stream, 2 * e + 1, bits);
   76|       |    /* perform forward block-floating-point transform */
   77|     32|    _t1(fwd_cast, Scalar)(iblock, fblock, BLOCK_SIZE, emax);
  ------------------
  |  |    9|     32|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|     32|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
                  _t1(fwd_cast, Scalar)(iblock, fblock, BLOCK_SIZE, emax);
  ------------------
  |  |    2|     32|#define BLOCK_SIZE (1 << (2 * DIMS))   /* values per block */
  |  |  ------------------
  |  |  |  |    1|     32|#define DIMS 3
  |  |  ------------------
  ------------------
   78|       |    /* encode integer block */
   79|     32|    bits += _t2(encode_block, Int, DIMS)(zfp->stream, zfp->minbits - MIN(bits, zfp->minbits), zfp->maxbits - bits, maxprec, iblock);
  ------------------
  |  |   10|     32|#define _t2(function, type, dims) _cat3(function, type, dims)
  |  |  ------------------
  |  |  |  |    6|     32|#define _cat3(x, y, z) x ## _ ## y ## _ ## z
  |  |  ------------------
  ------------------
                  bits += _t2(encode_block, Int, DIMS)(zfp->stream, zfp->minbits - MIN(bits, zfp->minbits), zfp->maxbits - bits, maxprec, iblock);
  ------------------
  |  |    4|     32|#define MIN(x, y) ((x) < (y) ? (x) : (y))
  |  |  ------------------
  |  |  |  Branch (4:20): [True: 16, False: 16]
  |  |  ------------------
  ------------------
   80|     32|  }
   81|      0|  else {
   82|       |    /* write single zero-bit to indicate that all values are zero */
   83|      0|    stream_write_bit(zfp->stream, 0);
   84|      0|    if (zfp->minbits > bits) {
  ------------------
  |  Branch (84:9): [True: 0, False: 0]
  ------------------
   85|      0|      stream_pad(zfp->stream, zfp->minbits - bits);
   86|      0|      bits = zfp->minbits;
   87|      0|    }
   88|      0|  }
   89|     32|  return bits;
   90|     32|}
encode3d.c:exponent_block_double:
   32|     32|{
   33|     32|  Scalar max = 0;
  ------------------
  |  |    3|     32|#define Scalar double                      /* floating-point type */
  ------------------
   34|  2.04k|  do {
   35|  2.04k|    Scalar f = FABS(*p++);
  ------------------
  |  |    3|  2.04k|#define Scalar double                      /* floating-point type */
  ------------------
                  Scalar f = FABS(*p++);
  ------------------
  |  |   12|  2.04k|#define FABS(x) fabs(x)
  ------------------
   36|  2.04k|    if (max < f)
  ------------------
  |  Branch (36:9): [True: 552, False: 1.49k]
  ------------------
   37|    552|      max = f;
   38|  2.04k|  } while (--n);
  ------------------
  |  Branch (38:12): [True: 2.01k, False: 32]
  ------------------
   39|     32|  return _t1(exponent, Scalar)(max);
  ------------------
  |  |    9|     32|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|     32|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
   40|     32|}
encode3d.c:exponent_double:
   12|     32|{
   13|       |  /* use e = -EBIAS when x = 0 */
   14|     32|  int e = -EBIAS;
  ------------------
  |  |    3|     32|#define EBIAS ((1 << (EBITS - 1)) - 1) /* exponent bias */
  |  |  ------------------
  |  |  |  |    6|     32|#define EBITS 11                           /* number of exponent bits */
  |  |  ------------------
  ------------------
   15|       |#ifdef ZFP_WITH_DAZ
   16|       |  /* treat subnormals as zero; resolves issue #119 by avoiding overflow */
   17|       |  if (x >= SCALAR_MIN)
   18|       |    FREXP(x, &e);
   19|       |#else
   20|     32|  if (x > 0) {
  ------------------
  |  Branch (20:7): [True: 32, False: 0]
  ------------------
   21|     32|    FREXP(x, &e);
  ------------------
  |  |   13|     32|#define FREXP(x, e) frexp(x, e)
  ------------------
   22|       |    /* clamp exponent in case x is subnormal; may still result in overflow */
   23|     32|    e = MAX(e, 1 - EBIAS);
  ------------------
  |  |    5|     32|#define MAX(x, y) ((x) > (y) ? (x) : (y))
  |  |  ------------------
  |  |  |  Branch (5:20): [True: 32, False: 0]
  |  |  ------------------
  ------------------
   24|     32|  }
   25|     32|#endif
   26|     32|  return e;
   27|     32|}
encode3d.c:fwd_cast_double:
   52|     32|{
   53|       |  /* compute power-of-two scale factor s */
   54|     32|  Scalar s = _t1(quantize, Scalar)(1, emax);
  ------------------
  |  |    3|     32|#define Scalar double                      /* floating-point type */
  ------------------
                Scalar s = _t1(quantize, Scalar)(1, emax);
  ------------------
  |  |    9|     32|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|     32|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
   55|       |  /* compute p-bit int y = s*x where x is floating and |y| <= 2^(p-2) - 1 */
   56|     32|  do
   57|  2.04k|    *iblock++ = (Int)(s * *fblock++);
   58|  2.04k|  while (--n);
  ------------------
  |  Branch (58:10): [True: 2.01k, False: 32]
  ------------------
   59|     32|}
encode3d.c:quantize_double:
   45|     32|{
   46|     32|  return LDEXP(x, ((int)(CHAR_BIT * sizeof(Scalar)) - 2) - e);
  ------------------
  |  |   14|     32|#define LDEXP(x, e) ldexp(x, e)
  ------------------
   47|     32|}
zfp_encode_block_float_4:
   97|     60|{
   98|     60|  return REVERSIBLE(zfp) ? _t2(rev_encode_block, Scalar, DIMS)(zfp, fblock) : _t2(encode_block, Scalar, DIMS)(zfp, fblock);
  ------------------
  |  |    4|     60|#define REVERSIBLE(zfp) ((zfp)->minexp < ZFP_MIN_EXP) /* reversible mode? */
  |  |  ------------------
  |  |  |  |   21|     60|#define ZFP_MIN_EXP  -1074 /* minimum floating-point base-2 exponent */
  |  |  ------------------
  |  |  |  Branch (4:25): [True: 0, False: 60]
  |  |  ------------------
  ------------------
                return REVERSIBLE(zfp) ? _t2(rev_encode_block, Scalar, DIMS)(zfp, fblock) : _t2(encode_block, Scalar, DIMS)(zfp, fblock);
  ------------------
  |  |   10|      0|#define _t2(function, type, dims) _cat3(function, type, dims)
  |  |  ------------------
  |  |  |  |    6|      0|#define _cat3(x, y, z) x ## _ ## y ## _ ## z
  |  |  ------------------
  ------------------
                return REVERSIBLE(zfp) ? _t2(rev_encode_block, Scalar, DIMS)(zfp, fblock) : _t2(encode_block, Scalar, DIMS)(zfp, fblock);
  ------------------
  |  |   10|     60|#define _t2(function, type, dims) _cat3(function, type, dims)
  |  |  ------------------
  |  |  |  |    6|     60|#define _cat3(x, y, z) x ## _ ## y ## _ ## z
  |  |  ------------------
  ------------------
   99|     60|}
encode4f.c:encode_block_float_4:
   64|     60|{
   65|     60|  uint bits = 1;
   66|       |  /* compute maximum exponent */
   67|     60|  int emax = _t1(exponent_block, Scalar)(fblock, BLOCK_SIZE);
  ------------------
  |  |    9|     60|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|     60|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
                int emax = _t1(exponent_block, Scalar)(fblock, BLOCK_SIZE);
  ------------------
  |  |    2|     60|#define BLOCK_SIZE (1 << (2 * DIMS))   /* values per block */
  |  |  ------------------
  |  |  |  |    1|     60|#define DIMS 4
  |  |  ------------------
  ------------------
   68|     60|  uint maxprec = precision(emax, zfp->maxprec, zfp->minexp, DIMS);
  ------------------
  |  |    1|     60|#define DIMS 4
  ------------------
   69|     60|  uint e = maxprec ? (uint)(emax + EBIAS) : 0;
  ------------------
  |  |    3|     60|#define EBIAS ((1 << (EBITS - 1)) - 1) /* exponent bias */
  |  |  ------------------
  |  |  |  |    6|     60|#define EBITS 8            /* number of exponent bits */
  |  |  ------------------
  ------------------
  |  Branch (69:12): [True: 60, False: 0]
  ------------------
   70|       |  /* encode block only if biased exponent is nonzero */
   71|     60|  if (e) {
  ------------------
  |  Branch (71:7): [True: 58, False: 2]
  ------------------
   72|     58|    cache_align_(Int iblock[BLOCK_SIZE]);
  ------------------
  |  |   42|     58|  #define cache_align_(x) x __attribute__((aligned(ZFP_CACHE_LINE_SIZE)))
  ------------------
   73|       |    /* encode common exponent; LSB indicates that exponent is nonzero */
   74|     58|    bits += EBITS;
  ------------------
  |  |    6|     58|#define EBITS 8            /* number of exponent bits */
  ------------------
   75|     58|    stream_write_bits(zfp->stream, 2 * e + 1, bits);
   76|       |    /* perform forward block-floating-point transform */
   77|     58|    _t1(fwd_cast, Scalar)(iblock, fblock, BLOCK_SIZE, emax);
  ------------------
  |  |    9|     58|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|     58|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
                  _t1(fwd_cast, Scalar)(iblock, fblock, BLOCK_SIZE, emax);
  ------------------
  |  |    2|     58|#define BLOCK_SIZE (1 << (2 * DIMS))   /* values per block */
  |  |  ------------------
  |  |  |  |    1|     58|#define DIMS 4
  |  |  ------------------
  ------------------
   78|       |    /* encode integer block */
   79|     58|    bits += _t2(encode_block, Int, DIMS)(zfp->stream, zfp->minbits - MIN(bits, zfp->minbits), zfp->maxbits - bits, maxprec, iblock);
  ------------------
  |  |   10|     58|#define _t2(function, type, dims) _cat3(function, type, dims)
  |  |  ------------------
  |  |  |  |    6|     58|#define _cat3(x, y, z) x ## _ ## y ## _ ## z
  |  |  ------------------
  ------------------
                  bits += _t2(encode_block, Int, DIMS)(zfp->stream, zfp->minbits - MIN(bits, zfp->minbits), zfp->maxbits - bits, maxprec, iblock);
  ------------------
  |  |    4|     58|#define MIN(x, y) ((x) < (y) ? (x) : (y))
  |  |  ------------------
  |  |  |  Branch (4:20): [True: 22, False: 36]
  |  |  ------------------
  ------------------
   80|     58|  }
   81|      2|  else {
   82|       |    /* write single zero-bit to indicate that all values are zero */
   83|      2|    stream_write_bit(zfp->stream, 0);
   84|      2|    if (zfp->minbits > bits) {
  ------------------
  |  Branch (84:9): [True: 2, False: 0]
  ------------------
   85|      2|      stream_pad(zfp->stream, zfp->minbits - bits);
   86|      2|      bits = zfp->minbits;
   87|      2|    }
   88|      2|  }
   89|     60|  return bits;
   90|     60|}
encode4f.c:exponent_block_float:
   32|     60|{
   33|     60|  Scalar max = 0;
  ------------------
  |  |    3|     60|#define Scalar float       /* floating-point type */
  ------------------
   34|  15.3k|  do {
   35|  15.3k|    Scalar f = FABS(*p++);
  ------------------
  |  |    3|  15.3k|#define Scalar float       /* floating-point type */
  ------------------
                  Scalar f = FABS(*p++);
  ------------------
  |  |   13|  15.3k|  #define FABS(x)     fabsf(x)
  ------------------
   36|  15.3k|    if (max < f)
  ------------------
  |  Branch (36:9): [True: 982, False: 14.3k]
  ------------------
   37|    982|      max = f;
   38|  15.3k|  } while (--n);
  ------------------
  |  Branch (38:12): [True: 15.3k, False: 60]
  ------------------
   39|     60|  return _t1(exponent, Scalar)(max);
  ------------------
  |  |    9|     60|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|     60|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
   40|     60|}
encode4f.c:exponent_float:
   12|     60|{
   13|       |  /* use e = -EBIAS when x = 0 */
   14|     60|  int e = -EBIAS;
  ------------------
  |  |    3|     60|#define EBIAS ((1 << (EBITS - 1)) - 1) /* exponent bias */
  |  |  ------------------
  |  |  |  |    6|     60|#define EBITS 8            /* number of exponent bits */
  |  |  ------------------
  ------------------
   15|       |#ifdef ZFP_WITH_DAZ
   16|       |  /* treat subnormals as zero; resolves issue #119 by avoiding overflow */
   17|       |  if (x >= SCALAR_MIN)
   18|       |    FREXP(x, &e);
   19|       |#else
   20|     60|  if (x > 0) {
  ------------------
  |  Branch (20:7): [True: 58, False: 2]
  ------------------
   21|     58|    FREXP(x, &e);
  ------------------
  |  |   14|     58|  #define FREXP(x, e) frexpf(x, e)
  ------------------
   22|       |    /* clamp exponent in case x is subnormal; may still result in overflow */
   23|     58|    e = MAX(e, 1 - EBIAS);
  ------------------
  |  |    5|     58|#define MAX(x, y) ((x) > (y) ? (x) : (y))
  |  |  ------------------
  |  |  |  Branch (5:20): [True: 58, False: 0]
  |  |  ------------------
  ------------------
   24|     58|  }
   25|     60|#endif
   26|     60|  return e;
   27|     60|}
encode4f.c:fwd_cast_float:
   52|     58|{
   53|       |  /* compute power-of-two scale factor s */
   54|     58|  Scalar s = _t1(quantize, Scalar)(1, emax);
  ------------------
  |  |    3|     58|#define Scalar float       /* floating-point type */
  ------------------
                Scalar s = _t1(quantize, Scalar)(1, emax);
  ------------------
  |  |    9|     58|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|     58|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
   55|       |  /* compute p-bit int y = s*x where x is floating and |y| <= 2^(p-2) - 1 */
   56|     58|  do
   57|  14.8k|    *iblock++ = (Int)(s * *fblock++);
   58|  14.8k|  while (--n);
  ------------------
  |  Branch (58:10): [True: 14.7k, False: 58]
  ------------------
   59|     58|}
encode4f.c:quantize_float:
   45|     58|{
   46|     58|  return LDEXP(x, ((int)(CHAR_BIT * sizeof(Scalar)) - 2) - e);
  ------------------
  |  |   15|     58|  #define LDEXP(x, e) ldexpf(x, e)
  ------------------
   47|     58|}
zfp_encode_block_double_4:
   97|      7|{
   98|      7|  return REVERSIBLE(zfp) ? _t2(rev_encode_block, Scalar, DIMS)(zfp, fblock) : _t2(encode_block, Scalar, DIMS)(zfp, fblock);
  ------------------
  |  |    4|      7|#define REVERSIBLE(zfp) ((zfp)->minexp < ZFP_MIN_EXP) /* reversible mode? */
  |  |  ------------------
  |  |  |  |   21|      7|#define ZFP_MIN_EXP  -1074 /* minimum floating-point base-2 exponent */
  |  |  ------------------
  |  |  |  Branch (4:25): [True: 0, False: 7]
  |  |  ------------------
  ------------------
                return REVERSIBLE(zfp) ? _t2(rev_encode_block, Scalar, DIMS)(zfp, fblock) : _t2(encode_block, Scalar, DIMS)(zfp, fblock);
  ------------------
  |  |   10|      0|#define _t2(function, type, dims) _cat3(function, type, dims)
  |  |  ------------------
  |  |  |  |    6|      0|#define _cat3(x, y, z) x ## _ ## y ## _ ## z
  |  |  ------------------
  ------------------
                return REVERSIBLE(zfp) ? _t2(rev_encode_block, Scalar, DIMS)(zfp, fblock) : _t2(encode_block, Scalar, DIMS)(zfp, fblock);
  ------------------
  |  |   10|      7|#define _t2(function, type, dims) _cat3(function, type, dims)
  |  |  ------------------
  |  |  |  |    6|      7|#define _cat3(x, y, z) x ## _ ## y ## _ ## z
  |  |  ------------------
  ------------------
   99|      7|}
encode4d.c:encode_block_double_4:
   64|      7|{
   65|      7|  uint bits = 1;
   66|       |  /* compute maximum exponent */
   67|      7|  int emax = _t1(exponent_block, Scalar)(fblock, BLOCK_SIZE);
  ------------------
  |  |    9|      7|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|      7|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
                int emax = _t1(exponent_block, Scalar)(fblock, BLOCK_SIZE);
  ------------------
  |  |    2|      7|#define BLOCK_SIZE (1 << (2 * DIMS))   /* values per block */
  |  |  ------------------
  |  |  |  |    1|      7|#define DIMS 4
  |  |  ------------------
  ------------------
   68|      7|  uint maxprec = precision(emax, zfp->maxprec, zfp->minexp, DIMS);
  ------------------
  |  |    1|      7|#define DIMS 4
  ------------------
   69|      7|  uint e = maxprec ? (uint)(emax + EBIAS) : 0;
  ------------------
  |  |    3|      7|#define EBIAS ((1 << (EBITS - 1)) - 1) /* exponent bias */
  |  |  ------------------
  |  |  |  |    6|      7|#define EBITS 11                           /* number of exponent bits */
  |  |  ------------------
  ------------------
  |  Branch (69:12): [True: 7, False: 0]
  ------------------
   70|       |  /* encode block only if biased exponent is nonzero */
   71|      7|  if (e) {
  ------------------
  |  Branch (71:7): [True: 0, False: 7]
  ------------------
   72|      0|    cache_align_(Int iblock[BLOCK_SIZE]);
  ------------------
  |  |   42|      0|  #define cache_align_(x) x __attribute__((aligned(ZFP_CACHE_LINE_SIZE)))
  ------------------
   73|       |    /* encode common exponent; LSB indicates that exponent is nonzero */
   74|      0|    bits += EBITS;
  ------------------
  |  |    6|      0|#define EBITS 11                           /* number of exponent bits */
  ------------------
   75|      0|    stream_write_bits(zfp->stream, 2 * e + 1, bits);
   76|       |    /* perform forward block-floating-point transform */
   77|      0|    _t1(fwd_cast, Scalar)(iblock, fblock, BLOCK_SIZE, emax);
  ------------------
  |  |    9|      0|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|      0|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
                  _t1(fwd_cast, Scalar)(iblock, fblock, BLOCK_SIZE, emax);
  ------------------
  |  |    2|      0|#define BLOCK_SIZE (1 << (2 * DIMS))   /* values per block */
  |  |  ------------------
  |  |  |  |    1|      0|#define DIMS 4
  |  |  ------------------
  ------------------
   78|       |    /* encode integer block */
   79|      0|    bits += _t2(encode_block, Int, DIMS)(zfp->stream, zfp->minbits - MIN(bits, zfp->minbits), zfp->maxbits - bits, maxprec, iblock);
  ------------------
  |  |   10|      0|#define _t2(function, type, dims) _cat3(function, type, dims)
  |  |  ------------------
  |  |  |  |    6|      0|#define _cat3(x, y, z) x ## _ ## y ## _ ## z
  |  |  ------------------
  ------------------
                  bits += _t2(encode_block, Int, DIMS)(zfp->stream, zfp->minbits - MIN(bits, zfp->minbits), zfp->maxbits - bits, maxprec, iblock);
  ------------------
  |  |    4|      0|#define MIN(x, y) ((x) < (y) ? (x) : (y))
  |  |  ------------------
  |  |  |  Branch (4:20): [True: 0, False: 0]
  |  |  ------------------
  ------------------
   80|      0|  }
   81|      7|  else {
   82|       |    /* write single zero-bit to indicate that all values are zero */
   83|      7|    stream_write_bit(zfp->stream, 0);
   84|      7|    if (zfp->minbits > bits) {
  ------------------
  |  Branch (84:9): [True: 0, False: 7]
  ------------------
   85|      0|      stream_pad(zfp->stream, zfp->minbits - bits);
   86|      0|      bits = zfp->minbits;
   87|      0|    }
   88|      7|  }
   89|      7|  return bits;
   90|      7|}
encode4d.c:exponent_block_double:
   32|      7|{
   33|      7|  Scalar max = 0;
  ------------------
  |  |    3|      7|#define Scalar double                      /* floating-point type */
  ------------------
   34|  1.79k|  do {
   35|  1.79k|    Scalar f = FABS(*p++);
  ------------------
  |  |    3|  1.79k|#define Scalar double                      /* floating-point type */
  ------------------
                  Scalar f = FABS(*p++);
  ------------------
  |  |   12|  1.79k|#define FABS(x) fabs(x)
  ------------------
   36|  1.79k|    if (max < f)
  ------------------
  |  Branch (36:9): [True: 0, False: 1.79k]
  ------------------
   37|      0|      max = f;
   38|  1.79k|  } while (--n);
  ------------------
  |  Branch (38:12): [True: 1.78k, False: 7]
  ------------------
   39|      7|  return _t1(exponent, Scalar)(max);
  ------------------
  |  |    9|      7|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|      7|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
   40|      7|}
encode4d.c:exponent_double:
   12|      7|{
   13|       |  /* use e = -EBIAS when x = 0 */
   14|      7|  int e = -EBIAS;
  ------------------
  |  |    3|      7|#define EBIAS ((1 << (EBITS - 1)) - 1) /* exponent bias */
  |  |  ------------------
  |  |  |  |    6|      7|#define EBITS 11                           /* number of exponent bits */
  |  |  ------------------
  ------------------
   15|       |#ifdef ZFP_WITH_DAZ
   16|       |  /* treat subnormals as zero; resolves issue #119 by avoiding overflow */
   17|       |  if (x >= SCALAR_MIN)
   18|       |    FREXP(x, &e);
   19|       |#else
   20|      7|  if (x > 0) {
  ------------------
  |  Branch (20:7): [True: 0, False: 7]
  ------------------
   21|      0|    FREXP(x, &e);
  ------------------
  |  |   13|      0|#define FREXP(x, e) frexp(x, e)
  ------------------
   22|       |    /* clamp exponent in case x is subnormal; may still result in overflow */
   23|      0|    e = MAX(e, 1 - EBIAS);
  ------------------
  |  |    5|      0|#define MAX(x, y) ((x) > (y) ? (x) : (y))
  |  |  ------------------
  |  |  |  Branch (5:20): [True: 0, False: 0]
  |  |  ------------------
  ------------------
   24|      0|  }
   25|      7|#endif
   26|      7|  return e;
   27|      7|}

zfp_type_size:
   90|    608|{
   91|    608|  switch (type) {
   92|      0|    case zfp_type_int32:
  ------------------
  |  Branch (92:5): [True: 0, False: 608]
  ------------------
   93|      0|      return sizeof(int32);
   94|      0|    case zfp_type_int64:
  ------------------
  |  Branch (94:5): [True: 0, False: 608]
  ------------------
   95|      0|      return sizeof(int64);
   96|    416|    case zfp_type_float:
  ------------------
  |  Branch (96:5): [True: 416, False: 192]
  ------------------
   97|    416|      return sizeof(float);
   98|    192|    case zfp_type_double:
  ------------------
  |  Branch (98:5): [True: 192, False: 416]
  ------------------
   99|    192|      return sizeof(double);
  100|      0|    default:
  ------------------
  |  Branch (100:5): [True: 0, False: 608]
  ------------------
  101|      0|      return 0;
  102|    608|  }
  103|    608|}
zfp_field_alloc:
  109|    388|{
  110|    388|  zfp_field* field = (zfp_field*)malloc(sizeof(zfp_field));
  111|    388|  if (field) {
  ------------------
  |  Branch (111:7): [True: 388, False: 0]
  ------------------
  112|    388|    field->type = zfp_type_none;
  113|    388|    field->nx = field->ny = field->nz = field->nw = 0;
  114|    388|    field->sx = field->sy = field->sz = field->sw = 0;
  115|    388|    field->data = 0;
  116|    388|  }
  117|    388|  return field;
  118|    388|}
zfp_field_2d:
  134|      6|{
  135|      6|  zfp_field* field = zfp_field_alloc();
  136|      6|  if (field) {
  ------------------
  |  Branch (136:7): [True: 6, False: 0]
  ------------------
  137|      6|    field->type = type;
  138|      6|    field->nx = nx;
  139|      6|    field->ny = ny;
  140|      6|    field->data = data;
  141|      6|  }
  142|      6|  return field;
  143|      6|}
zfp_field_3d:
  147|    181|{
  148|    181|  zfp_field* field = zfp_field_alloc();
  149|    181|  if (field) {
  ------------------
  |  Branch (149:7): [True: 181, False: 0]
  ------------------
  150|    181|    field->type = type;
  151|    181|    field->nx = nx;
  152|    181|    field->ny = ny;
  153|    181|    field->nz = nz;
  154|    181|    field->data = data;
  155|    181|  }
  156|    181|  return field;
  157|    181|}
zfp_field_4d:
  161|    201|{
  162|    201|  zfp_field* field = zfp_field_alloc();
  163|    201|  if (field) {
  ------------------
  |  Branch (163:7): [True: 201, False: 0]
  ------------------
  164|    201|    field->type = type;
  165|    201|    field->nx = nx;
  166|    201|    field->ny = ny;
  167|    201|    field->nz = nz;
  168|    201|    field->nw = nw;
  169|    201|    field->data = data;
  170|    201|  }
  171|    201|  return field;
  172|    201|}
zfp_field_free:
  176|    388|{
  177|    388|  free(field);
  178|    388|}
zfp_field_precision:
  206|    608|{
  207|       |  return (uint)(CHAR_BIT * zfp_type_size(field->type));
  208|    608|}
zfp_field_dimensionality:
  212|  1.42k|{
  213|  1.42k|  return field->nx ? field->ny ? field->nz ? field->nw ? 4 : 3 : 2 : 1 : 0;
  ------------------
  |  Branch (213:10): [True: 1.42k, False: 0]
  |  Branch (213:22): [True: 1.42k, False: 0]
  |  Branch (213:34): [True: 1.40k, False: 22]
  |  Branch (213:46): [True: 737, False: 663]
  ------------------
  214|  1.42k|}
zfp_field_blocks:
  245|    646|{
  246|    646|  size_t bx = (field->nx + 3) / 4;
  247|    646|  size_t by = (field->ny + 3) / 4;
  248|    646|  size_t bz = (field->nz + 3) / 4;
  249|    646|  size_t bw = (field->nw + 3) / 4;
  250|    646|  switch (zfp_field_dimensionality(field)) {
  251|      0|    case 1: return bx;
  ------------------
  |  Branch (251:5): [True: 0, False: 646]
  ------------------
  252|     10|    case 2: return bx * by;
  ------------------
  |  Branch (252:5): [True: 10, False: 636]
  ------------------
  253|    301|    case 3: return bx * by * bz;
  ------------------
  |  Branch (253:5): [True: 301, False: 345]
  ------------------
  254|    335|    case 4: return bx * by * bz * bw;
  ------------------
  |  Branch (254:5): [True: 335, False: 311]
  ------------------
  255|      0|    default: return 0;
  ------------------
  |  Branch (255:5): [True: 0, False: 646]
  ------------------
  256|    646|  }
  257|    646|}
zfp_field_stride:
  261|    388|{
  262|    388|  if (stride)
  ------------------
  |  Branch (262:7): [True: 0, False: 388]
  ------------------
  263|      0|    switch (zfp_field_dimensionality(field)) {
  ------------------
  |  Branch (263:13): [True: 0, False: 0]
  ------------------
  264|      0|      case 4:
  ------------------
  |  Branch (264:7): [True: 0, False: 0]
  ------------------
  265|      0|        stride[3] = field->sw ? field->sw : (ptrdiff_t)(field->nx * field->ny * field->nz);
  ------------------
  |  Branch (265:21): [True: 0, False: 0]
  ------------------
  266|       |        /* FALLTHROUGH */
  267|      0|      case 3:
  ------------------
  |  Branch (267:7): [True: 0, False: 0]
  ------------------
  268|      0|        stride[2] = field->sz ? field->sz : (ptrdiff_t)(field->nx * field->ny);
  ------------------
  |  Branch (268:21): [True: 0, False: 0]
  ------------------
  269|       |        /* FALLTHROUGH */
  270|      0|      case 2:
  ------------------
  |  Branch (270:7): [True: 0, False: 0]
  ------------------
  271|      0|        stride[1] = field->sy ? field->sy : (ptrdiff_t)field->nx;
  ------------------
  |  Branch (271:21): [True: 0, False: 0]
  ------------------
  272|       |        /* FALLTHROUGH */
  273|      0|      case 1:
  ------------------
  |  Branch (273:7): [True: 0, False: 0]
  ------------------
  274|      0|        stride[0] = field->sx ? field->sx : 1;
  ------------------
  |  Branch (274:21): [True: 0, False: 0]
  ------------------
  275|      0|        break;
  276|      0|    }
  277|    388|  return field->sx || field->sy || field->sz || field->sw;
  ------------------
  |  Branch (277:10): [True: 0, False: 388]
  |  Branch (277:23): [True: 0, False: 388]
  |  Branch (277:36): [True: 0, False: 388]
  |  Branch (277:49): [True: 0, False: 388]
  ------------------
  278|    388|}
zfp_stream_open:
  538|    518|{
  539|    518|  zfp_stream* zfp = (zfp_stream*)malloc(sizeof(zfp_stream));
  540|    518|  if (zfp) {
  ------------------
  |  Branch (540:7): [True: 518, False: 0]
  ------------------
  541|    518|    zfp->stream = stream;
  542|    518|    zfp->minbits = ZFP_MIN_BITS;
  ------------------
  |  |   18|    518|#define ZFP_MIN_BITS     1 /* minimum number of bits per block */
  ------------------
  543|    518|    zfp->maxbits = ZFP_MAX_BITS;
  ------------------
  |  |   19|    518|#define ZFP_MAX_BITS 16658 /* maximum number of bits per block */
  ------------------
  544|    518|    zfp->maxprec = ZFP_MAX_PREC;
  ------------------
  |  |   20|    518|#define ZFP_MAX_PREC    64 /* maximum precision supported */
  ------------------
  545|    518|    zfp->minexp = ZFP_MIN_EXP;
  ------------------
  |  |   21|    518|#define ZFP_MIN_EXP  -1074 /* minimum floating-point base-2 exponent */
  ------------------
  546|    518|    zfp->exec.policy = zfp_exec_serial;
  547|       |    zfp->exec.params = NULL;
  548|    518|  }
  549|    518|  return zfp;
  550|    518|}
zfp_stream_close:
  554|    518|{
  555|    518|  if (zfp->exec.params != NULL)
  ------------------
  |  Branch (555:7): [True: 0, False: 518]
  ------------------
  556|      0|    free(zfp->exec.params);
  557|    518|  free(zfp);
  558|    518|}
zfp_stream_maximum_size:
  713|    388|{
  714|    388|  zfp_bool reversible = is_reversible(zfp);
  715|    388|  uint dims = zfp_field_dimensionality(field);
  716|    388|  size_t blocks = zfp_field_blocks(field);
  717|    388|  uint values = 1u << (2 * dims);
  718|    388|  uint maxbits = 0;
  719|       |
  720|    388|  if (!dims)
  ------------------
  |  Branch (720:7): [True: 0, False: 388]
  ------------------
  721|      0|    return 0;
  722|    388|  switch (field->type) {
  723|      0|    case zfp_type_int32:
  ------------------
  |  Branch (723:5): [True: 0, False: 388]
  ------------------
  724|      0|      maxbits += reversible ? 5 : 0;
  ------------------
  |  Branch (724:18): [True: 0, False: 0]
  ------------------
  725|      0|      break;
  726|      0|    case zfp_type_int64:
  ------------------
  |  Branch (726:5): [True: 0, False: 388]
  ------------------
  727|      0|      maxbits += reversible ? 6 : 0;
  ------------------
  |  Branch (727:18): [True: 0, False: 0]
  ------------------
  728|      0|      break;
  729|    265|    case zfp_type_float:
  ------------------
  |  Branch (729:5): [True: 265, False: 123]
  ------------------
  730|    265|      maxbits += reversible ? 1 + 1 + 8 + 5 : 1 + 8;
  ------------------
  |  Branch (730:18): [True: 0, False: 265]
  ------------------
  731|    265|      break;
  732|    123|    case zfp_type_double:
  ------------------
  |  Branch (732:5): [True: 123, False: 265]
  ------------------
  733|    123|      maxbits += reversible ? 1 + 1 + 11 + 6 : 1 + 11;
  ------------------
  |  Branch (733:18): [True: 0, False: 123]
  ------------------
  734|    123|      break;
  735|      0|    default:
  ------------------
  |  Branch (735:5): [True: 0, False: 388]
  ------------------
  736|      0|      return 0;
  737|    388|  }
  738|    388|  maxbits += values - 1 + values * MIN(zfp->maxprec, zfp_field_precision(field));
  ------------------
  |  |    4|    388|#define MIN(x, y) ((x) < (y) ? (x) : (y))
  |  |  ------------------
  |  |  |  Branch (4:20): [True: 168, False: 220]
  |  |  ------------------
  ------------------
  739|    388|  maxbits = MIN(maxbits, zfp->maxbits);
  ------------------
  |  |    4|    388|#define MIN(x, y) ((x) < (y) ? (x) : (y))
  |  |  ------------------
  |  |  |  Branch (4:20): [True: 290, False: 98]
  |  |  ------------------
  ------------------
  740|    388|  maxbits = MAX(maxbits, zfp->minbits);
  ------------------
  |  |    5|    388|#define MAX(x, y) ((x) > (y) ? (x) : (y))
  |  |  ------------------
  |  |  |  Branch (5:20): [True: 290, False: 98]
  |  |  ------------------
  ------------------
  741|    388|  return ((ZFP_HEADER_MAX_BITS + blocks * maxbits + stream_word_bits - 1) & ~(stream_word_bits - 1)) / CHAR_BIT;
  ------------------
  |  |   49|    388|#define ZFP_HEADER_MAX_BITS 148 /* max number of header bits */
  ------------------
  742|    388|}
zfp_stream_set_bit_stream:
  746|    518|{
  747|    518|  zfp->stream = stream;
  748|    518|}
zfp_stream_set_rate:
  761|    147|{
  762|    147|  uint n = 1u << (2 * dims);
  763|    147|  uint bits = (uint)floor(n * rate + 0.5);
  764|    147|  switch (type) {
  765|     99|    case zfp_type_float:
  ------------------
  |  Branch (765:5): [True: 99, False: 48]
  ------------------
  766|     99|      bits = MAX(bits, 1 + 8u);
  ------------------
  |  |    5|     99|#define MAX(x, y) ((x) > (y) ? (x) : (y))
  |  |  ------------------
  |  |  |  Branch (5:20): [True: 99, False: 0]
  |  |  ------------------
  ------------------
  767|     99|      break;
  768|     48|    case zfp_type_double:
  ------------------
  |  Branch (768:5): [True: 48, False: 99]
  ------------------
  769|     48|      bits = MAX(bits, 1 + 11u);
  ------------------
  |  |    5|     48|#define MAX(x, y) ((x) > (y) ? (x) : (y))
  |  |  ------------------
  |  |  |  Branch (5:20): [True: 48, False: 0]
  |  |  ------------------
  ------------------
  770|     48|      break;
  771|      0|    default:
  ------------------
  |  Branch (771:5): [True: 0, False: 147]
  ------------------
  772|      0|      break;
  773|    147|  }
  774|    147|  if (align) {
  ------------------
  |  Branch (774:7): [True: 0, False: 147]
  ------------------
  775|       |    /* for write random access, round up to next multiple of stream word size */
  776|      0|    bits += (uint)stream_word_bits - 1;
  777|      0|    bits &= ~(stream_word_bits - 1);
  778|      0|  }
  779|    147|  zfp->minbits = bits;
  780|    147|  zfp->maxbits = bits;
  781|    147|  zfp->maxprec = ZFP_MAX_PREC;
  ------------------
  |  |   20|    147|#define ZFP_MAX_PREC    64 /* maximum precision supported */
  ------------------
  782|    147|  zfp->minexp = ZFP_MIN_EXP;
  ------------------
  |  |   21|    147|#define ZFP_MIN_EXP  -1074 /* minimum floating-point base-2 exponent */
  ------------------
  783|    147|  return (double)bits / n;
  784|    147|}
zfp_stream_set_precision:
  788|    268|{
  789|    268|  zfp->minbits = ZFP_MIN_BITS;
  ------------------
  |  |   18|    268|#define ZFP_MIN_BITS     1 /* minimum number of bits per block */
  ------------------
  790|    268|  zfp->maxbits = ZFP_MAX_BITS;
  ------------------
  |  |   19|    268|#define ZFP_MAX_BITS 16658 /* maximum number of bits per block */
  ------------------
  791|    268|  zfp->maxprec = precision ? MIN(precision, ZFP_MAX_PREC) : ZFP_MAX_PREC;
  ------------------
  |  |    4|    268|#define MIN(x, y) ((x) < (y) ? (x) : (y))
  |  |  ------------------
  |  |  |  Branch (4:20): [True: 240, False: 28]
  |  |  ------------------
  ------------------
                zfp->maxprec = precision ? MIN(precision, ZFP_MAX_PREC) : ZFP_MAX_PREC;
  ------------------
  |  |   20|    268|#define ZFP_MAX_PREC    64 /* maximum precision supported */
  ------------------
  |  Branch (791:18): [True: 268, False: 0]
  ------------------
  792|    268|  zfp->minexp = ZFP_MIN_EXP;
  ------------------
  |  |   21|    268|#define ZFP_MIN_EXP  -1074 /* minimum floating-point base-2 exponent */
  ------------------
  793|    268|  return zfp->maxprec;
  794|    268|}
zfp_stream_set_accuracy:
  798|     54|{
  799|     54|  int emin = ZFP_MIN_EXP;
  ------------------
  |  |   21|     54|#define ZFP_MIN_EXP  -1074 /* minimum floating-point base-2 exponent */
  ------------------
  800|     54|  if (tolerance > 0) {
  ------------------
  |  Branch (800:7): [True: 54, False: 0]
  ------------------
  801|       |    /* tolerance = x * 2^emin, with 0.5 <= x < 1 */
  802|     54|    frexp(tolerance, &emin);
  803|     54|    emin--;
  804|       |    /* assert: 2^emin <= tolerance < 2^(emin+1) */
  805|     54|  }
  806|     54|  zfp->minbits = ZFP_MIN_BITS;
  ------------------
  |  |   18|     54|#define ZFP_MIN_BITS     1 /* minimum number of bits per block */
  ------------------
  807|     54|  zfp->maxbits = ZFP_MAX_BITS;
  ------------------
  |  |   19|     54|#define ZFP_MAX_BITS 16658 /* maximum number of bits per block */
  ------------------
  808|     54|  zfp->maxprec = ZFP_MAX_PREC;
  ------------------
  |  |   20|     54|#define ZFP_MAX_PREC    64 /* maximum precision supported */
  ------------------
  809|     54|  zfp->minexp = emin;
  810|     54|  return tolerance > 0 ? ldexp(1.0, emin) : 0;
  ------------------
  |  Branch (810:10): [True: 54, False: 0]
  ------------------
  811|     54|}
zfp_stream_rewind:
  889|    518|{
  890|    518|  stream_rewind(zfp->stream);
  891|    518|}
zfp_compress:
 1053|    130|{
 1054|       |  /* function table [execution][strided][dimensionality][scalar type] */
 1055|    130|  void (*ftable[3][2][4][4])(zfp_stream*, const zfp_field*) = {
 1056|       |    /* serial */
 1057|    130|    {{{ compress_int32_1,         compress_int64_1,         compress_float_1,         compress_double_1 },
 1058|    130|      { compress_strided_int32_2, compress_strided_int64_2, compress_strided_float_2, compress_strided_double_2 },
 1059|    130|      { compress_strided_int32_3, compress_strided_int64_3, compress_strided_float_3, compress_strided_double_3 },
 1060|    130|      { compress_strided_int32_4, compress_strided_int64_4, compress_strided_float_4, compress_strided_double_4 }},
 1061|    130|     {{ compress_strided_int32_1, compress_strided_int64_1, compress_strided_float_1, compress_strided_double_1 },
 1062|    130|      { compress_strided_int32_2, compress_strided_int64_2, compress_strided_float_2, compress_strided_double_2 },
 1063|    130|      { compress_strided_int32_3, compress_strided_int64_3, compress_strided_float_3, compress_strided_double_3 },
 1064|    130|      { compress_strided_int32_4, compress_strided_int64_4, compress_strided_float_4, compress_strided_double_4 }}},
 1065|       |
 1066|       |    /* OpenMP */
 1067|       |#ifdef _OPENMP
 1068|       |    {{{ compress_omp_int32_1,         compress_omp_int64_1,         compress_omp_float_1,         compress_omp_double_1 },
 1069|       |      { compress_strided_omp_int32_2, compress_strided_omp_int64_2, compress_strided_omp_float_2, compress_strided_omp_double_2 },
 1070|       |      { compress_strided_omp_int32_3, compress_strided_omp_int64_3, compress_strided_omp_float_3, compress_strided_omp_double_3 },
 1071|       |      { compress_strided_omp_int32_4, compress_strided_omp_int64_4, compress_strided_omp_float_4, compress_strided_omp_double_4 }},
 1072|       |     {{ compress_strided_omp_int32_1, compress_strided_omp_int64_1, compress_strided_omp_float_1, compress_strided_omp_double_1 },
 1073|       |      { compress_strided_omp_int32_2, compress_strided_omp_int64_2, compress_strided_omp_float_2, compress_strided_omp_double_2 },
 1074|       |      { compress_strided_omp_int32_3, compress_strided_omp_int64_3, compress_strided_omp_float_3, compress_strided_omp_double_3 },
 1075|       |      { compress_strided_omp_int32_4, compress_strided_omp_int64_4, compress_strided_omp_float_4, compress_strided_omp_double_4 }}},
 1076|       |#else
 1077|    130|    {{{ NULL }}},
 1078|    130|#endif
 1079|       |
 1080|       |    /* CUDA */
 1081|       |#ifdef ZFP_WITH_CUDA
 1082|       |    {{{ compress_cuda_int32_1,         compress_cuda_int64_1,         compress_cuda_float_1,         compress_cuda_double_1 },
 1083|       |      { compress_strided_cuda_int32_2, compress_strided_cuda_int64_2, compress_strided_cuda_float_2, compress_strided_cuda_double_2 },
 1084|       |      { compress_strided_cuda_int32_3, compress_strided_cuda_int64_3, compress_strided_cuda_float_3, compress_strided_cuda_double_3 },
 1085|       |      { NULL,                            NULL,                            NULL,                            NULL }},
 1086|       |     {{ compress_strided_cuda_int32_1, compress_strided_cuda_int64_1, compress_strided_cuda_float_1, compress_strided_cuda_double_1 },
 1087|       |      { compress_strided_cuda_int32_2, compress_strided_cuda_int64_2, compress_strided_cuda_float_2, compress_strided_cuda_double_2 },
 1088|       |      { compress_strided_cuda_int32_3, compress_strided_cuda_int64_3, compress_strided_cuda_float_3, compress_strided_cuda_double_3 },
 1089|       |      { NULL,                            NULL,                            NULL,                            NULL }}},
 1090|       |#else
 1091|    130|    {{{ NULL }}},
 1092|    130|#endif
 1093|    130|  };
 1094|    130|  uint exec = zfp->exec.policy;
 1095|    130|  uint strided = (uint)zfp_field_stride(field, NULL);
 1096|    130|  uint dims = zfp_field_dimensionality(field);
 1097|    130|  uint type = field->type;
 1098|    130|  void (*compress)(zfp_stream*, const zfp_field*);
 1099|       |
 1100|    130|  switch (type) {
 1101|      0|    case zfp_type_int32:
  ------------------
  |  Branch (1101:5): [True: 0, False: 130]
  ------------------
 1102|      0|    case zfp_type_int64:
  ------------------
  |  Branch (1102:5): [True: 0, False: 130]
  ------------------
 1103|     89|    case zfp_type_float:
  ------------------
  |  Branch (1103:5): [True: 89, False: 41]
  ------------------
 1104|    130|    case zfp_type_double:
  ------------------
  |  Branch (1104:5): [True: 41, False: 89]
  ------------------
 1105|    130|      break;
 1106|      0|    default:
  ------------------
  |  Branch (1106:5): [True: 0, False: 130]
  ------------------
 1107|      0|      return 0;
 1108|    130|  }
 1109|       |
 1110|       |  /* return 0 if compression mode is not supported */
 1111|    130|  compress = ftable[exec][strided][dims - 1][type - zfp_type_int32];
 1112|    130|  if (!compress)
  ------------------
  |  Branch (1112:7): [True: 0, False: 130]
  ------------------
 1113|      0|    return 0;
 1114|       |
 1115|       |  /* compress field and align bit stream on word boundary */
 1116|    130|  compress(zfp, field);
 1117|    130|  stream_flush(zfp->stream);
 1118|       |
 1119|    130|  return stream_size(zfp->stream);
 1120|    130|}
zfp_decompress:
 1124|    258|{
 1125|       |  /* function table [execution][strided][dimensionality][scalar type] */
 1126|    258|  void (*ftable[3][2][4][4])(zfp_stream*, zfp_field*) = {
 1127|       |    /* serial */
 1128|    258|    {{{ decompress_int32_1,         decompress_int64_1,         decompress_float_1,         decompress_double_1 },
 1129|    258|      { decompress_strided_int32_2, decompress_strided_int64_2, decompress_strided_float_2, decompress_strided_double_2 },
 1130|    258|      { decompress_strided_int32_3, decompress_strided_int64_3, decompress_strided_float_3, decompress_strided_double_3 },
 1131|    258|      { decompress_strided_int32_4, decompress_strided_int64_4, decompress_strided_float_4, decompress_strided_double_4 }},
 1132|    258|     {{ decompress_strided_int32_1, decompress_strided_int64_1, decompress_strided_float_1, decompress_strided_double_1 },
 1133|    258|      { decompress_strided_int32_2, decompress_strided_int64_2, decompress_strided_float_2, decompress_strided_double_2 },
 1134|    258|      { decompress_strided_int32_3, decompress_strided_int64_3, decompress_strided_float_3, decompress_strided_double_3 },
 1135|    258|      { decompress_strided_int32_4, decompress_strided_int64_4, decompress_strided_float_4, decompress_strided_double_4 }}},
 1136|       |
 1137|       |    /* OpenMP; not yet supported */
 1138|    258|    {{{ NULL }}},
 1139|       |
 1140|       |    /* CUDA */
 1141|       |#ifdef ZFP_WITH_CUDA
 1142|       |    {{{ decompress_cuda_int32_1,         decompress_cuda_int64_1,         decompress_cuda_float_1,         decompress_cuda_double_1 },
 1143|       |      { decompress_strided_cuda_int32_2, decompress_strided_cuda_int64_2, decompress_strided_cuda_float_2, decompress_strided_cuda_double_2 },
 1144|       |      { decompress_strided_cuda_int32_3, decompress_strided_cuda_int64_3, decompress_strided_cuda_float_3, decompress_strided_cuda_double_3 },
 1145|       |      { NULL,                            NULL,                            NULL,                            NULL }},
 1146|       |     {{ decompress_strided_cuda_int32_1, decompress_strided_cuda_int64_1, decompress_strided_cuda_float_1, decompress_strided_cuda_double_1 },
 1147|       |      { decompress_strided_cuda_int32_2, decompress_strided_cuda_int64_2, decompress_strided_cuda_float_2, decompress_strided_cuda_double_2 },
 1148|       |      { decompress_strided_cuda_int32_3, decompress_strided_cuda_int64_3, decompress_strided_cuda_float_3, decompress_strided_cuda_double_3 },
 1149|       |      { NULL,                            NULL,                            NULL,                            NULL }}},
 1150|       |#else
 1151|    258|    {{{ NULL }}},
 1152|    258|#endif
 1153|    258|  };
 1154|    258|  uint exec = zfp->exec.policy;
 1155|    258|  uint strided = (uint)zfp_field_stride(field, NULL);
 1156|    258|  uint dims = zfp_field_dimensionality(field);
 1157|    258|  uint type = field->type;
 1158|    258|  void (*decompress)(zfp_stream*, zfp_field*);
 1159|       |
 1160|    258|  switch (type) {
 1161|      0|    case zfp_type_int32:
  ------------------
  |  Branch (1161:5): [True: 0, False: 258]
  ------------------
 1162|      0|    case zfp_type_int64:
  ------------------
  |  Branch (1162:5): [True: 0, False: 258]
  ------------------
 1163|    176|    case zfp_type_float:
  ------------------
  |  Branch (1163:5): [True: 176, False: 82]
  ------------------
 1164|    258|    case zfp_type_double:
  ------------------
  |  Branch (1164:5): [True: 82, False: 176]
  ------------------
 1165|    258|      break;
 1166|      0|    default:
  ------------------
  |  Branch (1166:5): [True: 0, False: 258]
  ------------------
 1167|      0|      return 0;
 1168|    258|  }
 1169|       |
 1170|       |  /* return 0 if decompression mode is not supported */
 1171|    258|  decompress = ftable[exec][strided][dims - 1][type - zfp_type_int32];
 1172|    258|  if (!decompress)
  ------------------
  |  Branch (1172:7): [True: 0, False: 258]
  ------------------
 1173|      0|    return 0;
 1174|       |
 1175|       |  /* decompress field and align bit stream on word boundary */
 1176|    258|  decompress(zfp, field);
 1177|    258|  stream_align(zfp->stream);
 1178|       |
 1179|    258|  return stream_size(zfp->stream);
 1180|    258|}
zfp.c:is_reversible:
   43|    388|{
   44|    388|  return zfp->minexp < ZFP_MIN_EXP;
  ------------------
  |  |   21|    388|#define ZFP_MIN_EXP  -1074 /* minimum floating-point base-2 exponent */
  ------------------
   45|    388|}

adler32_ssse3.c:adler32_len_16:
   29|      4|static inline uint32_t adler32_len_16(uint32_t adler, const uint8_t *buf, size_t len, uint32_t sum2) {
   30|     36|    while (len) {
  ------------------
  |  Branch (30:12): [True: 32, False: 4]
  ------------------
   31|     32|        --len;
   32|     32|        adler += *buf++;
   33|     32|        sum2 += adler;
   34|     32|    }
   35|      4|    adler %= BASE;
  ------------------
  |  |   11|      4|#define BASE 65521U     /* largest prime smaller than 65536 */
  ------------------
   36|      4|    sum2 %= BASE;            /* only added so many BASE's */
  ------------------
  |  |   11|      4|#define BASE 65521U     /* largest prime smaller than 65536 */
  ------------------
   37|       |    /* return recombined sums */
   38|      4|    return adler | (sum2 << 16);
   39|      4|}
adler32_sse42.c:adler32_copy_len_16:
   41|     22|static inline uint32_t adler32_copy_len_16(uint32_t adler, const uint8_t *buf, uint8_t *dst, size_t len, uint32_t sum2) {
   42|    189|    while (len--) {
  ------------------
  |  Branch (42:12): [True: 167, False: 22]
  ------------------
   43|    167|        *dst = *buf++;
   44|    167|        adler += *dst++;
   45|    167|        sum2 += adler;
   46|    167|    }
   47|     22|    adler %= BASE;
  ------------------
  |  |   11|     22|#define BASE 65521U     /* largest prime smaller than 65536 */
  ------------------
   48|     22|    sum2 %= BASE;            /* only added so many BASE's */
  ------------------
  |  |   11|     22|#define BASE 65521U     /* largest prime smaller than 65536 */
  ------------------
   49|       |    /* return recombined sums */
   50|     22|    return adler | (sum2 << 16);
   51|     22|}
adler32_avx2.c:adler32_copy_len_16:
   41|     25|static inline uint32_t adler32_copy_len_16(uint32_t adler, const uint8_t *buf, uint8_t *dst, size_t len, uint32_t sum2) {
   42|    210|    while (len--) {
  ------------------
  |  Branch (42:12): [True: 185, False: 25]
  ------------------
   43|    185|        *dst = *buf++;
   44|    185|        adler += *dst++;
   45|    185|        sum2 += adler;
   46|    185|    }
   47|     25|    adler %= BASE;
  ------------------
  |  |   11|     25|#define BASE 65521U     /* largest prime smaller than 65536 */
  ------------------
   48|     25|    sum2 %= BASE;            /* only added so many BASE's */
  ------------------
  |  |   11|     25|#define BASE 65521U     /* largest prime smaller than 65536 */
  ------------------
   49|       |    /* return recombined sums */
   50|     25|    return adler | (sum2 << 16);
   51|     25|}
adler32_avx2.c:adler32_len_16:
   29|     11|static inline uint32_t adler32_len_16(uint32_t adler, const uint8_t *buf, size_t len, uint32_t sum2) {
   30|     85|    while (len) {
  ------------------
  |  Branch (30:12): [True: 74, False: 11]
  ------------------
   31|     74|        --len;
   32|     74|        adler += *buf++;
   33|     74|        sum2 += adler;
   34|     74|    }
   35|     11|    adler %= BASE;
  ------------------
  |  |   11|     11|#define BASE 65521U     /* largest prime smaller than 65536 */
  ------------------
   36|     11|    sum2 %= BASE;            /* only added so many BASE's */
  ------------------
  |  |   11|     11|#define BASE 65521U     /* largest prime smaller than 65536 */
  ------------------
   37|       |    /* return recombined sums */
   38|     11|    return adler | (sum2 << 16);
   39|     11|}

adler32_avx2:
  172|     16|Z_INTERNAL uint32_t adler32_avx2(uint32_t adler, const uint8_t *src, size_t len) {
  173|       |    return adler32_fold_copy_impl(adler, NULL, src, len, 0);
  174|     16|}
adler32_fold_copy_avx2:
  176|     57|Z_INTERNAL uint32_t adler32_fold_copy_avx2(uint32_t adler, uint8_t *dst, const uint8_t *src, size_t len) {
  177|     57|    return adler32_fold_copy_impl(adler, dst, src, len, 1);
  178|     57|}
adler32_avx2.c:adler32_fold_copy_impl:
   21|     73|static inline uint32_t adler32_fold_copy_impl(uint32_t adler, uint8_t *dst, const uint8_t *src, size_t len, const int COPY) {
   22|     73|    if (src == NULL) return 1L;
  ------------------
  |  Branch (22:9): [True: 0, False: 73]
  ------------------
   23|     73|    if (len == 0) return adler;
  ------------------
  |  Branch (23:9): [True: 0, False: 73]
  ------------------
   24|       |
   25|     73|    uint32_t adler0, adler1;
   26|     73|    adler1 = (adler >> 16) & 0xffff;
   27|     73|    adler0 = adler & 0xffff;
   28|       |
   29|    124|rem_peel:
   30|    124|    if (len < 16) {
  ------------------
  |  Branch (30:9): [True: 36, False: 88]
  ------------------
   31|     36|        if (COPY) {
  ------------------
  |  Branch (31:13): [True: 25, False: 11]
  ------------------
   32|     25|            return adler32_copy_len_16(adler0, src, dst, len, adler1);
   33|     25|        } else {
   34|     11|            return adler32_len_16(adler0, src, len, adler1);
   35|     11|        }
   36|     88|    } else if (len < 32) {
  ------------------
  |  Branch (36:16): [True: 28, False: 60]
  ------------------
   37|     28|        if (COPY) {
  ------------------
  |  Branch (37:13): [True: 24, False: 4]
  ------------------
   38|     24|            return adler32_fold_copy_sse42(adler, dst, src, len);
   39|     24|        } else {
   40|      4|            return adler32_ssse3(adler, src, len);
   41|      4|        }
   42|     28|    }
   43|       |
   44|     60|    __m256i vs1, vs2, vs2_0;
   45|       |
   46|     60|    const __m256i dot2v = _mm256_setr_epi8(64, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, 49, 48, 47,
   47|     60|                                           46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33);
   48|     60|    const __m256i dot2v_0 = _mm256_setr_epi8(32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15,
   49|     60|                                             14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1);
   50|     60|    const __m256i dot3v = _mm256_set1_epi16(1);
   51|     60|    const __m256i zero = _mm256_setzero_si256();
   52|       |
   53|    120|    while (len >= 32) {
  ------------------
  |  Branch (53:12): [True: 60, False: 60]
  ------------------
   54|     60|        vs1 = _mm256_zextsi128_si256(_mm_cvtsi32_si128(adler0));
   55|     60|        vs2 = _mm256_zextsi128_si256(_mm_cvtsi32_si128(adler1));
   56|     60|        __m256i vs1_0 = vs1;
   57|     60|        __m256i vs3 = _mm256_setzero_si256();
   58|     60|        vs2_0 = vs3;
   59|       |
   60|     60|        size_t k = MIN(len, NMAX);
  ------------------
  |  |  124|     60|#define MIN(a, b) ((a) > (b) ? (b) : (a))
  |  |  ------------------
  |  |  |  Branch (124:20): [True: 0, False: 60]
  |  |  ------------------
  ------------------
   61|     60|        k -= k % 32;
   62|     60|        len -= k;
   63|       |
   64|    300|        while (k >= 64) {
  ------------------
  |  Branch (64:16): [True: 240, False: 60]
  ------------------
   65|    240|            __m256i vbuf = _mm256_loadu_si256((__m256i*)src);
   66|    240|            __m256i vbuf_0 = _mm256_loadu_si256((__m256i*)(src + 32));
   67|    240|            src += 64;
   68|    240|            k -= 64;
   69|       |
   70|    240|            __m256i vs1_sad = _mm256_sad_epu8(vbuf, zero);
   71|    240|            __m256i vs1_sad2 = _mm256_sad_epu8(vbuf_0, zero);
   72|       |
   73|    240|            if (COPY) {
  ------------------
  |  Branch (73:17): [True: 205, False: 35]
  ------------------
   74|    205|                _mm256_storeu_si256((__m256i*)dst, vbuf);
   75|    205|                _mm256_storeu_si256((__m256i*)(dst + 32), vbuf_0);
   76|    205|                dst += 64;
   77|    205|            }
   78|       |
   79|    240|            vs1 = _mm256_add_epi32(vs1, vs1_sad);
   80|    240|            vs3 = _mm256_add_epi32(vs3, vs1_0);
   81|    240|            __m256i v_short_sum2 = _mm256_maddubs_epi16(vbuf, dot2v); // sum 32 uint8s to 16 shorts
   82|    240|            __m256i v_short_sum2_0 = _mm256_maddubs_epi16(vbuf_0, dot2v_0); // sum 32 uint8s to 16 shorts
   83|    240|            __m256i vsum2 = _mm256_madd_epi16(v_short_sum2, dot3v); // sum 16 shorts to 8 uint32s
   84|    240|            __m256i vsum2_0 = _mm256_madd_epi16(v_short_sum2_0, dot3v); // sum 16 shorts to 8 uint32s
   85|    240|            vs1 = _mm256_add_epi32(vs1_sad2, vs1);
   86|    240|            vs2 = _mm256_add_epi32(vsum2, vs2);
   87|    240|            vs2_0 = _mm256_add_epi32(vsum2_0, vs2_0);
   88|    240|            vs1_0 = vs1;
   89|    240|        }
   90|       |
   91|     60|        vs2 = _mm256_add_epi32(vs2_0, vs2);
   92|     60|        vs3 = _mm256_slli_epi32(vs3, 6);
   93|     60|        vs2 = _mm256_add_epi32(vs3, vs2);
   94|     60|        vs3 = _mm256_setzero_si256();
   95|       |
   96|     89|        while (k >= 32) {
  ------------------
  |  Branch (96:16): [True: 29, False: 60]
  ------------------
   97|       |            /*
   98|       |               vs1 = adler + sum(c[i])
   99|       |               vs2 = sum2 + 32 vs1 + sum( (32-i+1) c[i] )
  100|       |            */
  101|     29|            __m256i vbuf = _mm256_loadu_si256((__m256i*)src);
  102|     29|            src += 32;
  103|     29|            k -= 32;
  104|       |
  105|     29|            __m256i vs1_sad = _mm256_sad_epu8(vbuf, zero); // Sum of abs diff, resulting in 2 x int32's
  106|       |
  107|     29|            if (COPY) {
  ------------------
  |  Branch (107:17): [True: 23, False: 6]
  ------------------
  108|     23|                _mm256_storeu_si256((__m256i*)dst, vbuf);
  109|     23|                dst += 32;
  110|     23|            }
  111|       | 
  112|     29|            vs1 = _mm256_add_epi32(vs1, vs1_sad);
  113|     29|            vs3 = _mm256_add_epi32(vs3, vs1_0);
  114|     29|            __m256i v_short_sum2 = _mm256_maddubs_epi16(vbuf, dot2v_0); // sum 32 uint8s to 16 shorts
  115|     29|            __m256i vsum2 = _mm256_madd_epi16(v_short_sum2, dot3v); // sum 16 shorts to 8 uint32s
  116|     29|            vs2 = _mm256_add_epi32(vsum2, vs2);
  117|     29|            vs1_0 = vs1;
  118|     29|        }
  119|       |
  120|       |        /* Defer the multiplication with 32 to outside of the loop */
  121|     60|        vs3 = _mm256_slli_epi32(vs3, 5);
  122|     60|        vs2 = _mm256_add_epi32(vs2, vs3);
  123|       |
  124|       |        /* The compiler is generating the following sequence for this integer modulus
  125|       |         * when done the scalar way, in GPRs:
  126|       |
  127|       |         adler = (s1_unpack[0] % BASE) + (s1_unpack[1] % BASE) + (s1_unpack[2] % BASE) + (s1_unpack[3] % BASE) +
  128|       |                 (s1_unpack[4] % BASE) + (s1_unpack[5] % BASE) + (s1_unpack[6] % BASE) + (s1_unpack[7] % BASE);
  129|       |
  130|       |         mov    $0x80078071,%edi // move magic constant into 32 bit register %edi
  131|       |         ...
  132|       |         vmovd  %xmm1,%esi // move vector lane 0 to 32 bit register %esi
  133|       |         mov    %rsi,%rax  // zero-extend this value to 64 bit precision in %rax
  134|       |         imul   %rdi,%rsi // do a signed multiplication with magic constant and vector element
  135|       |         shr    $0x2f,%rsi // shift right by 47
  136|       |         imul   $0xfff1,%esi,%esi // do a signed multiplication with value truncated to 32 bits with 0xfff1
  137|       |         sub    %esi,%eax // subtract lower 32 bits of original vector value from modified one above
  138|       |         ...
  139|       |         // repeats for each element with vpextract instructions
  140|       |
  141|       |         This is tricky with AVX2 for a number of reasons:
  142|       |             1.) There's no 64 bit multiplication instruction, but there is a sequence to get there
  143|       |             2.) There's ways to extend vectors to 64 bit precision, but no simple way to truncate
  144|       |                 back down to 32 bit precision later (there is in AVX512)
  145|       |             3.) Full width integer multiplications aren't cheap
  146|       |
  147|       |         We can, however, do a relatively cheap sequence for horizontal sums.
  148|       |         Then, we simply do the integer modulus on the resulting 64 bit GPR, on a scalar value. It was
  149|       |         previously thought that casting to 64 bit precision was needed prior to the horizontal sum, but
  150|       |         that is simply not the case, as NMAX is defined as the maximum number of scalar sums that can be
  151|       |         performed on the maximum possible inputs before overflow
  152|       |         */
  153|       |
  154|       |
  155|       |         /* In AVX2-land, this trip through GPRs will probably be unavoidable, as there's no cheap and easy
  156|       |          * conversion from 64 bit integer to 32 bit (needed for the inexpensive modulus with a constant).
  157|       |          * This casting to 32 bit is cheap through GPRs (just register aliasing). See above for exactly
  158|       |          * what the compiler is doing to avoid integer divisions. */
  159|     60|         adler0 = partial_hsum256(vs1) % BASE;
  ------------------
  |  |   11|     60|#define BASE 65521U     /* largest prime smaller than 65536 */
  ------------------
  160|     60|         adler1 = hsum256(vs2) % BASE;
  ------------------
  |  |   11|     60|#define BASE 65521U     /* largest prime smaller than 65536 */
  ------------------
  161|     60|    }
  162|       |
  163|     60|    adler = adler0 | (adler1 << 16);
  164|       |
  165|     60|    if (len) {
  ------------------
  |  Branch (165:9): [True: 51, False: 9]
  ------------------
  166|     51|        goto rem_peel;
  167|     51|    }
  168|       |
  169|      9|    return adler;
  170|     60|}

adler32_avx2.c:partial_hsum256:
   20|     60|static inline uint32_t partial_hsum256(__m256i x) {
   21|       |    /* We need a permutation vector to extract every other integer. The
   22|       |     * rest are going to be zeros */
   23|     60|    const __m256i perm_vec = _mm256_setr_epi32(0, 2, 4, 6, 1, 1, 1, 1);
   24|     60|    __m256i non_zero = _mm256_permutevar8x32_epi32(x, perm_vec);
   25|     60|    __m128i non_zero_sse = _mm256_castsi256_si128(non_zero);
   26|     60|    __m128i sum2  = _mm_add_epi32(non_zero_sse,_mm_unpackhi_epi64(non_zero_sse, non_zero_sse));
   27|       |    __m128i sum3  = _mm_add_epi32(sum2, _mm_shuffle_epi32(sum2, 1));
   28|     60|    return (uint32_t)_mm_cvtsi128_si32(sum3);
   29|     60|}
adler32_avx2.c:hsum256:
   12|     60|static inline uint32_t hsum256(__m256i x) {
   13|     60|    __m128i sum1  = _mm_add_epi32(_mm256_extracti128_si256(x, 1),
   14|     60|                                  _mm256_castsi256_si128(x));
   15|     60|    __m128i sum2  = _mm_add_epi32(sum1, _mm_unpackhi_epi64(sum1, sum1));
   16|       |    __m128i sum3  = _mm_add_epi32(sum2, _mm_shuffle_epi32(sum2, 1));
   17|     60|    return (uint32_t)_mm_cvtsi128_si32(sum3);
   18|     60|}

adler32_fold_copy_sse42:
   16|     24|Z_INTERNAL uint32_t adler32_fold_copy_sse42(uint32_t adler, uint8_t *dst, const uint8_t *src, size_t len) {
   17|     24|    uint32_t adler0, adler1;
   18|     24|    adler1 = (adler >> 16) & 0xffff;
   19|     24|    adler0 = adler & 0xffff;
   20|       |
   21|     46|rem_peel:
   22|     46|    if (len < 16) {
  ------------------
  |  Branch (22:9): [True: 22, False: 24]
  ------------------
   23|     22|       return adler32_copy_len_16(adler0, src, dst, len, adler1);
   24|     22|    }
   25|       |
   26|     24|    __m128i vbuf, vbuf_0;
   27|     24|    __m128i vs1_0, vs3, vs1, vs2, vs2_0, v_sad_sum1, v_short_sum2, v_short_sum2_0,
   28|     24|            v_sad_sum2, vsum2, vsum2_0;
   29|     24|    __m128i zero = _mm_setzero_si128();
   30|     24|    const __m128i dot2v = _mm_setr_epi8(32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17);
   31|     24|    const __m128i dot2v_0 = _mm_setr_epi8(16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1);
   32|     24|    const __m128i dot3v = _mm_set1_epi16(1);
   33|     24|    size_t k;
   34|       |
   35|     48|    while (len >= 16) {
  ------------------
  |  Branch (35:12): [True: 24, False: 24]
  ------------------
   36|       |
   37|     24|        k = MIN(len, NMAX);
  ------------------
  |  |  124|     24|#define MIN(a, b) ((a) > (b) ? (b) : (a))
  |  |  ------------------
  |  |  |  Branch (124:20): [True: 0, False: 24]
  |  |  ------------------
  ------------------
   38|     24|        k -= k % 16;
   39|     24|        len -= k;
   40|       |
   41|     24|        vs1 = _mm_cvtsi32_si128(adler0);
   42|     24|        vs2 = _mm_cvtsi32_si128(adler1);
   43|       |
   44|     24|        vs3 = _mm_setzero_si128();
   45|     24|        vs2_0 = _mm_setzero_si128();
   46|     24|        vs1_0 = vs1;
   47|       |
   48|     24|        while (k >= 32) {
  ------------------
  |  Branch (48:16): [True: 0, False: 24]
  ------------------
   49|       |            /*
   50|       |               vs1 = adler + sum(c[i])
   51|       |               vs2 = sum2 + 16 vs1 + sum( (16-i+1) c[i] )
   52|       |            */
   53|      0|            vbuf = _mm_loadu_si128((__m128i*)src);
   54|      0|            vbuf_0 = _mm_loadu_si128((__m128i*)(src + 16));
   55|      0|            src += 32;
   56|      0|            k -= 32;
   57|       |
   58|      0|            v_sad_sum1 = _mm_sad_epu8(vbuf, zero);
   59|      0|            v_sad_sum2 = _mm_sad_epu8(vbuf_0, zero);
   60|      0|            _mm_storeu_si128((__m128i*)dst, vbuf);
   61|      0|            _mm_storeu_si128((__m128i*)(dst + 16), vbuf_0);
   62|      0|            dst += 32;
   63|       |
   64|      0|            v_short_sum2 = _mm_maddubs_epi16(vbuf, dot2v);
   65|      0|            v_short_sum2_0 = _mm_maddubs_epi16(vbuf_0, dot2v_0);
   66|       |
   67|      0|            vs1 = _mm_add_epi32(v_sad_sum1, vs1);
   68|      0|            vs3 = _mm_add_epi32(vs1_0, vs3);
   69|       |
   70|      0|            vsum2 = _mm_madd_epi16(v_short_sum2, dot3v);
   71|      0|            vsum2_0 = _mm_madd_epi16(v_short_sum2_0, dot3v);
   72|      0|            vs1 = _mm_add_epi32(v_sad_sum2, vs1);
   73|      0|            vs2 = _mm_add_epi32(vsum2, vs2);
   74|      0|            vs2_0 = _mm_add_epi32(vsum2_0, vs2_0);
   75|      0|            vs1_0 = vs1;
   76|      0|        }
   77|       |
   78|     24|        vs2 = _mm_add_epi32(vs2_0, vs2);
   79|     24|        vs3 = _mm_slli_epi32(vs3, 5);
   80|     24|        vs2 = _mm_add_epi32(vs3, vs2);
   81|     24|        vs3 = _mm_setzero_si128();
   82|       |
   83|     48|        while (k >= 16) {
  ------------------
  |  Branch (83:16): [True: 24, False: 24]
  ------------------
   84|       |            /*
   85|       |               vs1 = adler + sum(c[i])
   86|       |               vs2 = sum2 + 16 vs1 + sum( (16-i+1) c[i] )
   87|       |            */
   88|     24|            vbuf = _mm_loadu_si128((__m128i*)src);
   89|     24|            src += 16;
   90|     24|            k -= 16;
   91|       |
   92|     24|            v_sad_sum1 = _mm_sad_epu8(vbuf, zero);
   93|     24|            v_short_sum2 = _mm_maddubs_epi16(vbuf, dot2v_0);
   94|       |
   95|     24|            vs1 = _mm_add_epi32(v_sad_sum1, vs1);
   96|     24|            vs3 = _mm_add_epi32(vs1_0, vs3);
   97|     24|            vsum2 = _mm_madd_epi16(v_short_sum2, dot3v);
   98|     24|            vs2 = _mm_add_epi32(vsum2, vs2);
   99|     24|            vs1_0 = vs1;
  100|       |
  101|     24|            _mm_storeu_si128((__m128i*)dst, vbuf);
  102|     24|            dst += 16;
  103|     24|        }
  104|       |
  105|     24|        vs3 = _mm_slli_epi32(vs3, 4);
  106|     24|        vs2 = _mm_add_epi32(vs2, vs3);
  107|       |
  108|     24|        adler0 = partial_hsum(vs1) % BASE;
  ------------------
  |  |   11|     24|#define BASE 65521U     /* largest prime smaller than 65536 */
  ------------------
  109|     24|        adler1 = hsum(vs2) % BASE;
  ------------------
  |  |   11|     24|#define BASE 65521U     /* largest prime smaller than 65536 */
  ------------------
  110|     24|    }
  111|       |
  112|       |    /* If this is true, there's fewer than 16 elements remaining */
  113|     24|    if (len) {
  ------------------
  |  Branch (113:9): [True: 22, False: 2]
  ------------------
  114|     22|        goto rem_peel;
  115|     22|    }
  116|       |
  117|      2|    return adler0 | (adler1 << 16);
  118|     24|}

adler32_ssse3:
   17|      4|Z_INTERNAL uint32_t adler32_ssse3(uint32_t adler, const uint8_t *buf, size_t len) {
   18|      4|    uint32_t sum2;
   19|       |
   20|       |     /* split Adler-32 into component sums */
   21|      4|    sum2 = (adler >> 16) & 0xffff;
   22|      4|    adler &= 0xffff;
   23|       |
   24|       |    /* in case user likes doing a byte at a time, keep it fast */
   25|      4|    if (UNLIKELY(len == 1))
  ------------------
  |  |  214|      4|#  define UNLIKELY(x)           __builtin_expect(!!(x), 0)
  |  |  ------------------
  |  |  |  Branch (214:33): [True: 0, False: 4]
  |  |  ------------------
  ------------------
   26|      0|        return adler32_len_1(adler, buf, sum2);
   27|       |
   28|       |    /* initial Adler-32 value (deferred check for len == 1 speed) */
   29|      4|    if (UNLIKELY(buf == NULL))
  ------------------
  |  |  214|      4|#  define UNLIKELY(x)           __builtin_expect(!!(x), 0)
  |  |  ------------------
  |  |  |  Branch (214:33): [True: 0, False: 4]
  |  |  ------------------
  ------------------
   30|      0|        return 1L;
   31|       |
   32|       |    /* in case short lengths are provided, keep it somewhat fast */
   33|      4|    if (UNLIKELY(len < 16))
  ------------------
  |  |  214|      4|#  define UNLIKELY(x)           __builtin_expect(!!(x), 0)
  |  |  ------------------
  |  |  |  Branch (214:33): [True: 0, False: 4]
  |  |  ------------------
  ------------------
   34|      0|        return adler32_len_16(adler, buf, len, sum2);
   35|       |
   36|      4|    const __m128i dot2v = _mm_setr_epi8(32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17);
   37|      4|    const __m128i dot2v_0 = _mm_setr_epi8(16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1);
   38|      4|    const __m128i dot3v = _mm_set1_epi16(1);
   39|      4|    const __m128i zero = _mm_setzero_si128();
   40|       |
   41|      4|    __m128i vbuf, vs1_0, vs3, vs1, vs2, vs2_0, v_sad_sum1, v_short_sum2, v_short_sum2_0,
   42|      4|            vbuf_0, v_sad_sum2, vsum2, vsum2_0;
   43|       |
   44|       |    /* If our buffer is unaligned (likely), make the determination whether
   45|       |     * or not there's enough of a buffer to consume to make the scalar, aligning
   46|       |     * additions worthwhile or if it's worth it to just eat the cost of an unaligned
   47|       |     * load. This is a pretty simple test, just test if 16 - the remainder + len is
   48|       |     * < 16 */
   49|      4|    size_t max_iters = NMAX;
  ------------------
  |  |   12|      4|#define NMAX 5552
  ------------------
   50|      4|    size_t rem = (uintptr_t)buf & 15;
   51|      4|    size_t align_offset = 16 - rem;
   52|      4|    size_t k = 0;
   53|      4|    if (rem) {
  ------------------
  |  Branch (53:9): [True: 0, False: 4]
  ------------------
   54|      0|        if (len < 16 + align_offset) {
  ------------------
  |  Branch (54:13): [True: 0, False: 0]
  ------------------
   55|       |            /* Let's eat the cost of this one unaligned load so that
   56|       |             * we don't completely skip over the vectorization. Doing
   57|       |             * 16 bytes at a time unaligned is better than 16 + <= 15
   58|       |             * sums */
   59|      0|            vbuf = _mm_loadu_si128((__m128i*)buf);
   60|      0|            len -= 16;
   61|      0|            buf += 16;
   62|      0|            vs1 = _mm_cvtsi32_si128(adler);
   63|      0|            vs2 = _mm_cvtsi32_si128(sum2);
   64|      0|            vs3 = _mm_setzero_si128();
   65|      0|            vs1_0 = vs1;
   66|      0|            goto unaligned_jmp;
   67|      0|        }
   68|       |
   69|      0|        for (size_t i = 0; i < align_offset; ++i) {
  ------------------
  |  Branch (69:28): [True: 0, False: 0]
  ------------------
   70|      0|            adler += *(buf++);
   71|      0|            sum2 += adler;
   72|      0|        }
   73|       |
   74|       |        /* lop off the max number of sums based on the scalar sums done
   75|       |         * above */
   76|      0|        len -= align_offset;
   77|      0|        max_iters -= align_offset;
   78|      0|    }
   79|       |
   80|       |
   81|      8|    while (len >= 16) {
  ------------------
  |  Branch (81:12): [True: 4, False: 4]
  ------------------
   82|      4|        vs1 = _mm_cvtsi32_si128(adler);
   83|      4|        vs2 = _mm_cvtsi32_si128(sum2);
   84|      4|        vs3 = _mm_setzero_si128();
   85|      4|        vs2_0 = _mm_setzero_si128();
   86|      4|        vs1_0 = vs1;
   87|       |
   88|      4|        k = (len < max_iters ? len : max_iters);
  ------------------
  |  Branch (88:14): [True: 4, False: 0]
  ------------------
   89|      4|        k -= k % 16;
   90|      4|        len -= k;
   91|       |
   92|      4|        while (k >= 32) {
  ------------------
  |  Branch (92:16): [True: 0, False: 4]
  ------------------
   93|       |            /*
   94|       |               vs1 = adler + sum(c[i])
   95|       |               vs2 = sum2 + 16 vs1 + sum( (16-i+1) c[i] )
   96|       |            */
   97|      0|            vbuf = _mm_load_si128((__m128i*)buf);
   98|      0|            vbuf_0 = _mm_load_si128((__m128i*)(buf + 16));
   99|      0|            buf += 32;
  100|      0|            k -= 32;
  101|       |
  102|      0|            v_sad_sum1 = _mm_sad_epu8(vbuf, zero);
  103|      0|            v_sad_sum2 = _mm_sad_epu8(vbuf_0, zero);
  104|      0|            vs1 = _mm_add_epi32(v_sad_sum1, vs1);
  105|      0|            vs3 = _mm_add_epi32(vs1_0, vs3);
  106|       |
  107|      0|            vs1 = _mm_add_epi32(v_sad_sum2, vs1);
  108|      0|            v_short_sum2 = _mm_maddubs_epi16(vbuf, dot2v);
  109|      0|            vsum2 = _mm_madd_epi16(v_short_sum2, dot3v);
  110|      0|            v_short_sum2_0 = _mm_maddubs_epi16(vbuf_0, dot2v_0);
  111|      0|            vs2 = _mm_add_epi32(vsum2, vs2);
  112|      0|            vsum2_0 = _mm_madd_epi16(v_short_sum2_0, dot3v);
  113|      0|            vs2_0 = _mm_add_epi32(vsum2_0, vs2_0);
  114|      0|            vs1_0 = vs1;
  115|      0|        }
  116|       |
  117|      4|        vs2 = _mm_add_epi32(vs2_0, vs2);
  118|      4|        vs3 = _mm_slli_epi32(vs3, 5);
  119|      4|        vs2 = _mm_add_epi32(vs3, vs2);
  120|      4|        vs3 = _mm_setzero_si128();
  121|       |
  122|      8|        while (k >= 16) {
  ------------------
  |  Branch (122:16): [True: 4, False: 4]
  ------------------
  123|       |            /*
  124|       |               vs1 = adler + sum(c[i])
  125|       |               vs2 = sum2 + 16 vs1 + sum( (16-i+1) c[i] )
  126|       |            */
  127|      4|            vbuf = _mm_load_si128((__m128i*)buf);
  128|      4|            buf += 16;
  129|      4|            k -= 16;
  130|       |
  131|      4|unaligned_jmp:
  132|      4|            v_sad_sum1 = _mm_sad_epu8(vbuf, zero);
  133|      4|            vs1 = _mm_add_epi32(v_sad_sum1, vs1);
  134|      4|            vs3 = _mm_add_epi32(vs1_0, vs3);
  135|      4|            v_short_sum2 = _mm_maddubs_epi16(vbuf, dot2v_0);
  136|      4|            vsum2 = _mm_madd_epi16(v_short_sum2, dot3v);
  137|      4|            vs2 = _mm_add_epi32(vsum2, vs2);
  138|      4|            vs1_0 = vs1;
  139|      4|        }
  140|       |
  141|      4|        vs3 = _mm_slli_epi32(vs3, 4);
  142|      4|        vs2 = _mm_add_epi32(vs2, vs3);
  143|       |
  144|       |        /* We don't actually need to do a full horizontal sum, since psadbw is actually doing
  145|       |         * a partial reduction sum implicitly and only summing to integers in vector positions
  146|       |         * 0 and 2. This saves us some contention on the shuffle port(s) */
  147|      4|        adler = partial_hsum(vs1) % BASE;
  ------------------
  |  |   11|      4|#define BASE 65521U     /* largest prime smaller than 65536 */
  ------------------
  148|      4|        sum2 = hsum(vs2) % BASE;
  ------------------
  |  |   11|      4|#define BASE 65521U     /* largest prime smaller than 65536 */
  ------------------
  149|      4|        max_iters = NMAX;
  ------------------
  |  |   12|      4|#define NMAX 5552
  ------------------
  150|      4|    }
  151|       |
  152|       |    /* Process tail (len < 16).  */
  153|      4|    return adler32_len_16(adler, buf, len, sum2);
  154|      4|}

adler32_ssse3.c:partial_hsum:
   14|      4|static inline uint32_t partial_hsum(__m128i x) {
   15|       |    __m128i second_int = _mm_srli_si128(x, 8);
   16|      4|    __m128i sum = _mm_add_epi32(x, second_int);
   17|      4|    return _mm_cvtsi128_si32(sum);
   18|      4|}
adler32_ssse3.c:hsum:
   20|      4|static inline uint32_t hsum(__m128i x) {
   21|      4|    __m128i sum1 = _mm_unpackhi_epi64(x, x);
   22|      4|    __m128i sum2 = _mm_add_epi32(x, sum1);
   23|       |    __m128i sum3 = _mm_shuffle_epi32(sum2, 0x01);
   24|      4|    __m128i sum4 = _mm_add_epi32(sum2, sum3);
   25|      4|    return _mm_cvtsi128_si32(sum4);
   26|      4|}
adler32_sse42.c:partial_hsum:
   14|     24|static inline uint32_t partial_hsum(__m128i x) {
   15|       |    __m128i second_int = _mm_srli_si128(x, 8);
   16|     24|    __m128i sum = _mm_add_epi32(x, second_int);
   17|     24|    return _mm_cvtsi128_si32(sum);
   18|     24|}
adler32_sse42.c:hsum:
   20|     24|static inline uint32_t hsum(__m128i x) {
   21|     24|    __m128i sum1 = _mm_unpackhi_epi64(x, x);
   22|     24|    __m128i sum2 = _mm_add_epi32(x, sum1);
   23|       |    __m128i sum3 = _mm_shuffle_epi32(sum2, 0x01);
   24|     24|    __m128i sum4 = _mm_add_epi32(sum2, sum3);
   25|     24|    return _mm_cvtsi128_si32(sum4);
   26|     24|}

chunkset_avx2.c:loadhalfchunk:
   91|      7|static inline void loadhalfchunk(uint8_t const *s, halfchunk_t *chunk) {
   92|      7|    *chunk = _mm_loadu_si128((__m128i *)s);
   93|      7|}
chunkset_avx2.c:GET_HALFCHUNK_MAG:
  105|     25|static inline halfchunk_t GET_HALFCHUNK_MAG(uint8_t *buf, uint32_t *chunk_rem, uint32_t dist) {
  106|     25|    lut_rem_pair lut_rem = perm_idx_lut[dist - 3];
  107|     25|    __m128i perm_vec, ret_vec;
  108|     25|    __msan_unpoison(buf + dist, 16 - dist);
  ------------------
  |  |  338|     25|#  define __msan_unpoison(a, size) do { Z_UNUSED(a); Z_UNUSED(size); } while (0)
  |  |  ------------------
  |  |  |  |  128|     25|#define Z_UNUSED(var) (void)(var)
  |  |  ------------------
  |  |               #  define __msan_unpoison(a, size) do { Z_UNUSED(a); Z_UNUSED(size); } while (0)
  |  |  ------------------
  |  |  |  |  128|     25|#define Z_UNUSED(var) (void)(var)
  |  |  ------------------
  |  |  |  Branch (338:79): [Folded, False: 25]
  |  |  ------------------
  ------------------
  109|     25|    ret_vec = _mm_loadu_si128((__m128i*)buf);
  110|     25|    *chunk_rem = half_rem_vals[dist - 3];
  111|       |
  112|     25|    perm_vec = _mm_load_si128((__m128i*)(permute_table + lut_rem.idx));
  113|     25|    ret_vec = _mm_shuffle_epi8(ret_vec, perm_vec);
  114|       |
  115|     25|    return ret_vec;
  116|     25|}
chunkset_avx2.c:storehalfchunk:
   95|      9|static inline void storehalfchunk(uint8_t *out, halfchunk_t *chunk) {
   96|      9|    _mm_storeu_si128((__m128i *)out, *chunk);
   97|      9|}
chunkset_avx2.c:halfchunk2whole:
   99|     25|static inline chunk_t halfchunk2whole(halfchunk_t *chunk) {
  100|       |    /* We zero extend mostly to appease some memory sanitizers. These bytes are ultimately
  101|       |     * unlikely to be actually written or read from */
  102|     25|    return _mm256_zextsi128_si256(*chunk);
  103|     25|}
chunkset_avx2.c:chunkmemset_2:
   22|     15|static inline void chunkmemset_2(uint8_t *from, chunk_t *chunk) {
   23|     15|    *chunk = _mm256_set1_epi16(zng_memread_2(from));
   24|     15|}
chunkset_avx2.c:chunkmemset_4:
   26|     13|static inline void chunkmemset_4(uint8_t *from, chunk_t *chunk) {
   27|     13|    *chunk = _mm256_set1_epi32(zng_memread_4(from));
   28|     13|}
chunkset_avx2.c:chunkmemset_8:
   30|      9|static inline void chunkmemset_8(uint8_t *from, chunk_t *chunk) {
   31|      9|    *chunk = _mm256_set1_epi64x(zng_memread_8(from));
   32|      9|}
chunkset_avx2.c:chunkmemset_16:
   34|      6|static inline void chunkmemset_16(uint8_t *from, chunk_t *chunk) {
   35|       |    /* See explanation in chunkset_avx512.c */
   36|       |#if defined(_MSC_VER) && _MSC_VER <= 1900
   37|       |    halfchunk_t half = _mm_loadu_si128((__m128i*)from);
   38|       |    *chunk = _mm256_inserti128_si256(_mm256_castsi128_si256(half), half, 1);
   39|       |#else
   40|      6|    *chunk = _mm256_broadcastsi128_si256(_mm_loadu_si128((__m128i*)from));
   41|      6|#endif
   42|      6|}
chunkset_avx2.c:GET_CHUNK_MAG:
   52|     34|static inline chunk_t GET_CHUNK_MAG(uint8_t *buf, uint32_t *chunk_rem, uint32_t dist) {
   53|     34|    lut_rem_pair lut_rem = perm_idx_lut[dist - 3];
   54|     34|    __m256i ret_vec;
   55|       |    /* While technically we only need to read 4 or 8 bytes into this vector register for a lot of cases, GCC is
   56|       |     * compiling this to a shared load for all branches, preferring the simpler code.  Given that the buf value isn't in
   57|       |     * GPRs to begin with the 256 bit load is _probably_ just as inexpensive */
   58|     34|    *chunk_rem = lut_rem.remval;
   59|       |
   60|       |    /* See note in chunkset_ssse3.c for why this is ok */
   61|     34|    __msan_unpoison(buf + dist, 32 - dist);
  ------------------
  |  |  338|     34|#  define __msan_unpoison(a, size) do { Z_UNUSED(a); Z_UNUSED(size); } while (0)
  |  |  ------------------
  |  |  |  |  128|     34|#define Z_UNUSED(var) (void)(var)
  |  |  ------------------
  |  |               #  define __msan_unpoison(a, size) do { Z_UNUSED(a); Z_UNUSED(size); } while (0)
  |  |  ------------------
  |  |  |  |  128|     34|#define Z_UNUSED(var) (void)(var)
  |  |  ------------------
  |  |  |  Branch (338:79): [Folded, False: 34]
  |  |  ------------------
  ------------------
   62|       |
   63|     34|    if (dist < 16) {
  ------------------
  |  Branch (63:9): [True: 15, False: 19]
  ------------------
   64|       |        /* This simpler case still requires us to shuffle in 128 bit lanes, so we must apply a static offset after
   65|       |         * broadcasting the first vector register to both halves. This is _marginally_ faster than doing two separate
   66|       |         * shuffles and combining the halves later */
   67|     15|        const __m256i permute_xform =
   68|     15|            _mm256_setr_epi8(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
   69|     15|                             16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16);
   70|     15|        __m256i perm_vec = _mm256_load_si256((__m256i*)(permute_table+lut_rem.idx));
   71|     15|        __m128i ret_vec0 = _mm_loadu_si128((__m128i*)buf);
   72|     15|        perm_vec = _mm256_add_epi8(perm_vec, permute_xform);
   73|     15|        ret_vec = _mm256_inserti128_si256(_mm256_castsi128_si256(ret_vec0), ret_vec0, 1);
   74|     15|        ret_vec = _mm256_shuffle_epi8(ret_vec, perm_vec);
   75|     19|    }  else {
   76|     19|        __m128i ret_vec0 = _mm_loadu_si128((__m128i*)buf);
   77|     19|        __m128i ret_vec1 = _mm_loadu_si128((__m128i*)(buf + 16));
   78|       |        /* Take advantage of the fact that only the latter half of the 256 bit vector will actually differ */
   79|     19|        __m128i perm_vec1 = _mm_load_si128((__m128i*)(permute_table + lut_rem.idx));
   80|     19|        __m128i xlane_permutes = _mm_cmpgt_epi8(_mm_set1_epi8(16), perm_vec1);
   81|     19|        __m128i xlane_res  = _mm_shuffle_epi8(ret_vec0, perm_vec1);
   82|       |        /* Since we can't wrap twice, we can simply keep the later half exactly how it is instead of having to _also_
   83|       |         * shuffle those values */
   84|     19|        __m128i latter_half = _mm_blendv_epi8(ret_vec1, xlane_res, xlane_permutes);
   85|     19|        ret_vec = _mm256_inserti128_si256(_mm256_castsi128_si256(ret_vec0), latter_half, 1);
   86|     19|    }
   87|       |
   88|     34|    return ret_vec;
   89|     34|}
chunkset_avx2.c:storechunk:
   48|    221|static inline void storechunk(uint8_t *out, chunk_t *chunk) {
   49|    221|    _mm256_storeu_si256((__m256i *)out, *chunk);
   50|    221|}
chunkset_avx2.c:loadchunk:
   44|     58|static inline void loadchunk(uint8_t const *s, chunk_t *chunk) {
   45|     58|    *chunk = _mm256_loadu_si256((__m256i *)s);
   46|     58|}

x86_check_features:
   79|      1|void Z_INTERNAL x86_check_features(struct x86_cpu_features *features) {
   80|      1|    unsigned eax, ebx, ecx, edx;
   81|      1|    unsigned maxbasic;
   82|       |
   83|      1|    cpuid(0, &maxbasic, &ebx, &ecx, &edx);
   84|      1|    cpuid(1 /*CPU_PROCINFO_AND_FEATUREBITS*/, &eax, &ebx, &ecx, &edx);
   85|       |
   86|      1|    features->has_sse2 = edx & 0x4000000;
   87|      1|    features->has_ssse3 = ecx & 0x200;
   88|      1|    features->has_sse41 = ecx & 0x80000;
   89|      1|    features->has_sse42 = ecx & 0x100000;
   90|      1|    features->has_pclmulqdq = ecx & 0x2;
   91|       |
   92|      1|    if (ecx & 0x08000000) {
  ------------------
  |  Branch (92:9): [True: 1, False: 0]
  ------------------
   93|      1|        uint64_t xfeature = xgetbv(0);
   94|       |
   95|      1|        features->has_os_save_ymm = ((xfeature & 0x06) == 0x06);
   96|      1|        features->has_os_save_zmm = ((xfeature & 0xe6) == 0xe6);
   97|      1|    }
   98|       |
   99|      1|    if (maxbasic >= 7) {
  ------------------
  |  Branch (99:9): [True: 1, False: 0]
  ------------------
  100|       |        // Reference: https://software.intel.com/sites/default/files/article/405250/how-to-detect-new-instruction-support-in-the-4th-generation-intel-core-processor-family.pdf
  101|      1|        cpuidex(7, 0, &eax, &ebx, &ecx, &edx);
  102|       |
  103|       |        // check BMI2 bit
  104|      1|        features->has_bmi2 = ebx & 0x100;
  105|       |
  106|       |        // check AVX2 bit if the OS supports saving YMM registers
  107|      1|        if (features->has_os_save_ymm) {
  ------------------
  |  Branch (107:13): [True: 1, False: 0]
  ------------------
  108|      1|            features->has_avx2 = ebx & 0x20;
  109|      1|        }
  110|       |
  111|       |        // check AVX512 bits if the OS supports saving ZMM registers
  112|      1|        if (features->has_os_save_zmm) {
  ------------------
  |  Branch (112:13): [True: 0, False: 1]
  ------------------
  113|      0|            features->has_avx512f = ebx & 0x00010000;
  114|      0|            if (features->has_avx512f) {
  ------------------
  |  Branch (114:17): [True: 0, False: 0]
  ------------------
  115|       |                // According to the Intel Software Developer's Manual, AVX512F must be enabled too in order to enable
  116|       |                // AVX512(DQ,BW,VL).
  117|      0|                features->has_avx512dq = ebx & 0x00020000;
  118|      0|                features->has_avx512bw = ebx & 0x40000000;
  119|      0|                features->has_avx512vl = ebx & 0x80000000;
  120|      0|            }
  121|      0|            features->has_avx512_common = features->has_avx512f && features->has_avx512dq && features->has_avx512bw \
  ------------------
  |  Branch (121:43): [True: 0, False: 0]
  |  Branch (121:68): [True: 0, False: 0]
  |  Branch (121:94): [True: 0, False: 0]
  ------------------
  122|      0|              && features->has_avx512vl && features->has_bmi2;
  ------------------
  |  Branch (122:18): [True: 0, False: 0]
  |  Branch (122:44): [True: 0, False: 0]
  ------------------
  123|      0|            features->has_avx512vnni = ecx & 0x800;
  124|      0|            features->has_vpclmulqdq = ecx & 0x400;
  125|      0|        }
  126|      1|    }
  127|      1|}
x86_features.c:cpuid:
   30|      2|static inline void cpuid(int info, unsigned* eax, unsigned* ebx, unsigned* ecx, unsigned* edx) {
   31|       |#if defined(HAVE_CPUID_MS)
   32|       |    unsigned int registers[4];
   33|       |    __cpuid((int *)registers, info);
   34|       |
   35|       |    *eax = registers[0];
   36|       |    *ebx = registers[1];
   37|       |    *ecx = registers[2];
   38|       |    *edx = registers[3];
   39|       |#elif defined(HAVE_CPUID_GNU)
   40|       |    *eax = *ebx = *ecx = *edx = 0;
   41|      2|    __cpuid(info, *eax, *ebx, *ecx, *edx);
   42|       |#else
   43|       |    /* When using this fallback, the faster SSE/AVX code is disabled */
   44|       |    *eax = *ebx = *ecx = *edx = 0;
   45|       |#endif
   46|      2|}
x86_features.c:xgetbv:
   66|      1|static inline uint64_t xgetbv(unsigned int xcr) {
   67|      1|#if defined(_MSC_VER) || defined(X86_HAVE_XSAVE_INTRIN)
   68|      1|    return _xgetbv(xcr);
   69|       |#elif defined(__GNUC__)
   70|       |    uint32_t eax, edx;
   71|       |    __asm__ ( ".byte 0x0f, 0x01, 0xd0" : "=a"(eax), "=d"(edx) : "c"(xcr));
   72|       |    return (uint64_t)(edx) << 32 | eax;
   73|       |#else
   74|       |    /* When using this fallback, some of the faster code is disabled */
   75|       |    return 0;
   76|       |#endif
   77|      1|}
x86_features.c:cpuidex:
   48|      1|static inline void cpuidex(int info, int subinfo, unsigned* eax, unsigned* ebx, unsigned* ecx, unsigned* edx) {
   49|       |#if defined(HAVE_CPUID_MS)
   50|       |    unsigned int registers[4];
   51|       |    __cpuidex((int *)registers, info, subinfo);
   52|       |
   53|       |    *eax = registers[0];
   54|       |    *ebx = registers[1];
   55|       |    *ecx = registers[2];
   56|       |    *edx = registers[3];
   57|       |#elif defined(HAVE_CPUID_GNU)
   58|       |    *eax = *ebx = *ecx = *edx = 0;
   59|      1|    __cpuid_count(info, subinfo, *eax, *ebx, *ecx, *edx);
   60|       |#else
   61|       |    /* When using this fallback, the faster SSE/AVX code is disabled */
   62|       |    *eax = *ebx = *ecx = *edx = 0;
   63|       |#endif
   64|      1|}

chunkmemset_safe_avx2:
  229|    237|Z_INTERNAL uint8_t* CHUNKMEMSET_SAFE(uint8_t *out, uint8_t *from, unsigned len, unsigned left) {
  230|       |#if OPTIMAL_CMP < 32
  231|       |    static const uint32_t align_mask = 7;
  232|       |#elif OPTIMAL_CMP == 32
  233|       |    static const uint32_t align_mask = 3;
  234|       |#endif
  235|       |
  236|    237|    len = MIN(len, left);
  ------------------
  |  |  124|    237|#define MIN(a, b) ((a) > (b) ? (b) : (a))
  |  |  ------------------
  |  |  |  Branch (124:20): [True: 0, False: 237]
  |  |  ------------------
  ------------------
  237|       |
  238|       |#if OPTIMAL_CMP < 64
  239|       |    while (((uintptr_t)out & align_mask) && (len > 0)) {
  240|       |        *out++ = *from++;
  241|       |        --len;
  242|       |        --left;
  243|       |    }
  244|       |#endif
  245|       |
  246|    237|#ifndef HAVE_MASKED_READWRITE
  247|    237|    if (UNLIKELY(left < sizeof(chunk_t))) {
  ------------------
  |  |  214|    237|#  define UNLIKELY(x)           __builtin_expect(!!(x), 0)
  |  |  ------------------
  |  |  |  Branch (214:33): [True: 25, False: 212]
  |  |  ------------------
  ------------------
  248|    263|        while (len > 0) {
  ------------------
  |  Branch (248:16): [True: 238, False: 25]
  ------------------
  249|    238|            *out++ = *from++;
  250|    238|            --len;
  251|    238|        }
  252|       |
  253|     25|        return out;
  254|     25|    }
  255|    212|#endif
  256|       |
  257|    212|    if (len)
  ------------------
  |  Branch (257:9): [True: 212, False: 0]
  ------------------
  258|    212|        out = CHUNKMEMSET(out, from, len);
  ------------------
  |  |  121|    212|#define CHUNKMEMSET      chunkmemset_avx2
  ------------------
  259|       |
  260|    212|    return out;
  261|    237|}
chunkset_avx2.c:chunkmemset_avx2:
  112|    212|static inline uint8_t* CHUNKMEMSET(uint8_t *out, uint8_t *from, unsigned len) {
  113|       |    /* Debug performance related issues when len < sizeof(uint64_t):
  114|       |       Assert(len >= sizeof(uint64_t), "chunkmemset should be called on larger chunks"); */
  115|    212|    Assert(from != out, "chunkmemset cannot have a distance 0");
  116|       |
  117|    212|    chunk_t chunk_load;
  118|    212|    uint32_t chunk_mod = 0;
  119|    212|    uint32_t adv_amount;
  120|    212|    int64_t sdist = out - from;
  121|    212|    uint64_t dist = llabs(sdist);
  122|       |
  123|       |    /* We are supporting the case for when we are reading bytes from ahead in the buffer.
  124|       |     * We now have to handle this, though it wasn't _quite_ clear if this rare circumstance
  125|       |     * always needed to be handled here or if we're just now seeing it because we are
  126|       |     * dispatching to this function, more */
  127|    212|    if (sdist < 0 && dist < len) {
  ------------------
  |  Branch (127:9): [True: 0, False: 212]
  |  Branch (127:22): [True: 0, False: 0]
  ------------------
  128|       |#ifdef HAVE_MASKED_READWRITE
  129|       |        /* We can still handle this case if we can mitigate over writing _and_ we
  130|       |         * fit the entirety of the copy length with one load */
  131|       |        if (len <= sizeof(chunk_t)) {
  132|       |            /* Tempting to add a goto to the block below but hopefully most compilers
  133|       |             * collapse these identical code segments as one label to jump to */
  134|       |            return CHUNKCOPY(out, from, len);
  135|       |        }
  136|       |#endif
  137|       |        /* Here the memmove semantics match perfectly, as when this happens we are
  138|       |         * effectively sliding down the contents of memory by dist bytes */
  139|      0|        memmove(out, from, len);
  140|      0|        return out + len;
  141|      0|    }
  142|       |
  143|    212|    if (dist == 1) {
  ------------------
  |  Branch (143:9): [True: 79, False: 133]
  ------------------
  144|     79|        memset(out, *from, len);
  145|     79|        return out + len;
  146|    133|    } else if (dist >= sizeof(chunk_t)) {
  ------------------
  |  Branch (146:16): [True: 24, False: 109]
  ------------------
  147|     24|        return CHUNKCOPY(out, from, len);
  ------------------
  |  |  119|     24|#define CHUNKCOPY        chunkcopy_avx2
  ------------------
  148|     24|    }
  149|       |
  150|       |    /* Only AVX2+ as there's 128 bit vectors and 256 bit. We allow for shorter vector
  151|       |     * lengths because they serve to allow more cases to fall into chunkcopy, as the
  152|       |     * distance of the shorter length is still deemed a safe distance. We rewrite this
  153|       |     * here rather than calling the ssse3 variant directly now because doing so required
  154|       |     * dispatching to another function and broke inlining for this function entirely. We
  155|       |     * also can merge an assert and some remainder peeling behavior into the same code blocks,
  156|       |     * making the code a little smaller.  */
  157|    109|#ifdef HAVE_HALF_CHUNK
  158|    109|    if (len <= sizeof(halfchunk_t)) {
  ------------------
  |  Branch (158:9): [True: 56, False: 53]
  ------------------
  159|     56|        if (dist >= sizeof(halfchunk_t))
  ------------------
  |  Branch (159:13): [True: 7, False: 49]
  ------------------
  160|      7|            return HALFCHUNKCOPY(out, from, len);
  161|       |
  162|     49|        if ((dist % 2) != 0 || dist == 6) {
  ------------------
  |  Branch (162:13): [True: 21, False: 28]
  |  Branch (162:32): [True: 4, False: 24]
  ------------------
  163|     25|            halfchunk_t halfchunk_load = GET_HALFCHUNK_MAG(from, &chunk_mod, (unsigned)dist);
  164|       |
  165|     25|            if (len == sizeof(halfchunk_t)) {
  ------------------
  |  Branch (165:17): [True: 2, False: 23]
  ------------------
  166|      2|                storehalfchunk(out, &halfchunk_load);
  167|      2|                len -= sizeof(halfchunk_t);
  168|      2|                out += sizeof(halfchunk_t);
  169|      2|            }
  170|       |
  171|     25|            chunk_load = halfchunk2whole(&halfchunk_load);
  172|     25|            goto rem_bytes;
  173|     25|        }
  174|     49|    }
  175|     77|#endif
  176|       |
  177|     77|#ifdef HAVE_CHUNKMEMSET_2
  178|     77|    if (dist == 2) {
  ------------------
  |  Branch (178:9): [True: 15, False: 62]
  ------------------
  179|     15|        chunkmemset_2(from, &chunk_load);
  180|     15|    } else
  181|     62|#endif
  182|     62|#ifdef HAVE_CHUNKMEMSET_4
  183|     62|    if (dist == 4) {
  ------------------
  |  Branch (183:9): [True: 13, False: 49]
  ------------------
  184|     13|        chunkmemset_4(from, &chunk_load);
  185|     13|    } else
  186|     49|#endif
  187|     49|#ifdef HAVE_CHUNKMEMSET_8
  188|     49|    if (dist == 8) {
  ------------------
  |  Branch (188:9): [True: 9, False: 40]
  ------------------
  189|      9|        chunkmemset_8(from, &chunk_load);
  190|      9|    } else
  191|     40|#endif
  192|     40|#ifdef HAVE_CHUNKMEMSET_16
  193|     40|    if (dist == 16) {
  ------------------
  |  Branch (193:9): [True: 6, False: 34]
  ------------------
  194|      6|        chunkmemset_16(from, &chunk_load);
  195|      6|    } else
  196|     34|#endif
  197|     34|    chunk_load = GET_CHUNK_MAG(from, &chunk_mod, (unsigned)dist);
  198|       |
  199|     77|    adv_amount = sizeof(chunk_t) - chunk_mod;
  200|       |
  201|    141|    while (len >= (2 * sizeof(chunk_t))) {
  ------------------
  |  Branch (201:12): [True: 64, False: 77]
  ------------------
  202|     64|        storechunk(out, &chunk_load);
  203|     64|        storechunk(out + adv_amount, &chunk_load);
  204|     64|        out += 2 * adv_amount;
  205|     64|        len -= 2 * adv_amount;
  206|     64|    }
  207|       |
  208|       |    /* If we don't have a "dist" length that divides evenly into a vector
  209|       |     * register, we can write the whole vector register but we need only
  210|       |     * advance by the amount of the whole string that fits in our chunk_t.
  211|       |     * If we do divide evenly into the vector length, adv_amount = chunk_t size*/
  212|    112|    while (len >= sizeof(chunk_t)) {
  ------------------
  |  Branch (212:12): [True: 35, False: 77]
  ------------------
  213|     35|        storechunk(out, &chunk_load);
  214|     35|        len -= adv_amount;
  215|     35|        out += adv_amount;
  216|     35|    }
  217|       |
  218|     77|#ifdef HAVE_HALF_CHUNK
  219|    102|rem_bytes:
  220|    102|#endif
  221|    102|    if (len) {
  ------------------
  |  Branch (221:9): [True: 99, False: 3]
  ------------------
  222|     99|        memcpy(out, &chunk_load, len);
  223|     99|        out += len;
  224|     99|    }
  225|       |
  226|    102|    return out;
  227|     77|}
chunkset_avx2.c:HALFCHUNKCOPY:
   91|      7|static inline uint8_t* HALFCHUNKCOPY(uint8_t *out, uint8_t const *from, unsigned len) {
   92|      7|    halfchunk_t chunk;
   93|      7|    int32_t align = ((len - 1) % sizeof(halfchunk_t)) + 1;
   94|      7|    loadhalfchunk(from, &chunk);
   95|      7|    storehalfchunk(out, &chunk);
   96|      7|    out += align;
   97|      7|    from += align;
   98|      7|    len -= align;
   99|      7|    while (len > 0) {
  ------------------
  |  Branch (99:12): [True: 0, False: 7]
  ------------------
  100|      0|        loadhalfchunk(from, &chunk);
  101|      0|        storehalfchunk(out, &chunk);
  102|      0|        out += sizeof(halfchunk_t);
  103|      0|        from += sizeof(halfchunk_t);
  104|      0|        len -= sizeof(halfchunk_t);
  105|      0|    }
  106|      7|    return out;
  107|      7|}
chunkset_avx2.c:chunkcopy_avx2:
   24|     24|static inline uint8_t* CHUNKCOPY(uint8_t *out, uint8_t const *from, unsigned len) {
   25|     24|    Assert(len > 0, "chunkcopy should never have a length 0");
   26|     24|    chunk_t chunk;
   27|     24|    int32_t align = ((len - 1) % sizeof(chunk_t)) + 1;
   28|     24|    loadchunk(from, &chunk);
   29|     24|    storechunk(out, &chunk);
   30|     24|    out += align;
   31|     24|    from += align;
   32|     24|    len -= align;
   33|     58|    while (len > 0) {
  ------------------
  |  Branch (33:12): [True: 34, False: 24]
  ------------------
   34|     34|        loadchunk(from, &chunk);
   35|     34|        storechunk(out, &chunk);
   36|     34|        out += sizeof(chunk_t);
   37|     34|        from += sizeof(chunk_t);
   38|     34|        len -= sizeof(chunk_t);
   39|     34|    }
   40|     24|    return out;
   41|     24|}

cpu_check_features:
   10|      1|Z_INTERNAL void cpu_check_features(struct cpu_features *features) {
   11|      1|    memset(features, 0, sizeof(struct cpu_features));
   12|      1|#if defined(X86_FEATURES)
   13|      1|    x86_check_features(&features->x86);
   14|       |#elif defined(ARM_FEATURES)
   15|       |    arm_check_features(&features->arm);
   16|       |#elif defined(PPC_FEATURES) || defined(POWER_FEATURES)
   17|       |    power_check_features(&features->power);
   18|       |#elif defined(S390_FEATURES)
   19|       |    s390_check_features(&features->s390);
   20|       |#elif defined(RISCV_FEATURES)
   21|       |    riscv_check_features(&features->riscv);
   22|       |#elif defined(LOONGARCH_FEATURES)
   23|       |    loongarch_check_features(&features->loongarch);
   24|       |#endif
   25|      1|}

functable.c:force_init_stub:
  377|      1|static int force_init_stub(void) {
  378|      1|    return init_functable();
  379|      1|}
functable.c:init_functable:
   70|      1|static int init_functable(void) {
   71|      1|    struct functable_s ft;
   72|      1|    struct cpu_features cf;
   73|       |
   74|      1|    memset(&ft, 0, sizeof(struct functable_s));
   75|      1|    cpu_check_features(&cf);
   76|      1|    ft.force_init = &force_init_empty;
   77|       |
   78|       |    // Set up generic C code fallbacks
   79|      1|#ifndef WITH_ALL_FALLBACKS
   80|      1|#  if (defined(__x86_64__) || defined(_M_X64)) && defined(X86_SSE2)
   81|       |    // x86_64 always has SSE2, so we can use SSE2 functions as fallbacks where available.
   82|      1|    ft.adler32 = &adler32_c;
   83|      1|    ft.adler32_fold_copy = &adler32_fold_copy_c;
   84|      1|    ft.crc32 = &crc32_braid;
   85|      1|    ft.crc32_fold = &crc32_fold_c;
   86|      1|    ft.crc32_fold_copy = &crc32_fold_copy_c;
   87|      1|    ft.crc32_fold_final = &crc32_fold_final_c;
   88|      1|    ft.crc32_fold_reset = &crc32_fold_reset_c;
   89|       |#    ifndef HAVE_BUILTIN_CTZ
   90|       |    ft.longest_match = &longest_match_c;
   91|       |    ft.longest_match_slow = &longest_match_slow_c;
   92|       |    ft.compare256 = &compare256_c;
   93|       |#    endif
   94|      1|#  endif
   95|       |#else // WITH_ALL_FALLBACKS
   96|       |    ft.adler32 = &adler32_c;
   97|       |    ft.adler32_fold_copy = &adler32_fold_copy_c;
   98|       |    ft.chunkmemset_safe = &chunkmemset_safe_c;
   99|       |    ft.crc32 = &crc32_braid;
  100|       |    ft.crc32_fold = &crc32_fold_c;
  101|       |    ft.crc32_fold_copy = &crc32_fold_copy_c;
  102|       |    ft.crc32_fold_final = &crc32_fold_final_c;
  103|       |    ft.crc32_fold_reset = &crc32_fold_reset_c;
  104|       |    ft.inflate_fast = &inflate_fast_c;
  105|       |    ft.slide_hash = &slide_hash_c;
  106|       |    ft.longest_match = &longest_match_c;
  107|       |    ft.longest_match_slow = &longest_match_slow_c;
  108|       |    ft.compare256 = &compare256_c;
  109|       |#endif
  110|       |
  111|       |    // Select arch-optimized functions
  112|      1|#ifdef WITH_OPTIM
  113|       |
  114|       |    // Chorba generic C fallback
  115|      1|#ifndef WITHOUT_CHORBA
  116|      1|    ft.crc32 = &crc32_chorba;
  117|      1|#endif
  118|       |
  119|       |    // X86 - SSE2
  120|      1|#ifdef X86_SSE2
  121|       |#  if !defined(__x86_64__) && !defined(_M_X64)
  122|       |    if (cf.x86.has_sse2)
  123|       |#  endif
  124|      1|    {
  125|      1|        ft.chunkmemset_safe = &chunkmemset_safe_sse2;
  126|      1|#  if !defined(WITHOUT_CHORBA_SSE)
  127|      1|        ft.crc32 = &crc32_chorba_sse2;
  128|      1|#  endif
  129|      1|        ft.inflate_fast = &inflate_fast_sse2;
  130|      1|        ft.slide_hash = &slide_hash_sse2;
  131|      1|#  ifdef HAVE_BUILTIN_CTZ
  132|      1|        ft.compare256 = &compare256_sse2;
  133|      1|        ft.longest_match = &longest_match_sse2;
  134|      1|        ft.longest_match_slow = &longest_match_slow_sse2;
  135|      1|#  endif
  136|      1|    }
  137|      1|#endif
  138|       |    // X86 - SSSE3
  139|      1|#ifdef X86_SSSE3
  140|      1|    if (cf.x86.has_ssse3) {
  ------------------
  |  Branch (140:9): [True: 1, False: 0]
  ------------------
  141|      1|        ft.adler32 = &adler32_ssse3;
  142|      1|        ft.chunkmemset_safe = &chunkmemset_safe_ssse3;
  143|      1|        ft.inflate_fast = &inflate_fast_ssse3;
  144|      1|    }
  145|      1|#endif
  146|       |
  147|       |    // X86 - SSE4.1
  148|      1|#if defined(X86_SSE41) && !defined(WITHOUT_CHORBA_SSE)
  149|      1|    if (cf.x86.has_sse41) {
  ------------------
  |  Branch (149:9): [True: 1, False: 0]
  ------------------
  150|      1|        ft.crc32 = &crc32_chorba_sse41;
  151|      1|    }
  152|      1|#endif
  153|       |
  154|       |    // X86 - SSE4.2
  155|      1|#ifdef X86_SSE42
  156|      1|    if (cf.x86.has_sse42) {
  ------------------
  |  Branch (156:9): [True: 1, False: 0]
  ------------------
  157|      1|        ft.adler32_fold_copy = &adler32_fold_copy_sse42;
  158|      1|    }
  159|      1|#endif
  160|       |    // X86 - PCLMUL
  161|      1|#ifdef X86_PCLMULQDQ_CRC
  162|      1|    if (cf.x86.has_pclmulqdq) {
  ------------------
  |  Branch (162:9): [True: 1, False: 0]
  ------------------
  163|      1|        ft.crc32 = &crc32_pclmulqdq;
  164|      1|        ft.crc32_fold = &crc32_fold_pclmulqdq;
  165|      1|        ft.crc32_fold_copy = &crc32_fold_pclmulqdq_copy;
  166|      1|        ft.crc32_fold_final = &crc32_fold_pclmulqdq_final;
  167|      1|        ft.crc32_fold_reset = &crc32_fold_pclmulqdq_reset;
  168|      1|    }
  169|      1|#endif
  170|       |    // X86 - AVX
  171|      1|#ifdef X86_AVX2
  172|       |    /* BMI2 support is all but implicit with AVX2 but let's sanity check this just in case. Enabling BMI2 allows for
  173|       |     * flagless shifts, resulting in fewer flag stalls for the pipeline, and allows us to set destination registers
  174|       |     * for the shift results as an operand, eliminating several register-register moves when the original value needs
  175|       |     * to remain intact. They also allow for a count operand that isn't the CL register, avoiding contention there */
  176|      1|    if (cf.x86.has_avx2 && cf.x86.has_bmi2) {
  ------------------
  |  Branch (176:9): [True: 1, False: 0]
  |  Branch (176:28): [True: 1, False: 0]
  ------------------
  177|      1|        ft.adler32 = &adler32_avx2;
  178|      1|        ft.adler32_fold_copy = &adler32_fold_copy_avx2;
  179|      1|        ft.chunkmemset_safe = &chunkmemset_safe_avx2;
  180|      1|        ft.inflate_fast = &inflate_fast_avx2;
  181|      1|        ft.slide_hash = &slide_hash_avx2;
  182|      1|#  ifdef HAVE_BUILTIN_CTZ
  183|      1|        ft.compare256 = &compare256_avx2;
  184|      1|        ft.longest_match = &longest_match_avx2;
  185|      1|        ft.longest_match_slow = &longest_match_slow_avx2;
  186|      1|#  endif
  187|      1|    }
  188|      1|#endif
  189|       |    // X86 - AVX512 (F,DQ,BW,Vl)
  190|      1|#ifdef X86_AVX512
  191|      1|    if (cf.x86.has_avx512_common) {
  ------------------
  |  Branch (191:9): [True: 0, False: 1]
  ------------------
  192|      0|        ft.adler32 = &adler32_avx512;
  193|      0|        ft.adler32_fold_copy = &adler32_fold_copy_avx512;
  194|      0|        ft.chunkmemset_safe = &chunkmemset_safe_avx512;
  195|      0|        ft.inflate_fast = &inflate_fast_avx512;
  196|      0|#  ifdef HAVE_BUILTIN_CTZLL
  197|      0|        ft.compare256 = &compare256_avx512;
  198|      0|        ft.longest_match = &longest_match_avx512;
  199|      0|        ft.longest_match_slow = &longest_match_slow_avx512;
  200|      0|#  endif
  201|      0|    }
  202|      1|#endif
  203|      1|#ifdef X86_AVX512VNNI
  204|      1|    if (cf.x86.has_avx512vnni) {
  ------------------
  |  Branch (204:9): [True: 0, False: 1]
  ------------------
  205|      0|        ft.adler32 = &adler32_avx512_vnni;
  206|      0|        ft.adler32_fold_copy = &adler32_fold_copy_avx512_vnni;
  207|      0|    }
  208|      1|#endif
  209|       |    // X86 - VPCLMULQDQ
  210|      1|#ifdef X86_VPCLMULQDQ_CRC
  211|      1|    if (cf.x86.has_pclmulqdq && cf.x86.has_avx512_common && cf.x86.has_vpclmulqdq) {
  ------------------
  |  Branch (211:9): [True: 1, False: 0]
  |  Branch (211:33): [True: 0, False: 1]
  |  Branch (211:61): [True: 0, False: 0]
  ------------------
  212|      0|        ft.crc32 = &crc32_vpclmulqdq;
  213|      0|        ft.crc32_fold = &crc32_fold_vpclmulqdq;
  214|      0|        ft.crc32_fold_copy = &crc32_fold_vpclmulqdq_copy;
  215|      0|        ft.crc32_fold_final = &crc32_fold_vpclmulqdq_final;
  216|      0|        ft.crc32_fold_reset = &crc32_fold_vpclmulqdq_reset;
  217|      0|    }
  218|      1|#endif
  219|       |
  220|       |
  221|       |    // ARM - SIMD
  222|       |#ifdef ARM_SIMD
  223|       |#  ifndef ARM_NOCHECK_SIMD
  224|       |    if (cf.arm.has_simd)
  225|       |#  endif
  226|       |    {
  227|       |        ft.slide_hash = &slide_hash_armv6;
  228|       |    }
  229|       |#endif
  230|       |    // ARM - NEON
  231|       |#ifdef ARM_NEON
  232|       |#  ifndef ARM_NOCHECK_NEON
  233|       |    if (cf.arm.has_neon)
  234|       |#  endif
  235|       |    {
  236|       |        ft.adler32 = &adler32_neon;
  237|       |        ft.adler32_fold_copy = &adler32_fold_copy_neon;
  238|       |        ft.chunkmemset_safe = &chunkmemset_safe_neon;
  239|       |        ft.inflate_fast = &inflate_fast_neon;
  240|       |        ft.slide_hash = &slide_hash_neon;
  241|       |#  ifdef HAVE_BUILTIN_CTZLL
  242|       |        ft.compare256 = &compare256_neon;
  243|       |        ft.longest_match = &longest_match_neon;
  244|       |        ft.longest_match_slow = &longest_match_slow_neon;
  245|       |#  endif
  246|       |    }
  247|       |#endif
  248|       |    // ARM - CRC32
  249|       |#ifdef ARM_CRC32
  250|       |    if (cf.arm.has_crc32) {
  251|       |        ft.crc32 = &crc32_armv8;
  252|       |        ft.crc32_fold = &crc32_fold_armv8;
  253|       |        ft.crc32_fold_copy = &crc32_fold_copy_armv8;
  254|       |    }
  255|       |#endif
  256|       |
  257|       |
  258|       |    // Power - VMX
  259|       |#ifdef PPC_VMX
  260|       |    if (cf.power.has_altivec) {
  261|       |        ft.adler32 = &adler32_vmx;
  262|       |        ft.slide_hash = &slide_hash_vmx;
  263|       |    }
  264|       |#endif
  265|       |    // Power8 - VSX
  266|       |#ifdef POWER8_VSX
  267|       |    if (cf.power.has_arch_2_07) {
  268|       |        ft.adler32 = &adler32_power8;
  269|       |        ft.chunkmemset_safe = &chunkmemset_safe_power8;
  270|       |        ft.inflate_fast = &inflate_fast_power8;
  271|       |        ft.slide_hash = &slide_hash_power8;
  272|       |    }
  273|       |#endif
  274|       |#ifdef POWER8_VSX_CRC32
  275|       |    if (cf.power.has_arch_2_07)
  276|       |        ft.crc32 = &crc32_power8;
  277|       |#endif
  278|       |    // Power9
  279|       |#ifdef POWER9
  280|       |    if (cf.power.has_arch_3_00) {
  281|       |        ft.compare256 = &compare256_power9;
  282|       |        ft.longest_match = &longest_match_power9;
  283|       |        ft.longest_match_slow = &longest_match_slow_power9;
  284|       |    }
  285|       |#endif
  286|       |
  287|       |
  288|       |    // RISCV - RVV
  289|       |#ifdef RISCV_RVV
  290|       |    if (cf.riscv.has_rvv) {
  291|       |        ft.adler32 = &adler32_rvv;
  292|       |        ft.adler32_fold_copy = &adler32_fold_copy_rvv;
  293|       |        ft.chunkmemset_safe = &chunkmemset_safe_rvv;
  294|       |        ft.compare256 = &compare256_rvv;
  295|       |        ft.inflate_fast = &inflate_fast_rvv;
  296|       |        ft.longest_match = &longest_match_rvv;
  297|       |        ft.longest_match_slow = &longest_match_slow_rvv;
  298|       |        ft.slide_hash = &slide_hash_rvv;
  299|       |    }
  300|       |#endif
  301|       |
  302|       |    // RISCV - ZBC
  303|       |#ifdef RISCV_CRC32_ZBC
  304|       |    if (cf.riscv.has_zbc) {
  305|       |        ft.crc32 = &crc32_riscv64_zbc;
  306|       |    }
  307|       |#endif
  308|       |
  309|       |    // S390
  310|       |#ifdef S390_CRC32_VX
  311|       |    if (cf.s390.has_vx)
  312|       |        ft.crc32 = crc32_s390_vx;
  313|       |#endif
  314|       |
  315|       |    // LOONGARCH
  316|       |#ifdef LOONGARCH_CRC
  317|       |    if (cf.loongarch.has_crc) {
  318|       |        ft.crc32 = crc32_loongarch64;
  319|       |        ft.crc32_fold = &crc32_fold_loongarch64;
  320|       |        ft.crc32_fold_copy = &crc32_fold_copy_loongarch64;
  321|       |    }
  322|       |#endif
  323|       |#ifdef LOONGARCH_LSX
  324|       |    if (cf.loongarch.has_lsx) {
  325|       |        ft.adler32 = &adler32_lsx;
  326|       |        ft.adler32_fold_copy = &adler32_fold_copy_lsx;
  327|       |        ft.slide_hash = slide_hash_lsx;
  328|       |#  ifdef HAVE_BUILTIN_CTZ
  329|       |        ft.compare256 = &compare256_lsx;
  330|       |        ft.longest_match = &longest_match_lsx;
  331|       |        ft.longest_match_slow = &longest_match_slow_lsx;
  332|       |#  endif
  333|       |        ft.chunkmemset_safe = &chunkmemset_safe_lsx;
  334|       |        ft.inflate_fast = &inflate_fast_lsx;
  335|       |    }
  336|       |#endif
  337|       |#ifdef LOONGARCH_LASX
  338|       |    if (cf.loongarch.has_lasx) {
  339|       |        ft.adler32 = &adler32_lasx;
  340|       |        ft.adler32_fold_copy = &adler32_fold_copy_lasx;
  341|       |        ft.slide_hash = slide_hash_lasx;
  342|       |#  ifdef HAVE_BUILTIN_CTZ
  343|       |        ft.compare256 = &compare256_lasx;
  344|       |        ft.longest_match = &longest_match_lasx;
  345|       |        ft.longest_match_slow = &longest_match_slow_lasx;
  346|       |#  endif
  347|       |        ft.chunkmemset_safe = &chunkmemset_safe_lasx;
  348|       |        ft.inflate_fast = &inflate_fast_lasx;
  349|       |    }
  350|       |#endif
  351|       |
  352|      1|#endif // WITH_OPTIM
  353|       |
  354|       |    // Assign function pointers individually for atomic operation
  355|      1|    FUNCTABLE_ASSIGN(ft, force_init);
  ------------------
  |  |   20|      1|    __atomic_store(&(functable.FUNC_NAME), &(VAR.FUNC_NAME), __ATOMIC_SEQ_CST)
  ------------------
  356|      1|    FUNCTABLE_VERIFY_ASSIGN(ft, adler32);
  ------------------
  |  |   46|      1|    if (!VAR.FUNC_NAME) { \
  |  |  ------------------
  |  |  |  Branch (46:9): [True: 0, False: 1]
  |  |  ------------------
  |  |   47|      0|        fprintf(stderr, "Zlib-ng functable failed initialization!\n"); \
  |  |   48|      0|        return 1; \
  |  |   49|      0|    } \
  |  |   50|      1|    FUNCTABLE_ASSIGN(VAR, FUNC_NAME);
  |  |  ------------------
  |  |  |  |   20|      1|    __atomic_store(&(functable.FUNC_NAME), &(VAR.FUNC_NAME), __ATOMIC_SEQ_CST)
  |  |  ------------------
  ------------------
  357|      1|    FUNCTABLE_VERIFY_ASSIGN(ft, adler32_fold_copy);
  ------------------
  |  |   46|      1|    if (!VAR.FUNC_NAME) { \
  |  |  ------------------
  |  |  |  Branch (46:9): [True: 0, False: 1]
  |  |  ------------------
  |  |   47|      0|        fprintf(stderr, "Zlib-ng functable failed initialization!\n"); \
  |  |   48|      0|        return 1; \
  |  |   49|      0|    } \
  |  |   50|      1|    FUNCTABLE_ASSIGN(VAR, FUNC_NAME);
  |  |  ------------------
  |  |  |  |   20|      1|    __atomic_store(&(functable.FUNC_NAME), &(VAR.FUNC_NAME), __ATOMIC_SEQ_CST)
  |  |  ------------------
  ------------------
  358|      1|    FUNCTABLE_VERIFY_ASSIGN(ft, chunkmemset_safe);
  ------------------
  |  |   46|      1|    if (!VAR.FUNC_NAME) { \
  |  |  ------------------
  |  |  |  Branch (46:9): [True: 0, False: 1]
  |  |  ------------------
  |  |   47|      0|        fprintf(stderr, "Zlib-ng functable failed initialization!\n"); \
  |  |   48|      0|        return 1; \
  |  |   49|      0|    } \
  |  |   50|      1|    FUNCTABLE_ASSIGN(VAR, FUNC_NAME);
  |  |  ------------------
  |  |  |  |   20|      1|    __atomic_store(&(functable.FUNC_NAME), &(VAR.FUNC_NAME), __ATOMIC_SEQ_CST)
  |  |  ------------------
  ------------------
  359|      1|    FUNCTABLE_VERIFY_ASSIGN(ft, compare256);
  ------------------
  |  |   46|      1|    if (!VAR.FUNC_NAME) { \
  |  |  ------------------
  |  |  |  Branch (46:9): [True: 0, False: 1]
  |  |  ------------------
  |  |   47|      0|        fprintf(stderr, "Zlib-ng functable failed initialization!\n"); \
  |  |   48|      0|        return 1; \
  |  |   49|      0|    } \
  |  |   50|      1|    FUNCTABLE_ASSIGN(VAR, FUNC_NAME);
  |  |  ------------------
  |  |  |  |   20|      1|    __atomic_store(&(functable.FUNC_NAME), &(VAR.FUNC_NAME), __ATOMIC_SEQ_CST)
  |  |  ------------------
  ------------------
  360|      1|    FUNCTABLE_VERIFY_ASSIGN(ft, crc32);
  ------------------
  |  |   46|      1|    if (!VAR.FUNC_NAME) { \
  |  |  ------------------
  |  |  |  Branch (46:9): [True: 0, False: 1]
  |  |  ------------------
  |  |   47|      0|        fprintf(stderr, "Zlib-ng functable failed initialization!\n"); \
  |  |   48|      0|        return 1; \
  |  |   49|      0|    } \
  |  |   50|      1|    FUNCTABLE_ASSIGN(VAR, FUNC_NAME);
  |  |  ------------------
  |  |  |  |   20|      1|    __atomic_store(&(functable.FUNC_NAME), &(VAR.FUNC_NAME), __ATOMIC_SEQ_CST)
  |  |  ------------------
  ------------------
  361|      1|    FUNCTABLE_VERIFY_ASSIGN(ft, crc32_fold);
  ------------------
  |  |   46|      1|    if (!VAR.FUNC_NAME) { \
  |  |  ------------------
  |  |  |  Branch (46:9): [True: 0, False: 1]
  |  |  ------------------
  |  |   47|      0|        fprintf(stderr, "Zlib-ng functable failed initialization!\n"); \
  |  |   48|      0|        return 1; \
  |  |   49|      0|    } \
  |  |   50|      1|    FUNCTABLE_ASSIGN(VAR, FUNC_NAME);
  |  |  ------------------
  |  |  |  |   20|      1|    __atomic_store(&(functable.FUNC_NAME), &(VAR.FUNC_NAME), __ATOMIC_SEQ_CST)
  |  |  ------------------
  ------------------
  362|      1|    FUNCTABLE_VERIFY_ASSIGN(ft, crc32_fold_copy);
  ------------------
  |  |   46|      1|    if (!VAR.FUNC_NAME) { \
  |  |  ------------------
  |  |  |  Branch (46:9): [True: 0, False: 1]
  |  |  ------------------
  |  |   47|      0|        fprintf(stderr, "Zlib-ng functable failed initialization!\n"); \
  |  |   48|      0|        return 1; \
  |  |   49|      0|    } \
  |  |   50|      1|    FUNCTABLE_ASSIGN(VAR, FUNC_NAME);
  |  |  ------------------
  |  |  |  |   20|      1|    __atomic_store(&(functable.FUNC_NAME), &(VAR.FUNC_NAME), __ATOMIC_SEQ_CST)
  |  |  ------------------
  ------------------
  363|      1|    FUNCTABLE_VERIFY_ASSIGN(ft, crc32_fold_final);
  ------------------
  |  |   46|      1|    if (!VAR.FUNC_NAME) { \
  |  |  ------------------
  |  |  |  Branch (46:9): [True: 0, False: 1]
  |  |  ------------------
  |  |   47|      0|        fprintf(stderr, "Zlib-ng functable failed initialization!\n"); \
  |  |   48|      0|        return 1; \
  |  |   49|      0|    } \
  |  |   50|      1|    FUNCTABLE_ASSIGN(VAR, FUNC_NAME);
  |  |  ------------------
  |  |  |  |   20|      1|    __atomic_store(&(functable.FUNC_NAME), &(VAR.FUNC_NAME), __ATOMIC_SEQ_CST)
  |  |  ------------------
  ------------------
  364|      1|    FUNCTABLE_VERIFY_ASSIGN(ft, crc32_fold_reset);
  ------------------
  |  |   46|      1|    if (!VAR.FUNC_NAME) { \
  |  |  ------------------
  |  |  |  Branch (46:9): [True: 0, False: 1]
  |  |  ------------------
  |  |   47|      0|        fprintf(stderr, "Zlib-ng functable failed initialization!\n"); \
  |  |   48|      0|        return 1; \
  |  |   49|      0|    } \
  |  |   50|      1|    FUNCTABLE_ASSIGN(VAR, FUNC_NAME);
  |  |  ------------------
  |  |  |  |   20|      1|    __atomic_store(&(functable.FUNC_NAME), &(VAR.FUNC_NAME), __ATOMIC_SEQ_CST)
  |  |  ------------------
  ------------------
  365|      1|    FUNCTABLE_VERIFY_ASSIGN(ft, inflate_fast);
  ------------------
  |  |   46|      1|    if (!VAR.FUNC_NAME) { \
  |  |  ------------------
  |  |  |  Branch (46:9): [True: 0, False: 1]
  |  |  ------------------
  |  |   47|      0|        fprintf(stderr, "Zlib-ng functable failed initialization!\n"); \
  |  |   48|      0|        return 1; \
  |  |   49|      0|    } \
  |  |   50|      1|    FUNCTABLE_ASSIGN(VAR, FUNC_NAME);
  |  |  ------------------
  |  |  |  |   20|      1|    __atomic_store(&(functable.FUNC_NAME), &(VAR.FUNC_NAME), __ATOMIC_SEQ_CST)
  |  |  ------------------
  ------------------
  366|      1|    FUNCTABLE_VERIFY_ASSIGN(ft, longest_match);
  ------------------
  |  |   46|      1|    if (!VAR.FUNC_NAME) { \
  |  |  ------------------
  |  |  |  Branch (46:9): [True: 0, False: 1]
  |  |  ------------------
  |  |   47|      0|        fprintf(stderr, "Zlib-ng functable failed initialization!\n"); \
  |  |   48|      0|        return 1; \
  |  |   49|      0|    } \
  |  |   50|      1|    FUNCTABLE_ASSIGN(VAR, FUNC_NAME);
  |  |  ------------------
  |  |  |  |   20|      1|    __atomic_store(&(functable.FUNC_NAME), &(VAR.FUNC_NAME), __ATOMIC_SEQ_CST)
  |  |  ------------------
  ------------------
  367|      1|    FUNCTABLE_VERIFY_ASSIGN(ft, longest_match_slow);
  ------------------
  |  |   46|      1|    if (!VAR.FUNC_NAME) { \
  |  |  ------------------
  |  |  |  Branch (46:9): [True: 0, False: 1]
  |  |  ------------------
  |  |   47|      0|        fprintf(stderr, "Zlib-ng functable failed initialization!\n"); \
  |  |   48|      0|        return 1; \
  |  |   49|      0|    } \
  |  |   50|      1|    FUNCTABLE_ASSIGN(VAR, FUNC_NAME);
  |  |  ------------------
  |  |  |  |   20|      1|    __atomic_store(&(functable.FUNC_NAME), &(VAR.FUNC_NAME), __ATOMIC_SEQ_CST)
  |  |  ------------------
  ------------------
  368|      1|    FUNCTABLE_VERIFY_ASSIGN(ft, slide_hash);
  ------------------
  |  |   46|      1|    if (!VAR.FUNC_NAME) { \
  |  |  ------------------
  |  |  |  Branch (46:9): [True: 0, False: 1]
  |  |  ------------------
  |  |   47|      0|        fprintf(stderr, "Zlib-ng functable failed initialization!\n"); \
  |  |   48|      0|        return 1; \
  |  |   49|      0|    } \
  |  |   50|      1|    FUNCTABLE_ASSIGN(VAR, FUNC_NAME);
  |  |  ------------------
  |  |  |  |   20|      1|    __atomic_store(&(functable.FUNC_NAME), &(VAR.FUNC_NAME), __ATOMIC_SEQ_CST)
  |  |  ------------------
  ------------------
  369|       |
  370|       |    // Memory barrier for weak memory order CPUs
  371|      1|    FUNCTABLE_BARRIER();
  ------------------
  |  |   21|      1|#  define FUNCTABLE_BARRIER() __atomic_thread_fence(__ATOMIC_SEQ_CST)
  ------------------
  372|       |
  373|      1|    return Z_OK;
  ------------------
  |  |  180|      1|#define Z_OK            0
  ------------------
  374|      1|}
functable.c:force_init_empty:
   63|    148|static int force_init_empty(void) {
   64|    148|    return 0;
   65|    148|}

zng_inflateResetKeep:
   61|    149|int32_t Z_EXPORT PREFIX(inflateResetKeep)(PREFIX3(stream) *strm) {
   62|    149|    struct inflate_state *state;
   63|       |
   64|    149|    if (inflateStateCheck(strm))
  ------------------
  |  Branch (64:9): [True: 0, False: 149]
  ------------------
   65|      0|        return Z_STREAM_ERROR;
  ------------------
  |  |  184|      0|#define Z_STREAM_ERROR (-2)
  ------------------
   66|    149|    state = (struct inflate_state *)strm->state;
   67|    149|    strm->total_in = strm->total_out = state->total = 0;
   68|    149|    strm->msg = NULL;
   69|    149|    if (state->wrap)        /* to support ill-conceived Java test suite */
  ------------------
  |  Branch (69:9): [True: 149, False: 0]
  ------------------
   70|    149|        strm->adler = state->wrap & 1;
   71|    149|    state->mode = HEAD;
   72|    149|    state->check = ADLER32_INITIAL_VALUE;
  ------------------
  |  |   65|    149|#define ADLER32_INITIAL_VALUE 1 /* initial adler-32 hash value */
  ------------------
   73|    149|    state->last = 0;
   74|    149|    state->havedict = 0;
   75|    149|    state->flags = -1;
   76|    149|    state->head = NULL;
   77|    149|    state->hold = 0;
   78|    149|    state->bits = 0;
   79|    149|    state->lencode = state->distcode = state->next = state->codes;
   80|    149|    state->back = -1;
   81|       |#ifdef INFLATE_STRICT
   82|       |    state->dmax = 32768U;
   83|       |#endif
   84|       |#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR
   85|       |    state->sane = 1;
   86|       |#endif
   87|    149|    INFLATE_RESET_KEEP_HOOK(strm);  /* hook for IBM Z DFLTCC */
  ------------------
  |  |   25|    149|#  define INFLATE_RESET_KEEP_HOOK(strm) do {} while (0)
  |  |  ------------------
  |  |  |  Branch (25:54): [Folded, False: 149]
  |  |  ------------------
  ------------------
   88|    149|    Tracev((stderr, "inflate: reset\n"));
   89|    149|    return Z_OK;
  ------------------
  |  |  180|    149|#define Z_OK            0
  ------------------
   90|    149|}
zng_inflateReset:
   92|    149|int32_t Z_EXPORT PREFIX(inflateReset)(PREFIX3(stream) *strm) {
   93|    149|    struct inflate_state *state;
   94|       |
   95|    149|    if (inflateStateCheck(strm))
  ------------------
  |  Branch (95:9): [True: 0, False: 149]
  ------------------
   96|      0|        return Z_STREAM_ERROR;
  ------------------
  |  |  184|      0|#define Z_STREAM_ERROR (-2)
  ------------------
   97|    149|    state = (struct inflate_state *)strm->state;
   98|    149|    state->wsize = 0;
   99|    149|    state->whave = 0;
  100|    149|    state->wnext = 0;
  101|    149|    return PREFIX(inflateResetKeep)(strm);
  ------------------
  |  |   97|    149|#  define PREFIX(x) zng_ ## x
  ------------------
  102|    149|}
zng_inflateReset2:
  104|    149|int32_t Z_EXPORT PREFIX(inflateReset2)(PREFIX3(stream) *strm, int32_t windowBits) {
  105|    149|    int wrap;
  106|    149|    struct inflate_state *state;
  107|       |
  108|       |    /* get the state */
  109|    149|    if (inflateStateCheck(strm))
  ------------------
  |  Branch (109:9): [True: 0, False: 149]
  ------------------
  110|      0|        return Z_STREAM_ERROR;
  ------------------
  |  |  184|      0|#define Z_STREAM_ERROR (-2)
  ------------------
  111|    149|    state = (struct inflate_state *)strm->state;
  112|       |
  113|       |    /* extract wrap request from windowBits parameter */
  114|    149|    if (windowBits < 0) {
  ------------------
  |  Branch (114:9): [True: 0, False: 149]
  ------------------
  115|      0|        wrap = 0;
  116|      0|        if (windowBits < -MAX_WBITS)
  ------------------
  |  |   39|      0|#  define MAX_WBITS   15 /* 32K LZ77 window */
  ------------------
  |  Branch (116:13): [True: 0, False: 0]
  ------------------
  117|      0|            return Z_STREAM_ERROR;
  ------------------
  |  |  184|      0|#define Z_STREAM_ERROR (-2)
  ------------------
  118|      0|        windowBits = -windowBits;
  119|    149|    } else {
  120|    149|        wrap = (windowBits >> 4) + 5;
  121|    149|#ifdef GUNZIP
  122|    149|        if (windowBits < 48)
  ------------------
  |  Branch (122:13): [True: 149, False: 0]
  ------------------
  123|    149|            windowBits &= MAX_WBITS;
  ------------------
  |  |   39|    149|#  define MAX_WBITS   15 /* 32K LZ77 window */
  ------------------
  124|    149|#endif
  125|    149|    }
  126|       |
  127|       |    /* set number of window bits */
  128|    149|    if (windowBits && (windowBits < MIN_WBITS || windowBits > MAX_WBITS))
  ------------------
  |  |   36|    298|#  define MIN_WBITS   8  /* 256 LZ77 window */
  ------------------
                  if (windowBits && (windowBits < MIN_WBITS || windowBits > MAX_WBITS))
  ------------------
  |  |   39|    149|#  define MAX_WBITS   15 /* 32K LZ77 window */
  ------------------
  |  Branch (128:9): [True: 149, False: 0]
  |  Branch (128:24): [True: 0, False: 149]
  |  Branch (128:50): [True: 0, False: 149]
  ------------------
  129|      0|        return Z_STREAM_ERROR;
  ------------------
  |  |  184|      0|#define Z_STREAM_ERROR (-2)
  ------------------
  130|       |
  131|       |    /* update state and reset the rest of it */
  132|    149|    state->wrap = wrap;
  133|    149|    state->wbits = (unsigned)windowBits;
  134|    149|    return PREFIX(inflateReset)(strm);
  ------------------
  |  |   97|    149|#  define PREFIX(x) zng_ ## x
  ------------------
  135|    149|}
alloc_inflate:
  152|    149|Z_INTERNAL inflate_allocs* alloc_inflate(PREFIX3(stream) *strm) {
  153|    149|    int curr_size = 0;
  154|       |
  155|       |    /* Define sizes */
  156|    149|    int window_size = INFLATE_ADJUST_WINDOW_SIZE((1 << MAX_WBITS) + 64); /* 64B padding for chunksize */
  ------------------
  |  |   23|    149|#  define INFLATE_ADJUST_WINDOW_SIZE(n) (n)
  ------------------
  157|    149|    int state_size = sizeof(inflate_state);
  158|    149|    int alloc_size = sizeof(inflate_allocs);
  159|       |
  160|       |    /* Calculate relative buffer positions and paddings */
  161|    149|    LOGSZP("window", window_size, PAD_WINDOW(curr_size), PADSZ(curr_size,WINDOW_PAD_SIZE));
  162|    149|    int window_pos = PAD_WINDOW(curr_size);
  ------------------
  |  |  465|    149|#  define PAD_WINDOW            PAD_64
  |  |  ------------------
  |  |  |  |  245|    149|#define PAD_64(bpos) ((bpos) + PADSZ((bpos),64))
  |  |  |  |  ------------------
  |  |  |  |  |  |  243|    149|#define PADSZ(bpos, pad) (((pad) - ((uintptr_t)(bpos) % (pad))) % (pad))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  163|    149|    curr_size = window_pos + window_size;
  164|       |
  165|    149|    LOGSZP("state", state_size, PAD_64(curr_size), PADSZ(curr_size,64));
  166|    149|    int state_pos = PAD_64(curr_size);
  ------------------
  |  |  245|    149|#define PAD_64(bpos) ((bpos) + PADSZ((bpos),64))
  |  |  ------------------
  |  |  |  |  243|    149|#define PADSZ(bpos, pad) (((pad) - ((uintptr_t)(bpos) % (pad))) % (pad))
  |  |  ------------------
  ------------------
  167|    149|    curr_size = state_pos + state_size;
  168|       |
  169|    149|    LOGSZP("alloc", alloc_size, PAD_16(curr_size), PADSZ(curr_size,16));
  170|    149|    int alloc_pos = PAD_16(curr_size);
  ------------------
  |  |  244|    149|#define PAD_16(bpos) ((bpos) + PADSZ((bpos),16))
  |  |  ------------------
  |  |  |  |  243|    149|#define PADSZ(bpos, pad) (((pad) - ((uintptr_t)(bpos) % (pad))) % (pad))
  |  |  ------------------
  ------------------
  171|    149|    curr_size = alloc_pos + alloc_size;
  172|       |
  173|       |    /* Add 64-1 or 4096-1 to allow window alignment, and round size of buffer up to multiple of 64 */
  174|    149|    int total_size = PAD_64(curr_size + (WINDOW_PAD_SIZE - 1));
  ------------------
  |  |  245|    149|#define PAD_64(bpos) ((bpos) + PADSZ((bpos),64))
  |  |  ------------------
  |  |  |  |  243|    149|#define PADSZ(bpos, pad) (((pad) - ((uintptr_t)(bpos) % (pad))) % (pad))
  |  |  ------------------
  ------------------
  175|       |
  176|       |    /* Allocate buffer, align to 64-byte cacheline, and zerofill the resulting buffer */
  177|    149|    char *original_buf = (char *)strm->zalloc(strm->opaque, 1, total_size);
  178|    149|    if (original_buf == NULL)
  ------------------
  |  Branch (178:9): [True: 0, False: 149]
  ------------------
  179|      0|        return NULL;
  180|       |
  181|    149|    char *buff = (char *)HINT_ALIGNED_WINDOW((char *)PAD_WINDOW(original_buf));
  ------------------
  |  |  467|    149|#  define HINT_ALIGNED_WINDOW   HINT_ALIGNED_64
  |  |  ------------------
  |  |  |  |  236|    149|#define HINT_ALIGNED_64(p) HINT_ALIGNED((p),64)
  |  |  |  |  ------------------
  |  |  |  |  |  |  231|    149|#  define HINT_ALIGNED(p,n) __builtin_assume_aligned((void *)(p),(n))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  182|    149|    LOGSZPL("Buffer alloc", total_size, PADSZ((uintptr_t)original_buf,WINDOW_PAD_SIZE), PADSZ(curr_size,WINDOW_PAD_SIZE));
  183|       |
  184|       |    /* Initialize alloc_bufs */
  185|    149|    inflate_allocs *alloc_bufs  = (struct inflate_allocs_s *)(buff + alloc_pos);
  186|    149|    alloc_bufs->buf_start = original_buf;
  187|    149|    alloc_bufs->zfree = strm->zfree;
  188|       |
  189|    149|    alloc_bufs->window =  (unsigned char *)HINT_ALIGNED_WINDOW((buff + window_pos));
  ------------------
  |  |  467|    149|#  define HINT_ALIGNED_WINDOW   HINT_ALIGNED_64
  |  |  ------------------
  |  |  |  |  236|    149|#define HINT_ALIGNED_64(p) HINT_ALIGNED((p),64)
  |  |  |  |  ------------------
  |  |  |  |  |  |  231|    149|#  define HINT_ALIGNED(p,n) __builtin_assume_aligned((void *)(p),(n))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  190|    149|    alloc_bufs->state = (inflate_state *)HINT_ALIGNED_64((buff + state_pos));
  ------------------
  |  |  236|    149|#define HINT_ALIGNED_64(p) HINT_ALIGNED((p),64)
  |  |  ------------------
  |  |  |  |  231|    149|#  define HINT_ALIGNED(p,n) __builtin_assume_aligned((void *)(p),(n))
  |  |  ------------------
  ------------------
  191|       |
  192|       |#ifdef Z_MEMORY_SANITIZER
  193|       |    /* This is _not_ to subvert the memory sanitizer but to instead unposion some
  194|       |       data we willingly and purposefully load uninitialized into vector registers
  195|       |       in order to safely read the last < chunksize bytes of the window. */
  196|       |    __msan_unpoison(alloc_bufs->window + window_size, 64);
  197|       |#endif
  198|       |
  199|    149|    return alloc_bufs;
  200|    149|}
free_inflate:
  205|    149|Z_INTERNAL void free_inflate(PREFIX3(stream) *strm) {
  206|    149|    struct inflate_state *state = (struct inflate_state *)strm->state;
  207|       |
  208|    149|    if (state->alloc_bufs != NULL) {
  ------------------
  |  Branch (208:9): [True: 149, False: 0]
  ------------------
  209|    149|        inflate_allocs *alloc_bufs = state->alloc_bufs;
  210|    149|        alloc_bufs->zfree(strm->opaque, alloc_bufs->buf_start);
  211|       |        strm->state = NULL;
  212|    149|    }
  213|    149|}
zng_inflateInit2:
  219|    149|int32_t ZNG_CONDEXPORT PREFIX(inflateInit2)(PREFIX3(stream) *strm, int32_t windowBits) {
  220|    149|    struct inflate_state *state;
  221|    149|    int32_t ret;
  222|       |
  223|       |    /* Initialize functable */
  224|    149|    FUNCTABLE_INIT;
  ------------------
  |  |   48|    149|#  define FUNCTABLE_INIT if (functable.force_init()) {return Z_VERSION_ERROR;}
  |  |  ------------------
  |  |  |  |  188|      0|#define Z_VERSION_ERROR (-6)
  |  |  ------------------
  |  |  |  Branch (48:30): [True: 0, False: 149]
  |  |  ------------------
  ------------------
  225|       |
  226|    149|    if (strm == NULL)
  ------------------
  |  Branch (226:9): [True: 0, False: 149]
  ------------------
  227|      0|        return Z_STREAM_ERROR;
  ------------------
  |  |  184|      0|#define Z_STREAM_ERROR (-2)
  ------------------
  228|    149|    strm->msg = NULL;                   /* in case we return an error */
  229|    149|    if (strm->zalloc == NULL) {
  ------------------
  |  Branch (229:9): [True: 149, False: 0]
  ------------------
  230|    149|        strm->zalloc = PREFIX(zcalloc);
  ------------------
  |  |   97|    149|#  define PREFIX(x) zng_ ## x
  ------------------
  231|    149|        strm->opaque = NULL;
  232|    149|    }
  233|    149|    if (strm->zfree == NULL)
  ------------------
  |  Branch (233:9): [True: 149, False: 0]
  ------------------
  234|    149|        strm->zfree = PREFIX(zcfree);
  ------------------
  |  |   97|    149|#  define PREFIX(x) zng_ ## x
  ------------------
  235|       |
  236|    149|    inflate_allocs *alloc_bufs = alloc_inflate(strm);
  237|    149|    if (alloc_bufs == NULL)
  ------------------
  |  Branch (237:9): [True: 0, False: 149]
  ------------------
  238|      0|        return Z_MEM_ERROR;
  ------------------
  |  |  186|      0|#define Z_MEM_ERROR    (-4)
  ------------------
  239|       |
  240|    149|    state = alloc_bufs->state;
  241|    149|    state->window = alloc_bufs->window;
  242|    149|    state->alloc_bufs = alloc_bufs;
  243|    149|    state->wbufsize = INFLATE_ADJUST_WINDOW_SIZE((1 << MAX_WBITS) + 64);
  ------------------
  |  |   23|    149|#  define INFLATE_ADJUST_WINDOW_SIZE(n) (n)
  ------------------
  244|    149|    Tracev((stderr, "inflate: allocated\n"));
  245|       |
  246|    149|    strm->state = (struct internal_state *)state;
  247|    149|    state->strm = strm;
  248|    149|    state->mode = HEAD;     /* to pass state test in inflateReset2() */
  249|    149|    ret = PREFIX(inflateReset2)(strm, windowBits);
  ------------------
  |  |   97|    149|#  define PREFIX(x) zng_ ## x
  ------------------
  250|    149|    if (ret != Z_OK) {
  ------------------
  |  |  180|    149|#define Z_OK            0
  ------------------
  |  Branch (250:9): [True: 0, False: 149]
  ------------------
  251|      0|        free_inflate(strm);
  252|      0|    }
  253|    149|    return ret;
  254|    149|}
zng_inflateInit:
  257|    149|int32_t Z_EXPORT PREFIX(inflateInit)(PREFIX3(stream) *strm) {
  258|    149|    return PREFIX(inflateInit2)(strm, DEF_WBITS);
  ------------------
  |  |   97|    149|#  define PREFIX(x) zng_ ## x
  ------------------
                  return PREFIX(inflateInit2)(strm, DEF_WBITS);
  ------------------
  |  |   35|    149|#  define DEF_WBITS MAX_WBITS
  |  |  ------------------
  |  |  |  |   39|    149|#  define MAX_WBITS   15 /* 32K LZ77 window */
  |  |  ------------------
  ------------------
  259|    149|}
zng_fixedtables:
  303|     90|void Z_INTERNAL PREFIX(fixedtables)(struct inflate_state *state) {
  304|     90|    state->lencode = lenfix;
  305|     90|    state->lenbits = 9;
  306|     90|    state->distcode = distfix;
  307|     90|    state->distbits = 5;
  308|     90|}
zng_inflate:
  475|    230|int32_t Z_EXPORT PREFIX(inflate)(PREFIX3(stream) *strm, int32_t flush) {
  476|    230|    struct inflate_state *state;
  477|    230|    const unsigned char *next;  /* next input */
  478|    230|    unsigned char *put;         /* next output */
  479|    230|    unsigned char *from;        /* where to copy match bytes from */
  480|    230|    unsigned have, left;        /* available input and output */
  481|    230|    uint64_t hold;              /* bit buffer */
  482|    230|    unsigned bits;              /* bits in bit buffer */
  483|    230|    uint32_t in, out;           /* save starting available input and output */
  484|    230|    unsigned copy;              /* number of stored or match bytes to copy */
  485|    230|    code here;                  /* current decoding table entry */
  486|    230|    code last;                  /* parent table entry */
  487|    230|    unsigned len;               /* length to copy for repeats, bits to drop */
  488|    230|    int32_t ret;                /* return code */
  489|    230|#ifdef GUNZIP
  490|    230|    unsigned char hbuf[4];      /* buffer for gzip header crc calculation */
  491|    230|#endif
  492|    230|    static const uint16_t order[19] = /* permutation of code lengths */
  493|    230|        {16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15};
  494|       |
  495|    230|    if (inflateStateCheck(strm) || strm->next_out == NULL ||
  ------------------
  |  Branch (495:9): [True: 0, False: 230]
  |  Branch (495:36): [True: 0, False: 230]
  ------------------
  496|    230|        (strm->next_in == NULL && strm->avail_in != 0))
  ------------------
  |  Branch (496:10): [True: 0, False: 230]
  |  Branch (496:35): [True: 0, False: 0]
  ------------------
  497|      0|        return Z_STREAM_ERROR;
  ------------------
  |  |  184|      0|#define Z_STREAM_ERROR (-2)
  ------------------
  498|       |
  499|    230|    state = (struct inflate_state *)strm->state;
  500|    230|    if (state->mode == TYPE)      /* skip check */
  ------------------
  |  Branch (500:9): [True: 0, False: 230]
  ------------------
  501|      0|        state->mode = TYPEDO;
  502|    230|    LOAD();
  ------------------
  |  |   77|    230|    do { \
  |  |   78|    230|        put = strm->next_out; \
  |  |   79|    230|        left = strm->avail_out; \
  |  |   80|    230|        next = strm->next_in; \
  |  |   81|    230|        have = strm->avail_in; \
  |  |   82|    230|        hold = state->hold; \
  |  |   83|    230|        bits = state->bits; \
  |  |   84|    230|    } while (0)
  |  |  ------------------
  |  |  |  Branch (84:14): [Folded, False: 230]
  |  |  ------------------
  ------------------
  503|    230|    in = have;
  504|    230|    out = left;
  505|    230|    ret = Z_OK;
  ------------------
  |  |  180|    230|#define Z_OK            0
  ------------------
  506|    230|    for (;;)
  507|  1.52k|        switch (state->mode) {
  508|    150|        case HEAD:
  ------------------
  |  Branch (508:9): [True: 150, False: 1.37k]
  ------------------
  509|    150|            if (state->wrap == 0) {
  ------------------
  |  Branch (509:17): [True: 0, False: 150]
  ------------------
  510|      0|                state->mode = TYPEDO;
  511|      0|                break;
  512|      0|            }
  513|    150|            NEEDBITS(16);
  ------------------
  |  |  107|    150|    do { \
  |  |  108|    447|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (108:16): [True: 299, False: 148]
  |  |  ------------------
  |  |  109|    299|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  386|    299|    do { \
  |  |  |  |  387|    299|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (387:13): [True: 2, False: 297]
  |  |  |  |  ------------------
  |  |  |  |  388|    299|        have--; \
  |  |  |  |  389|    297|        hold += ((uint64_t)(*next++) << bits); \
  |  |  |  |  390|    297|        bits += 8; \
  |  |  |  |  391|    297|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (391:14): [Folded, False: 297]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  110|    150|    } while (0)
  |  |  ------------------
  |  |  |  Branch (110:14): [Folded, False: 148]
  |  |  ------------------
  ------------------
  514|    148|#ifdef GUNZIP
  515|    148|            if ((state->wrap & 2) && hold == 0x8b1f) {  /* gzip header */
  ------------------
  |  Branch (515:17): [True: 0, False: 148]
  |  Branch (515:38): [True: 0, False: 0]
  ------------------
  516|      0|                if (state->wbits == 0)
  ------------------
  |  Branch (516:21): [True: 0, False: 0]
  ------------------
  517|      0|                    state->wbits = MAX_WBITS;
  ------------------
  |  |   39|      0|#  define MAX_WBITS   15 /* 32K LZ77 window */
  ------------------
  518|      0|                state->check = CRC32_INITIAL_VALUE;
  ------------------
  |  |   66|      0|#define CRC32_INITIAL_VALUE   0 /* initial crc-32 hash value */
  ------------------
  519|      0|                CRC2(state->check, hold);
  ------------------
  |  |   59|      0|    do { \
  |  |   60|      0|        hbuf[0] = (unsigned char)(word); \
  |  |   61|      0|        hbuf[1] = (unsigned char)((word) >> 8); \
  |  |   62|      0|        check = PREFIX(crc32)(check, hbuf, 2); \
  |  |  ------------------
  |  |  |  |   97|      0|#  define PREFIX(x) zng_ ## x
  |  |  ------------------
  |  |   63|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (63:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  520|      0|                INITBITS();
  ------------------
  |  |   99|      0|    do { \
  |  |  100|      0|        hold = 0; \
  |  |  101|      0|        bits = 0; \
  |  |  102|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (102:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  521|      0|                state->mode = FLAGS;
  522|      0|                break;
  523|      0|            }
  524|    148|            if (state->head != NULL)
  ------------------
  |  Branch (524:17): [True: 0, False: 148]
  ------------------
  525|      0|                state->head->done = -1;
  526|    148|            if (!(state->wrap & 1) ||   /* check if zlib header allowed */
  ------------------
  |  Branch (526:17): [True: 0, False: 148]
  ------------------
  527|       |#else
  528|       |            if (
  529|       |#endif
  530|    148|                ((BITS(8) << 8) + (hold >> 8)) % 31) {
  ------------------
  |  |  114|    148|    (hold & ((1U << (unsigned)(n)) - 1))
  ------------------
  |  Branch (530:17): [True: 1, False: 147]
  ------------------
  531|      1|                SET_BAD("incorrect header check");
  ------------------
  |  |  132|      1|    do { \
  |  |  133|      1|        state->mode = BAD; \
  |  |  134|      1|        strm->msg = (char *)errmsg; \
  |  |  135|      1|    } while (0)
  |  |  ------------------
  |  |  |  Branch (135:14): [Folded, False: 1]
  |  |  ------------------
  ------------------
  532|      1|                break;
  533|      1|            }
  534|    147|            if (BITS(4) != Z_DEFLATED) {
  ------------------
  |  |  114|    147|    (hold & ((1U << (unsigned)(n)) - 1))
  ------------------
                          if (BITS(4) != Z_DEFLATED) {
  ------------------
  |  |  212|    147|#define Z_DEFLATED   8
  ------------------
  |  Branch (534:17): [True: 0, False: 147]
  ------------------
  535|      0|                SET_BAD("unknown compression method");
  ------------------
  |  |  132|      0|    do { \
  |  |  133|      0|        state->mode = BAD; \
  |  |  134|      0|        strm->msg = (char *)errmsg; \
  |  |  135|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (135:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  536|      0|                break;
  537|      0|            }
  538|    147|            DROPBITS(4);
  ------------------
  |  |  118|    147|    do { \
  |  |  119|    147|        hold >>= (n); \
  |  |  120|    147|        bits -= (unsigned)(n); \
  |  |  121|    147|    } while (0)
  |  |  ------------------
  |  |  |  Branch (121:14): [Folded, False: 147]
  |  |  ------------------
  ------------------
  539|    147|            len = BITS(4) + 8;
  ------------------
  |  |  114|    147|    (hold & ((1U << (unsigned)(n)) - 1))
  ------------------
  540|    147|            if (state->wbits == 0)
  ------------------
  |  Branch (540:17): [True: 0, False: 147]
  ------------------
  541|      0|                state->wbits = len;
  542|    147|            if (len > MAX_WBITS || len > state->wbits) {
  ------------------
  |  |   39|    294|#  define MAX_WBITS   15 /* 32K LZ77 window */
  ------------------
  |  Branch (542:17): [True: 1, False: 146]
  |  Branch (542:36): [True: 0, False: 146]
  ------------------
  543|      1|                SET_BAD("invalid window size");
  ------------------
  |  |  132|      1|    do { \
  |  |  133|      1|        state->mode = BAD; \
  |  |  134|      1|        strm->msg = (char *)errmsg; \
  |  |  135|      1|    } while (0)
  |  |  ------------------
  |  |  |  Branch (135:14): [Folded, False: 1]
  |  |  ------------------
  ------------------
  544|      1|                break;
  545|      1|            }
  546|       |#ifdef INFLATE_STRICT
  547|       |            state->dmax = 1U << len;
  548|       |#endif
  549|    146|            state->flags = 0;               /* indicate zlib header */
  550|    146|            Tracev((stderr, "inflate:   zlib header ok\n"));
  551|    146|            strm->adler = state->check = ADLER32_INITIAL_VALUE;
  ------------------
  |  |   65|    146|#define ADLER32_INITIAL_VALUE 1 /* initial adler-32 hash value */
  ------------------
  552|    146|            state->mode = hold & 0x200 ? DICTID : TYPE;
  ------------------
  |  Branch (552:27): [True: 4, False: 142]
  ------------------
  553|    146|            INITBITS();
  ------------------
  |  |   99|    146|    do { \
  |  |  100|    146|        hold = 0; \
  |  |  101|    146|        bits = 0; \
  |  |  102|    146|    } while (0)
  |  |  ------------------
  |  |  |  Branch (102:14): [Folded, False: 146]
  |  |  ------------------
  ------------------
  554|    146|            break;
  555|      0|#ifdef GUNZIP
  556|       |
  557|      0|        case FLAGS:
  ------------------
  |  Branch (557:9): [True: 0, False: 1.52k]
  ------------------
  558|      0|            NEEDBITS(16);
  ------------------
  |  |  107|      0|    do { \
  |  |  108|      0|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (108:16): [True: 0, False: 0]
  |  |  ------------------
  |  |  109|      0|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  386|      0|    do { \
  |  |  |  |  387|      0|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (387:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  388|      0|        have--; \
  |  |  |  |  389|      0|        hold += ((uint64_t)(*next++) << bits); \
  |  |  |  |  390|      0|        bits += 8; \
  |  |  |  |  391|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (391:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  110|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (110:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  559|      0|            state->flags = (int)(hold);
  560|      0|            if ((state->flags & 0xff) != Z_DEFLATED) {
  ------------------
  |  |  212|      0|#define Z_DEFLATED   8
  ------------------
  |  Branch (560:17): [True: 0, False: 0]
  ------------------
  561|      0|                SET_BAD("unknown compression method");
  ------------------
  |  |  132|      0|    do { \
  |  |  133|      0|        state->mode = BAD; \
  |  |  134|      0|        strm->msg = (char *)errmsg; \
  |  |  135|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (135:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  562|      0|                break;
  563|      0|            }
  564|      0|            if (state->flags & 0xe000) {
  ------------------
  |  Branch (564:17): [True: 0, False: 0]
  ------------------
  565|      0|                SET_BAD("unknown header flags set");
  ------------------
  |  |  132|      0|    do { \
  |  |  133|      0|        state->mode = BAD; \
  |  |  134|      0|        strm->msg = (char *)errmsg; \
  |  |  135|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (135:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  566|      0|                break;
  567|      0|            }
  568|      0|            if (state->head != NULL)
  ------------------
  |  Branch (568:17): [True: 0, False: 0]
  ------------------
  569|      0|                state->head->text = (int)((hold >> 8) & 1);
  570|      0|            if ((state->flags & 0x0200) && (state->wrap & 4))
  ------------------
  |  Branch (570:17): [True: 0, False: 0]
  |  Branch (570:44): [True: 0, False: 0]
  ------------------
  571|      0|                CRC2(state->check, hold);
  ------------------
  |  |   59|      0|    do { \
  |  |   60|      0|        hbuf[0] = (unsigned char)(word); \
  |  |   61|      0|        hbuf[1] = (unsigned char)((word) >> 8); \
  |  |   62|      0|        check = PREFIX(crc32)(check, hbuf, 2); \
  |  |  ------------------
  |  |  |  |   97|      0|#  define PREFIX(x) zng_ ## x
  |  |  ------------------
  |  |   63|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (63:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  572|      0|            INITBITS();
  ------------------
  |  |   99|      0|    do { \
  |  |  100|      0|        hold = 0; \
  |  |  101|      0|        bits = 0; \
  |  |  102|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (102:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  573|      0|            state->mode = TIME;
  574|      0|            Z_FALLTHROUGH;
  ------------------
  |  |   45|      0|#    define Z_FALLTHROUGH __attribute__((__fallthrough__))
  ------------------
  575|       |
  576|      0|        case TIME:
  ------------------
  |  Branch (576:9): [True: 0, False: 1.52k]
  ------------------
  577|      0|            NEEDBITS(32);
  ------------------
  |  |  107|      0|    do { \
  |  |  108|      0|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (108:16): [True: 0, False: 0]
  |  |  ------------------
  |  |  109|      0|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  386|      0|    do { \
  |  |  |  |  387|      0|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (387:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  388|      0|        have--; \
  |  |  |  |  389|      0|        hold += ((uint64_t)(*next++) << bits); \
  |  |  |  |  390|      0|        bits += 8; \
  |  |  |  |  391|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (391:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  110|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (110:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  578|      0|            if (state->head != NULL)
  ------------------
  |  Branch (578:17): [True: 0, False: 0]
  ------------------
  579|      0|                state->head->time = (unsigned)(hold);
  580|      0|            if ((state->flags & 0x0200) && (state->wrap & 4))
  ------------------
  |  Branch (580:17): [True: 0, False: 0]
  |  Branch (580:44): [True: 0, False: 0]
  ------------------
  581|      0|                CRC4(state->check, hold);
  ------------------
  |  |   66|      0|    do { \
  |  |   67|      0|        hbuf[0] = (unsigned char)(word); \
  |  |   68|      0|        hbuf[1] = (unsigned char)((word) >> 8); \
  |  |   69|      0|        hbuf[2] = (unsigned char)((word) >> 16); \
  |  |   70|      0|        hbuf[3] = (unsigned char)((word) >> 24); \
  |  |   71|      0|        check = PREFIX(crc32)(check, hbuf, 4); \
  |  |  ------------------
  |  |  |  |   97|      0|#  define PREFIX(x) zng_ ## x
  |  |  ------------------
  |  |   72|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (72:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  582|      0|            INITBITS();
  ------------------
  |  |   99|      0|    do { \
  |  |  100|      0|        hold = 0; \
  |  |  101|      0|        bits = 0; \
  |  |  102|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (102:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  583|      0|            state->mode = OS;
  584|      0|            Z_FALLTHROUGH;
  ------------------
  |  |   45|      0|#    define Z_FALLTHROUGH __attribute__((__fallthrough__))
  ------------------
  585|       |
  586|      0|        case OS:
  ------------------
  |  Branch (586:9): [True: 0, False: 1.52k]
  ------------------
  587|      0|            NEEDBITS(16);
  ------------------
  |  |  107|      0|    do { \
  |  |  108|      0|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (108:16): [True: 0, False: 0]
  |  |  ------------------
  |  |  109|      0|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  386|      0|    do { \
  |  |  |  |  387|      0|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (387:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  388|      0|        have--; \
  |  |  |  |  389|      0|        hold += ((uint64_t)(*next++) << bits); \
  |  |  |  |  390|      0|        bits += 8; \
  |  |  |  |  391|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (391:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  110|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (110:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  588|      0|            if (state->head != NULL) {
  ------------------
  |  Branch (588:17): [True: 0, False: 0]
  ------------------
  589|      0|                state->head->xflags = (int)(hold & 0xff);
  590|      0|                state->head->os = (int)(hold >> 8);
  591|      0|            }
  592|      0|            if ((state->flags & 0x0200) && (state->wrap & 4))
  ------------------
  |  Branch (592:17): [True: 0, False: 0]
  |  Branch (592:44): [True: 0, False: 0]
  ------------------
  593|      0|                CRC2(state->check, hold);
  ------------------
  |  |   59|      0|    do { \
  |  |   60|      0|        hbuf[0] = (unsigned char)(word); \
  |  |   61|      0|        hbuf[1] = (unsigned char)((word) >> 8); \
  |  |   62|      0|        check = PREFIX(crc32)(check, hbuf, 2); \
  |  |  ------------------
  |  |  |  |   97|      0|#  define PREFIX(x) zng_ ## x
  |  |  ------------------
  |  |   63|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (63:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  594|      0|            INITBITS();
  ------------------
  |  |   99|      0|    do { \
  |  |  100|      0|        hold = 0; \
  |  |  101|      0|        bits = 0; \
  |  |  102|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (102:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  595|      0|            state->mode = EXLEN;
  596|      0|            Z_FALLTHROUGH;
  ------------------
  |  |   45|      0|#    define Z_FALLTHROUGH __attribute__((__fallthrough__))
  ------------------
  597|       |
  598|      0|        case EXLEN:
  ------------------
  |  Branch (598:9): [True: 0, False: 1.52k]
  ------------------
  599|      0|            if (state->flags & 0x0400) {
  ------------------
  |  Branch (599:17): [True: 0, False: 0]
  ------------------
  600|      0|                NEEDBITS(16);
  ------------------
  |  |  107|      0|    do { \
  |  |  108|      0|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (108:16): [True: 0, False: 0]
  |  |  ------------------
  |  |  109|      0|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  386|      0|    do { \
  |  |  |  |  387|      0|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (387:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  388|      0|        have--; \
  |  |  |  |  389|      0|        hold += ((uint64_t)(*next++) << bits); \
  |  |  |  |  390|      0|        bits += 8; \
  |  |  |  |  391|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (391:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  110|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (110:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  601|      0|                state->length = (uint16_t)hold;
  602|      0|                if (state->head != NULL)
  ------------------
  |  Branch (602:21): [True: 0, False: 0]
  ------------------
  603|      0|                    state->head->extra_len = (uint16_t)hold;
  604|      0|                if ((state->flags & 0x0200) && (state->wrap & 4))
  ------------------
  |  Branch (604:21): [True: 0, False: 0]
  |  Branch (604:48): [True: 0, False: 0]
  ------------------
  605|      0|                    CRC2(state->check, hold);
  ------------------
  |  |   59|      0|    do { \
  |  |   60|      0|        hbuf[0] = (unsigned char)(word); \
  |  |   61|      0|        hbuf[1] = (unsigned char)((word) >> 8); \
  |  |   62|      0|        check = PREFIX(crc32)(check, hbuf, 2); \
  |  |  ------------------
  |  |  |  |   97|      0|#  define PREFIX(x) zng_ ## x
  |  |  ------------------
  |  |   63|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (63:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  606|      0|                INITBITS();
  ------------------
  |  |   99|      0|    do { \
  |  |  100|      0|        hold = 0; \
  |  |  101|      0|        bits = 0; \
  |  |  102|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (102:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  607|      0|            } else if (state->head != NULL) {
  ------------------
  |  Branch (607:24): [True: 0, False: 0]
  ------------------
  608|      0|                state->head->extra = NULL;
  609|      0|            }
  610|      0|            state->mode = EXTRA;
  611|      0|            Z_FALLTHROUGH;
  ------------------
  |  |   45|      0|#    define Z_FALLTHROUGH __attribute__((__fallthrough__))
  ------------------
  612|       |
  613|      0|        case EXTRA:
  ------------------
  |  Branch (613:9): [True: 0, False: 1.52k]
  ------------------
  614|      0|            if (state->flags & 0x0400) {
  ------------------
  |  Branch (614:17): [True: 0, False: 0]
  ------------------
  615|      0|                copy = state->length;
  616|      0|                if (copy > have)
  ------------------
  |  Branch (616:21): [True: 0, False: 0]
  ------------------
  617|      0|                    copy = have;
  618|      0|                if (copy) {
  ------------------
  |  Branch (618:21): [True: 0, False: 0]
  ------------------
  619|      0|                    if (state->head != NULL && state->head->extra != NULL) {
  ------------------
  |  Branch (619:25): [True: 0, False: 0]
  |  Branch (619:48): [True: 0, False: 0]
  ------------------
  620|      0|                        len = state->head->extra_len - state->length;
  621|      0|                        if (len < state->head->extra_max) {
  ------------------
  |  Branch (621:29): [True: 0, False: 0]
  ------------------
  622|      0|                            memcpy(state->head->extra + len, next,
  623|      0|                                    len + copy > state->head->extra_max ?
  ------------------
  |  Branch (623:37): [True: 0, False: 0]
  ------------------
  624|      0|                                    state->head->extra_max - len : copy);
  625|      0|                        }
  626|      0|                    }
  627|      0|                    if ((state->flags & 0x0200) && (state->wrap & 4)) {
  ------------------
  |  Branch (627:25): [True: 0, False: 0]
  |  Branch (627:52): [True: 0, False: 0]
  ------------------
  628|      0|                        state->check = PREFIX(crc32)(state->check, next, copy);
  ------------------
  |  |   97|      0|#  define PREFIX(x) zng_ ## x
  ------------------
  629|      0|                    }
  630|      0|                    have -= copy;
  631|      0|                    next += copy;
  632|      0|                    state->length -= copy;
  633|      0|                }
  634|      0|                if (state->length)
  ------------------
  |  Branch (634:21): [True: 0, False: 0]
  ------------------
  635|      0|                    goto inf_leave;
  636|      0|            }
  637|      0|            state->length = 0;
  638|      0|            state->mode = NAME;
  639|      0|            Z_FALLTHROUGH;
  ------------------
  |  |   45|      0|#    define Z_FALLTHROUGH __attribute__((__fallthrough__))
  ------------------
  640|       |
  641|      0|        case NAME:
  ------------------
  |  Branch (641:9): [True: 0, False: 1.52k]
  ------------------
  642|      0|            if (state->flags & 0x0800) {
  ------------------
  |  Branch (642:17): [True: 0, False: 0]
  ------------------
  643|      0|                if (have == 0) goto inf_leave;
  ------------------
  |  Branch (643:21): [True: 0, False: 0]
  ------------------
  644|      0|                copy = 0;
  645|      0|                do {
  646|      0|                    len = (unsigned)(next[copy++]);
  647|      0|                    if (state->head != NULL && state->head->name != NULL && state->length < state->head->name_max)
  ------------------
  |  Branch (647:25): [True: 0, False: 0]
  |  Branch (647:48): [True: 0, False: 0]
  |  Branch (647:77): [True: 0, False: 0]
  ------------------
  648|      0|                        state->head->name[state->length++] = (unsigned char)len;
  649|      0|                } while (len && copy < have);
  ------------------
  |  Branch (649:26): [True: 0, False: 0]
  |  Branch (649:33): [True: 0, False: 0]
  ------------------
  650|      0|                if ((state->flags & 0x0200) && (state->wrap & 4))
  ------------------
  |  Branch (650:21): [True: 0, False: 0]
  |  Branch (650:48): [True: 0, False: 0]
  ------------------
  651|      0|                    state->check = PREFIX(crc32)(state->check, next, copy);
  ------------------
  |  |   97|      0|#  define PREFIX(x) zng_ ## x
  ------------------
  652|      0|                have -= copy;
  653|      0|                next += copy;
  654|      0|                if (len)
  ------------------
  |  Branch (654:21): [True: 0, False: 0]
  ------------------
  655|      0|                    goto inf_leave;
  656|      0|            } else if (state->head != NULL) {
  ------------------
  |  Branch (656:24): [True: 0, False: 0]
  ------------------
  657|      0|                state->head->name = NULL;
  658|      0|            }
  659|      0|            state->length = 0;
  660|      0|            state->mode = COMMENT;
  661|      0|            Z_FALLTHROUGH;
  ------------------
  |  |   45|      0|#    define Z_FALLTHROUGH __attribute__((__fallthrough__))
  ------------------
  662|       |
  663|      0|        case COMMENT:
  ------------------
  |  Branch (663:9): [True: 0, False: 1.52k]
  ------------------
  664|      0|            if (state->flags & 0x1000) {
  ------------------
  |  Branch (664:17): [True: 0, False: 0]
  ------------------
  665|      0|                if (have == 0) goto inf_leave;
  ------------------
  |  Branch (665:21): [True: 0, False: 0]
  ------------------
  666|      0|                copy = 0;
  667|      0|                do {
  668|      0|                    len = (unsigned)(next[copy++]);
  669|      0|                    if (state->head != NULL && state->head->comment != NULL
  ------------------
  |  Branch (669:25): [True: 0, False: 0]
  |  Branch (669:48): [True: 0, False: 0]
  ------------------
  670|      0|                        && state->length < state->head->comm_max)
  ------------------
  |  Branch (670:28): [True: 0, False: 0]
  ------------------
  671|      0|                        state->head->comment[state->length++] = (unsigned char)len;
  672|      0|                } while (len && copy < have);
  ------------------
  |  Branch (672:26): [True: 0, False: 0]
  |  Branch (672:33): [True: 0, False: 0]
  ------------------
  673|      0|                if ((state->flags & 0x0200) && (state->wrap & 4))
  ------------------
  |  Branch (673:21): [True: 0, False: 0]
  |  Branch (673:48): [True: 0, False: 0]
  ------------------
  674|      0|                    state->check = PREFIX(crc32)(state->check, next, copy);
  ------------------
  |  |   97|      0|#  define PREFIX(x) zng_ ## x
  ------------------
  675|      0|                have -= copy;
  676|      0|                next += copy;
  677|      0|                if (len)
  ------------------
  |  Branch (677:21): [True: 0, False: 0]
  ------------------
  678|      0|                    goto inf_leave;
  679|      0|            } else if (state->head != NULL) {
  ------------------
  |  Branch (679:24): [True: 0, False: 0]
  ------------------
  680|      0|                state->head->comment = NULL;
  681|      0|            }
  682|      0|            state->mode = HCRC;
  683|      0|            Z_FALLTHROUGH;
  ------------------
  |  |   45|      0|#    define Z_FALLTHROUGH __attribute__((__fallthrough__))
  ------------------
  684|       |
  685|      0|        case HCRC:
  ------------------
  |  Branch (685:9): [True: 0, False: 1.52k]
  ------------------
  686|      0|            if (state->flags & 0x0200) {
  ------------------
  |  Branch (686:17): [True: 0, False: 0]
  ------------------
  687|      0|                NEEDBITS(16);
  ------------------
  |  |  107|      0|    do { \
  |  |  108|      0|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (108:16): [True: 0, False: 0]
  |  |  ------------------
  |  |  109|      0|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  386|      0|    do { \
  |  |  |  |  387|      0|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (387:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  388|      0|        have--; \
  |  |  |  |  389|      0|        hold += ((uint64_t)(*next++) << bits); \
  |  |  |  |  390|      0|        bits += 8; \
  |  |  |  |  391|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (391:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  110|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (110:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  688|      0|                if ((state->wrap & 4) && hold != (state->check & 0xffff)) {
  ------------------
  |  Branch (688:21): [True: 0, False: 0]
  |  Branch (688:42): [True: 0, False: 0]
  ------------------
  689|      0|                    SET_BAD("header crc mismatch");
  ------------------
  |  |  132|      0|    do { \
  |  |  133|      0|        state->mode = BAD; \
  |  |  134|      0|        strm->msg = (char *)errmsg; \
  |  |  135|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (135:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  690|      0|                    break;
  691|      0|                }
  692|      0|                INITBITS();
  ------------------
  |  |   99|      0|    do { \
  |  |  100|      0|        hold = 0; \
  |  |  101|      0|        bits = 0; \
  |  |  102|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (102:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  693|      0|            }
  694|      0|            if (state->head != NULL) {
  ------------------
  |  Branch (694:17): [True: 0, False: 0]
  ------------------
  695|      0|                state->head->hcrc = (int)((state->flags >> 9) & 1);
  696|      0|                state->head->done = 1;
  697|      0|            }
  698|       |            /* compute crc32 checksum if not in raw mode */
  699|      0|            if ((state->wrap & 4) && state->flags)
  ------------------
  |  Branch (699:17): [True: 0, False: 0]
  |  Branch (699:38): [True: 0, False: 0]
  ------------------
  700|      0|                strm->adler = state->check = FUNCTABLE_CALL(crc32_fold_reset)(&state->crc_fold);
  ------------------
  |  |   49|      0|#  define FUNCTABLE_CALL(name) functable.name
  ------------------
  701|      0|            state->mode = TYPE;
  702|      0|            break;
  703|      0|#endif
  704|      7|        case DICTID:
  ------------------
  |  Branch (704:9): [True: 7, False: 1.51k]
  ------------------
  705|      7|            NEEDBITS(32);
  ------------------
  |  |  107|      7|    do { \
  |  |  108|     17|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (108:16): [True: 16, False: 1]
  |  |  ------------------
  |  |  109|     16|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  386|     16|    do { \
  |  |  |  |  387|     16|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (387:13): [True: 6, False: 10]
  |  |  |  |  ------------------
  |  |  |  |  388|     16|        have--; \
  |  |  |  |  389|     10|        hold += ((uint64_t)(*next++) << bits); \
  |  |  |  |  390|     10|        bits += 8; \
  |  |  |  |  391|     10|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (391:14): [Folded, False: 10]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  110|      7|    } while (0)
  |  |  ------------------
  |  |  |  Branch (110:14): [Folded, False: 1]
  |  |  ------------------
  ------------------
  706|      1|            strm->adler = state->check = ZSWAP32((unsigned)hold);
  ------------------
  |  |  170|      1|#  define ZSWAP32(q) __builtin_bswap32(q)
  ------------------
  707|      1|            INITBITS();
  ------------------
  |  |   99|      1|    do { \
  |  |  100|      1|        hold = 0; \
  |  |  101|      1|        bits = 0; \
  |  |  102|      1|    } while (0)
  |  |  ------------------
  |  |  |  Branch (102:14): [Folded, False: 1]
  |  |  ------------------
  ------------------
  708|      1|            state->mode = DICT;
  709|      1|            Z_FALLTHROUGH;
  ------------------
  |  |   45|      1|#    define Z_FALLTHROUGH __attribute__((__fallthrough__))
  ------------------
  710|       |
  711|      1|        case DICT:
  ------------------
  |  Branch (711:9): [True: 0, False: 1.52k]
  ------------------
  712|      1|            if (state->havedict == 0) {
  ------------------
  |  Branch (712:17): [True: 1, False: 0]
  ------------------
  713|      1|                RESTORE();
  ------------------
  |  |   88|      1|    do { \
  |  |   89|      1|        strm->next_out = put; \
  |  |   90|      1|        strm->avail_out = left; \
  |  |   91|      1|        strm->next_in = (z_const unsigned char *)next; \
  |  |   92|      1|        strm->avail_in = have; \
  |  |   93|      1|        state->hold = hold; \
  |  |   94|      1|        state->bits = bits; \
  |  |   95|      1|    } while (0)
  |  |  ------------------
  |  |  |  Branch (95:14): [Folded, False: 1]
  |  |  ------------------
  ------------------
  714|      1|                return Z_NEED_DICT;
  ------------------
  |  |  182|      1|#define Z_NEED_DICT     2
  ------------------
  715|      1|            }
  716|      0|            strm->adler = state->check = ADLER32_INITIAL_VALUE;
  ------------------
  |  |   65|      0|#define ADLER32_INITIAL_VALUE 1 /* initial adler-32 hash value */
  ------------------
  717|      0|            state->mode = TYPE;
  718|      0|            Z_FALLTHROUGH;
  ------------------
  |  |   45|      0|#    define Z_FALLTHROUGH __attribute__((__fallthrough__))
  ------------------
  719|       |
  720|    208|        case TYPE:
  ------------------
  |  Branch (720:9): [True: 208, False: 1.31k]
  ------------------
  721|    208|            if (flush == Z_BLOCK || flush == Z_TREES)
  ------------------
  |  |  176|    416|#define Z_BLOCK         5
  ------------------
                          if (flush == Z_BLOCK || flush == Z_TREES)
  ------------------
  |  |  177|    208|#define Z_TREES         6
  ------------------
  |  Branch (721:17): [True: 0, False: 208]
  |  Branch (721:37): [True: 0, False: 208]
  ------------------
  722|      0|                goto inf_leave;
  723|    208|            Z_FALLTHROUGH;
  ------------------
  |  |   45|    208|#    define Z_FALLTHROUGH __attribute__((__fallthrough__))
  ------------------
  724|       |
  725|    208|        case TYPEDO:
  ------------------
  |  Branch (725:9): [True: 0, False: 1.52k]
  ------------------
  726|       |            /* determine and dispatch block type */
  727|    208|            INFLATE_TYPEDO_HOOK(strm, flush);  /* hook for IBM Z DFLTCC */
  ------------------
  |  |   29|    208|#  define INFLATE_TYPEDO_HOOK(strm, flush) do {} while (0)
  |  |  ------------------
  |  |  |  Branch (29:57): [Folded, False: 208]
  |  |  ------------------
  ------------------
  728|    208|            if (state->last) {
  ------------------
  |  Branch (728:17): [True: 42, False: 166]
  ------------------
  729|     42|                BYTEBITS();
  ------------------
  |  |  125|     42|    do { \
  |  |  126|     42|        hold >>= bits & 7; \
  |  |  127|     42|        bits -= bits & 7; \
  |  |  128|     42|    } while (0)
  |  |  ------------------
  |  |  |  Branch (128:14): [Folded, False: 42]
  |  |  ------------------
  ------------------
  730|     42|                state->mode = CHECK;
  731|     42|                break;
  732|     42|            }
  733|    166|            NEEDBITS(3);
  ------------------
  |  |  107|    166|    do { \
  |  |  108|    320|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (108:16): [True: 154, False: 166]
  |  |  ------------------
  |  |  109|    166|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  386|    154|    do { \
  |  |  |  |  387|    154|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (387:13): [True: 0, False: 154]
  |  |  |  |  ------------------
  |  |  |  |  388|    154|        have--; \
  |  |  |  |  389|    154|        hold += ((uint64_t)(*next++) << bits); \
  |  |  |  |  390|    154|        bits += 8; \
  |  |  |  |  391|    154|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (391:14): [Folded, False: 154]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  110|    166|    } while (0)
  |  |  ------------------
  |  |  |  Branch (110:14): [Folded, False: 166]
  |  |  ------------------
  ------------------
  734|    166|            state->last = BITS(1);
  ------------------
  |  |  114|    166|    (hold & ((1U << (unsigned)(n)) - 1))
  ------------------
  735|    166|            DROPBITS(1);
  ------------------
  |  |  118|    166|    do { \
  |  |  119|    166|        hold >>= (n); \
  |  |  120|    166|        bits -= (unsigned)(n); \
  |  |  121|    166|    } while (0)
  |  |  ------------------
  |  |  |  Branch (121:14): [Folded, False: 166]
  |  |  ------------------
  ------------------
  736|    166|            switch (BITS(2)) {
  ------------------
  |  |  114|    166|    (hold & ((1U << (unsigned)(n)) - 1))
  |  |  ------------------
  |  |  |  Branch (114:5): [True: 166, False: 0]
  |  |  ------------------
  ------------------
  737|     14|            case 0:                             /* stored block */
  ------------------
  |  Branch (737:13): [True: 14, False: 152]
  ------------------
  738|     14|                Tracev((stderr, "inflate:     stored block%s\n", state->last ? " (last)" : ""));
  739|     14|                state->mode = STORED;
  740|     14|                break;
  741|     90|            case 1:                             /* fixed block */
  ------------------
  |  Branch (741:13): [True: 90, False: 76]
  ------------------
  742|     90|                PREFIX(fixedtables)(state);
  ------------------
  |  |   97|     90|#  define PREFIX(x) zng_ ## x
  ------------------
  743|     90|                Tracev((stderr, "inflate:     fixed codes block%s\n", state->last ? " (last)" : ""));
  744|     90|                state->mode = LEN_;             /* decode codes */
  745|     90|                if (flush == Z_TREES) {
  ------------------
  |  |  177|     90|#define Z_TREES         6
  ------------------
  |  Branch (745:21): [True: 0, False: 90]
  ------------------
  746|      0|                    DROPBITS(2);
  ------------------
  |  |  118|      0|    do { \
  |  |  119|      0|        hold >>= (n); \
  |  |  120|      0|        bits -= (unsigned)(n); \
  |  |  121|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (121:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  747|      0|                    goto inf_leave;
  748|      0|                }
  749|     90|                break;
  750|     90|            case 2:                             /* dynamic block */
  ------------------
  |  Branch (750:13): [True: 60, False: 106]
  ------------------
  751|     60|                Tracev((stderr, "inflate:     dynamic codes block%s\n", state->last ? " (last)" : ""));
  752|     60|                state->mode = TABLE;
  753|     60|                break;
  754|      2|            case 3:
  ------------------
  |  Branch (754:13): [True: 2, False: 164]
  ------------------
  755|      2|                SET_BAD("invalid block type");
  ------------------
  |  |  132|      2|    do { \
  |  |  133|      2|        state->mode = BAD; \
  |  |  134|      2|        strm->msg = (char *)errmsg; \
  |  |  135|      2|    } while (0)
  |  |  ------------------
  |  |  |  Branch (135:14): [Folded, False: 2]
  |  |  ------------------
  ------------------
  756|    166|            }
  757|    166|            DROPBITS(2);
  ------------------
  |  |  118|    166|    do { \
  |  |  119|    166|        hold >>= (n); \
  |  |  120|    166|        bits -= (unsigned)(n); \
  |  |  121|    166|    } while (0)
  |  |  ------------------
  |  |  |  Branch (121:14): [Folded, False: 166]
  |  |  ------------------
  ------------------
  758|    166|            break;
  759|       |
  760|     23|        case STORED:
  ------------------
  |  Branch (760:9): [True: 23, False: 1.50k]
  ------------------
  761|       |            /* get and verify stored block length */
  762|     23|            BYTEBITS();                         /* go to byte boundary */
  ------------------
  |  |  125|     23|    do { \
  |  |  126|     23|        hold >>= bits & 7; \
  |  |  127|     23|        bits -= bits & 7; \
  |  |  128|     23|    } while (0)
  |  |  ------------------
  |  |  |  Branch (128:14): [Folded, False: 23]
  |  |  ------------------
  ------------------
  763|     23|            NEEDBITS(32);
  ------------------
  |  |  107|     23|    do { \
  |  |  108|     55|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (108:16): [True: 50, False: 5]
  |  |  ------------------
  |  |  109|     50|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  386|     50|    do { \
  |  |  |  |  387|     50|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (387:13): [True: 18, False: 32]
  |  |  |  |  ------------------
  |  |  |  |  388|     50|        have--; \
  |  |  |  |  389|     32|        hold += ((uint64_t)(*next++) << bits); \
  |  |  |  |  390|     32|        bits += 8; \
  |  |  |  |  391|     32|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (391:14): [Folded, False: 32]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  110|     23|    } while (0)
  |  |  ------------------
  |  |  |  Branch (110:14): [Folded, False: 5]
  |  |  ------------------
  ------------------
  764|      5|            if ((hold & 0xffff) != ((hold >> 16) ^ 0xffff)) {
  ------------------
  |  Branch (764:17): [True: 0, False: 5]
  ------------------
  765|      0|                SET_BAD("invalid stored block lengths");
  ------------------
  |  |  132|      0|    do { \
  |  |  133|      0|        state->mode = BAD; \
  |  |  134|      0|        strm->msg = (char *)errmsg; \
  |  |  135|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (135:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  766|      0|                break;
  767|      0|            }
  768|      5|            state->length = (uint16_t)hold;
  769|      5|            Tracev((stderr, "inflate:       stored length %u\n", state->length));
  770|      5|            INITBITS();
  ------------------
  |  |   99|      5|    do { \
  |  |  100|      5|        hold = 0; \
  |  |  101|      5|        bits = 0; \
  |  |  102|      5|    } while (0)
  |  |  ------------------
  |  |  |  Branch (102:14): [Folded, False: 5]
  |  |  ------------------
  ------------------
  771|      5|            state->mode = COPY_;
  772|      5|            if (flush == Z_TREES)
  ------------------
  |  |  177|      5|#define Z_TREES         6
  ------------------
  |  Branch (772:17): [True: 0, False: 5]
  ------------------
  773|      0|                goto inf_leave;
  774|      5|            Z_FALLTHROUGH;
  ------------------
  |  |   45|      5|#    define Z_FALLTHROUGH __attribute__((__fallthrough__))
  ------------------
  775|       |
  776|      5|        case COPY_:
  ------------------
  |  Branch (776:9): [True: 0, False: 1.52k]
  ------------------
  777|      5|            state->mode = COPY;
  778|      5|            Z_FALLTHROUGH;
  ------------------
  |  |   45|      5|#    define Z_FALLTHROUGH __attribute__((__fallthrough__))
  ------------------
  779|       |
  780|     11|        case COPY:
  ------------------
  |  Branch (780:9): [True: 6, False: 1.52k]
  ------------------
  781|       |            /* copy stored block from input to output */
  782|     11|            copy = state->length;
  783|     11|            if (copy) {
  ------------------
  |  Branch (783:17): [True: 9, False: 2]
  ------------------
  784|      9|                copy = MIN(copy, have);
  ------------------
  |  |  124|      9|#define MIN(a, b) ((a) > (b) ? (b) : (a))
  |  |  ------------------
  |  |  |  Branch (124:20): [True: 9, False: 0]
  |  |  ------------------
  ------------------
  785|      9|                copy = MIN(copy, left);
  ------------------
  |  |  124|      9|#define MIN(a, b) ((a) > (b) ? (b) : (a))
  |  |  ------------------
  |  |  |  Branch (124:20): [True: 0, False: 9]
  |  |  ------------------
  ------------------
  786|      9|                if (copy == 0)
  ------------------
  |  Branch (786:21): [True: 6, False: 3]
  ------------------
  787|      6|                    goto inf_leave;
  788|      3|                memcpy(put, next, copy);
  789|      3|                have -= copy;
  790|      3|                next += copy;
  791|      3|                left -= copy;
  792|      3|                put += copy;
  793|      3|                state->length -= copy;
  794|      3|                break;
  795|      9|            }
  796|      2|            Tracev((stderr, "inflate:       stored end\n"));
  797|      2|            state->mode = TYPE;
  798|      2|            break;
  799|       |
  800|     62|        case TABLE:
  ------------------
  |  Branch (800:9): [True: 62, False: 1.46k]
  ------------------
  801|       |            /* get dynamic table entries descriptor */
  802|     62|            NEEDBITS(14);
  ------------------
  |  |  107|     62|    do { \
  |  |  108|    177|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (108:16): [True: 119, False: 58]
  |  |  ------------------
  |  |  109|    119|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  386|    119|    do { \
  |  |  |  |  387|    119|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (387:13): [True: 4, False: 115]
  |  |  |  |  ------------------
  |  |  |  |  388|    119|        have--; \
  |  |  |  |  389|    115|        hold += ((uint64_t)(*next++) << bits); \
  |  |  |  |  390|    115|        bits += 8; \
  |  |  |  |  391|    115|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (391:14): [Folded, False: 115]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  110|     62|    } while (0)
  |  |  ------------------
  |  |  |  Branch (110:14): [Folded, False: 58]
  |  |  ------------------
  ------------------
  803|     58|            state->nlen = BITS(5) + 257;
  ------------------
  |  |  114|     58|    (hold & ((1U << (unsigned)(n)) - 1))
  ------------------
  804|     58|            DROPBITS(5);
  ------------------
  |  |  118|     58|    do { \
  |  |  119|     58|        hold >>= (n); \
  |  |  120|     58|        bits -= (unsigned)(n); \
  |  |  121|     58|    } while (0)
  |  |  ------------------
  |  |  |  Branch (121:14): [Folded, False: 58]
  |  |  ------------------
  ------------------
  805|     58|            state->ndist = BITS(5) + 1;
  ------------------
  |  |  114|     58|    (hold & ((1U << (unsigned)(n)) - 1))
  ------------------
  806|     58|            DROPBITS(5);
  ------------------
  |  |  118|     58|    do { \
  |  |  119|     58|        hold >>= (n); \
  |  |  120|     58|        bits -= (unsigned)(n); \
  |  |  121|     58|    } while (0)
  |  |  ------------------
  |  |  |  Branch (121:14): [Folded, False: 58]
  |  |  ------------------
  ------------------
  807|     58|            state->ncode = BITS(4) + 4;
  ------------------
  |  |  114|     58|    (hold & ((1U << (unsigned)(n)) - 1))
  ------------------
  808|     58|            DROPBITS(4);
  ------------------
  |  |  118|     58|    do { \
  |  |  119|     58|        hold >>= (n); \
  |  |  120|     58|        bits -= (unsigned)(n); \
  |  |  121|     58|    } while (0)
  |  |  ------------------
  |  |  |  Branch (121:14): [Folded, False: 58]
  |  |  ------------------
  ------------------
  809|     58|#ifndef PKZIP_BUG_WORKAROUND
  810|     58|            if (state->nlen > 286 || state->ndist > 30) {
  ------------------
  |  Branch (810:17): [True: 1, False: 57]
  |  Branch (810:38): [True: 1, False: 56]
  ------------------
  811|      2|                SET_BAD("too many length or distance symbols");
  ------------------
  |  |  132|      2|    do { \
  |  |  133|      2|        state->mode = BAD; \
  |  |  134|      2|        strm->msg = (char *)errmsg; \
  |  |  135|      2|    } while (0)
  |  |  ------------------
  |  |  |  Branch (135:14): [Folded, False: 2]
  |  |  ------------------
  ------------------
  812|      2|                break;
  813|      2|            }
  814|     56|#endif
  815|     56|            Tracev((stderr, "inflate:       table sizes ok\n"));
  816|     56|            state->have = 0;
  817|     56|            state->mode = LENLENS;
  818|     56|            Z_FALLTHROUGH;
  ------------------
  |  |   45|     56|#    define Z_FALLTHROUGH __attribute__((__fallthrough__))
  ------------------
  819|       |
  820|     59|        case LENLENS:
  ------------------
  |  Branch (820:9): [True: 3, False: 1.52k]
  ------------------
  821|       |            /* get code length code lengths (not a typo) */
  822|    551|            while (state->have < state->ncode) {
  ------------------
  |  Branch (822:20): [True: 498, False: 53]
  ------------------
  823|    498|                NEEDBITS(3);
  ------------------
  |  |  107|    498|    do { \
  |  |  108|    654|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (108:16): [True: 162, False: 492]
  |  |  ------------------
  |  |  109|    498|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  386|    162|    do { \
  |  |  |  |  387|    162|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (387:13): [True: 6, False: 156]
  |  |  |  |  ------------------
  |  |  |  |  388|    162|        have--; \
  |  |  |  |  389|    156|        hold += ((uint64_t)(*next++) << bits); \
  |  |  |  |  390|    156|        bits += 8; \
  |  |  |  |  391|    156|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (391:14): [Folded, False: 156]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  110|    498|    } while (0)
  |  |  ------------------
  |  |  |  Branch (110:14): [Folded, False: 492]
  |  |  ------------------
  ------------------
  824|    492|                state->lens[order[state->have++]] = (uint16_t)BITS(3);
  ------------------
  |  |  114|    492|    (hold & ((1U << (unsigned)(n)) - 1))
  ------------------
  825|    492|                DROPBITS(3);
  ------------------
  |  |  118|    492|    do { \
  |  |  119|    492|        hold >>= (n); \
  |  |  120|    492|        bits -= (unsigned)(n); \
  |  |  121|    492|    } while (0)
  |  |  ------------------
  |  |  |  Branch (121:14): [Folded, False: 492]
  |  |  ------------------
  ------------------
  826|    492|            }
  827|    588|            while (state->have < 19)
  ------------------
  |  Branch (827:20): [True: 535, False: 53]
  ------------------
  828|    535|                state->lens[order[state->have++]] = 0;
  829|     53|            state->next = state->codes;
  830|     53|            state->lencode = (const code *)(state->next);
  831|     53|            state->lenbits = 7;
  832|     53|            ret = zng_inflate_table(CODES, state->lens, 19, &(state->next), &(state->lenbits), state->work);
  833|     53|            if (ret) {
  ------------------
  |  Branch (833:17): [True: 17, False: 36]
  ------------------
  834|     17|                SET_BAD("invalid code lengths set");
  ------------------
  |  |  132|     17|    do { \
  |  |  133|     17|        state->mode = BAD; \
  |  |  134|     17|        strm->msg = (char *)errmsg; \
  |  |  135|     17|    } while (0)
  |  |  ------------------
  |  |  |  Branch (135:14): [Folded, False: 17]
  |  |  ------------------
  ------------------
  835|     17|                break;
  836|     17|            }
  837|     36|            Tracev((stderr, "inflate:       code lengths ok\n"));
  838|     36|            state->have = 0;
  839|     36|            state->mode = CODELENS;
  840|     36|            Z_FALLTHROUGH;
  ------------------
  |  |   45|     36|#    define Z_FALLTHROUGH __attribute__((__fallthrough__))
  ------------------
  841|       |
  842|     54|        case CODELENS:
  ------------------
  |  Branch (842:9): [True: 18, False: 1.50k]
  ------------------
  843|       |            /* get length and distance code code lengths */
  844|    772|            while (state->have < state->nlen + state->ndist) {
  ------------------
  |  Branch (844:20): [True: 765, False: 7]
  ------------------
  845|    900|                for (;;) {
  846|    900|                    here = state->lencode[BITS(state->lenbits)];
  ------------------
  |  |  114|    900|    (hold & ((1U << (unsigned)(n)) - 1))
  ------------------
  847|    900|                    if (here.bits <= bits) break;
  ------------------
  |  Branch (847:25): [True: 745, False: 155]
  ------------------
  848|    155|                    PULLBYTE();
  ------------------
  |  |  386|    155|    do { \
  |  |  387|    155|        if (have == 0) goto inf_leave; \
  |  |  ------------------
  |  |  |  Branch (387:13): [True: 20, False: 135]
  |  |  ------------------
  |  |  388|    155|        have--; \
  |  |  389|    135|        hold += ((uint64_t)(*next++) << bits); \
  |  |  390|    135|        bits += 8; \
  |  |  391|    135|    } while (0)
  |  |  ------------------
  |  |  |  Branch (391:14): [Folded, False: 135]
  |  |  ------------------
  ------------------
  849|    155|                }
  850|    745|                if (here.val < 16) {
  ------------------
  |  Branch (850:21): [True: 407, False: 338]
  ------------------
  851|    407|                    DROPBITS(here.bits);
  ------------------
  |  |  118|    407|    do { \
  |  |  119|    407|        hold >>= (n); \
  |  |  120|    407|        bits -= (unsigned)(n); \
  |  |  121|    407|    } while (0)
  |  |  ------------------
  |  |  |  Branch (121:14): [Folded, False: 407]
  |  |  ------------------
  ------------------
  852|    407|                    state->lens[state->have++] = here.val;
  853|    407|                } else {
  854|    338|                    if (here.val == 16) {
  ------------------
  |  Branch (854:25): [True: 181, False: 157]
  ------------------
  855|    181|                        NEEDBITS(here.bits + 2);
  ------------------
  |  |  107|    181|    do { \
  |  |  108|    227|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (108:16): [True: 60, False: 167]
  |  |  ------------------
  |  |  109|    181|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  386|     60|    do { \
  |  |  |  |  387|     60|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (387:13): [True: 14, False: 46]
  |  |  |  |  ------------------
  |  |  |  |  388|     60|        have--; \
  |  |  |  |  389|     46|        hold += ((uint64_t)(*next++) << bits); \
  |  |  |  |  390|     46|        bits += 8; \
  |  |  |  |  391|     46|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (391:14): [Folded, False: 46]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  110|    181|    } while (0)
  |  |  ------------------
  |  |  |  Branch (110:14): [Folded, False: 167]
  |  |  ------------------
  ------------------
  856|    167|                        DROPBITS(here.bits);
  ------------------
  |  |  118|    167|    do { \
  |  |  119|    167|        hold >>= (n); \
  |  |  120|    167|        bits -= (unsigned)(n); \
  |  |  121|    167|    } while (0)
  |  |  ------------------
  |  |  |  Branch (121:14): [Folded, False: 167]
  |  |  ------------------
  ------------------
  857|    167|                        if (state->have == 0) {
  ------------------
  |  Branch (857:29): [True: 1, False: 166]
  ------------------
  858|      1|                            SET_BAD("invalid bit length repeat");
  ------------------
  |  |  132|      1|    do { \
  |  |  133|      1|        state->mode = BAD; \
  |  |  134|      1|        strm->msg = (char *)errmsg; \
  |  |  135|      1|    } while (0)
  |  |  ------------------
  |  |  |  Branch (135:14): [Folded, False: 1]
  |  |  ------------------
  ------------------
  859|      1|                            break;
  860|      1|                        }
  861|    166|                        len = state->lens[state->have - 1];
  862|    166|                        copy = 3 + BITS(2);
  ------------------
  |  |  114|    166|    (hold & ((1U << (unsigned)(n)) - 1))
  ------------------
  863|    166|                        DROPBITS(2);
  ------------------
  |  |  118|    166|    do { \
  |  |  119|    166|        hold >>= (n); \
  |  |  120|    166|        bits -= (unsigned)(n); \
  |  |  121|    166|    } while (0)
  |  |  ------------------
  |  |  |  Branch (121:14): [Folded, False: 166]
  |  |  ------------------
  ------------------
  864|    166|                    } else if (here.val == 17) {
  ------------------
  |  Branch (864:32): [True: 67, False: 90]
  ------------------
  865|     67|                        NEEDBITS(here.bits + 3);
  ------------------
  |  |  107|     67|    do { \
  |  |  108|     84|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (108:16): [True: 19, False: 65]
  |  |  ------------------
  |  |  109|     67|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  386|     19|    do { \
  |  |  |  |  387|     19|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (387:13): [True: 2, False: 17]
  |  |  |  |  ------------------
  |  |  |  |  388|     19|        have--; \
  |  |  |  |  389|     17|        hold += ((uint64_t)(*next++) << bits); \
  |  |  |  |  390|     17|        bits += 8; \
  |  |  |  |  391|     17|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (391:14): [Folded, False: 17]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  110|     67|    } while (0)
  |  |  ------------------
  |  |  |  Branch (110:14): [Folded, False: 65]
  |  |  ------------------
  ------------------
  866|     65|                        DROPBITS(here.bits);
  ------------------
  |  |  118|     65|    do { \
  |  |  119|     65|        hold >>= (n); \
  |  |  120|     65|        bits -= (unsigned)(n); \
  |  |  121|     65|    } while (0)
  |  |  ------------------
  |  |  |  Branch (121:14): [Folded, False: 65]
  |  |  ------------------
  ------------------
  867|     65|                        len = 0;
  868|     65|                        copy = 3 + BITS(3);
  ------------------
  |  |  114|     65|    (hold & ((1U << (unsigned)(n)) - 1))
  ------------------
  869|     65|                        DROPBITS(3);
  ------------------
  |  |  118|     65|    do { \
  |  |  119|     65|        hold >>= (n); \
  |  |  120|     65|        bits -= (unsigned)(n); \
  |  |  121|     65|    } while (0)
  |  |  ------------------
  |  |  |  Branch (121:14): [Folded, False: 65]
  |  |  ------------------
  ------------------
  870|     90|                    } else {
  871|     90|                        NEEDBITS(here.bits + 7);
  ------------------
  |  |  107|     90|    do { \
  |  |  108|    171|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (108:16): [True: 81, False: 90]
  |  |  ------------------
  |  |  109|     90|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  386|     81|    do { \
  |  |  |  |  387|     81|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (387:13): [True: 0, False: 81]
  |  |  |  |  ------------------
  |  |  |  |  388|     81|        have--; \
  |  |  |  |  389|     81|        hold += ((uint64_t)(*next++) << bits); \
  |  |  |  |  390|     81|        bits += 8; \
  |  |  |  |  391|     81|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (391:14): [Folded, False: 81]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  110|     90|    } while (0)
  |  |  ------------------
  |  |  |  Branch (110:14): [Folded, False: 90]
  |  |  ------------------
  ------------------
  872|     90|                        DROPBITS(here.bits);
  ------------------
  |  |  118|     90|    do { \
  |  |  119|     90|        hold >>= (n); \
  |  |  120|     90|        bits -= (unsigned)(n); \
  |  |  121|     90|    } while (0)
  |  |  ------------------
  |  |  |  Branch (121:14): [Folded, False: 90]
  |  |  ------------------
  ------------------
  873|     90|                        len = 0;
  874|     90|                        copy = 11 + BITS(7);
  ------------------
  |  |  114|     90|    (hold & ((1U << (unsigned)(n)) - 1))
  ------------------
  875|     90|                        DROPBITS(7);
  ------------------
  |  |  118|     90|    do { \
  |  |  119|     90|        hold >>= (n); \
  |  |  120|     90|        bits -= (unsigned)(n); \
  |  |  121|     90|    } while (0)
  |  |  ------------------
  |  |  |  Branch (121:14): [Folded, False: 90]
  |  |  ------------------
  ------------------
  876|     90|                    }
  877|    321|                    if (state->have + copy > state->nlen + state->ndist) {
  ------------------
  |  Branch (877:25): [True: 10, False: 311]
  ------------------
  878|     10|                        SET_BAD("invalid bit length repeat");
  ------------------
  |  |  132|     10|    do { \
  |  |  133|     10|        state->mode = BAD; \
  |  |  134|     10|        strm->msg = (char *)errmsg; \
  |  |  135|     10|    } while (0)
  |  |  ------------------
  |  |  |  Branch (135:14): [Folded, False: 10]
  |  |  ------------------
  ------------------
  879|     10|                        break;
  880|     10|                    }
  881|  6.58k|                    while (copy) {
  ------------------
  |  Branch (881:28): [True: 6.27k, False: 311]
  ------------------
  882|  6.27k|                        --copy;
  883|  6.27k|                        state->lens[state->have++] = (uint16_t)len;
  884|  6.27k|                    }
  885|    311|                }
  886|    745|            }
  887|       |
  888|       |            /* handle error breaks in while */
  889|     18|            if (state->mode == BAD)
  ------------------
  |  Branch (889:17): [True: 11, False: 7]
  ------------------
  890|     11|                break;
  891|       |
  892|       |            /* check for end-of-block code (better have one) */
  893|      7|            if (state->lens[256] == 0) {
  ------------------
  |  Branch (893:17): [True: 2, False: 5]
  ------------------
  894|      2|                SET_BAD("invalid code -- missing end-of-block");
  ------------------
  |  |  132|      2|    do { \
  |  |  133|      2|        state->mode = BAD; \
  |  |  134|      2|        strm->msg = (char *)errmsg; \
  |  |  135|      2|    } while (0)
  |  |  ------------------
  |  |  |  Branch (135:14): [Folded, False: 2]
  |  |  ------------------
  ------------------
  895|      2|                break;
  896|      2|            }
  897|       |
  898|       |            /* build code tables -- note: do not change the lenbits or distbits
  899|       |               values here (10 and 9) without reading the comments in inftrees.h
  900|       |               concerning the ENOUGH constants, which depend on those values */
  901|      5|            state->next = state->codes;
  902|      5|            state->lencode = (const code *)(state->next);
  903|      5|            state->lenbits = 10;
  904|      5|            ret = zng_inflate_table(LENS, state->lens, state->nlen, &(state->next), &(state->lenbits), state->work);
  905|      5|            if (ret) {
  ------------------
  |  Branch (905:17): [True: 5, False: 0]
  ------------------
  906|      5|                SET_BAD("invalid literal/lengths set");
  ------------------
  |  |  132|      5|    do { \
  |  |  133|      5|        state->mode = BAD; \
  |  |  134|      5|        strm->msg = (char *)errmsg; \
  |  |  135|      5|    } while (0)
  |  |  ------------------
  |  |  |  Branch (135:14): [Folded, False: 5]
  |  |  ------------------
  ------------------
  907|      5|                break;
  908|      5|            }
  909|      0|            state->distcode = (const code *)(state->next);
  910|      0|            state->distbits = 9;
  911|      0|            ret = zng_inflate_table(DISTS, state->lens + state->nlen, state->ndist,
  912|      0|                            &(state->next), &(state->distbits), state->work);
  913|      0|            if (ret) {
  ------------------
  |  Branch (913:17): [True: 0, False: 0]
  ------------------
  914|      0|                SET_BAD("invalid distances set");
  ------------------
  |  |  132|      0|    do { \
  |  |  133|      0|        state->mode = BAD; \
  |  |  134|      0|        strm->msg = (char *)errmsg; \
  |  |  135|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (135:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  915|      0|                break;
  916|      0|            }
  917|      0|            Tracev((stderr, "inflate:       codes ok\n"));
  918|      0|            state->mode = LEN_;
  919|      0|            if (flush == Z_TREES)
  ------------------
  |  |  177|      0|#define Z_TREES         6
  ------------------
  |  Branch (919:17): [True: 0, False: 0]
  ------------------
  920|      0|                goto inf_leave;
  921|      0|            Z_FALLTHROUGH;
  ------------------
  |  |   45|      0|#    define Z_FALLTHROUGH __attribute__((__fallthrough__))
  ------------------
  922|       |
  923|     90|        case LEN_:
  ------------------
  |  Branch (923:9): [True: 90, False: 1.43k]
  ------------------
  924|     90|            state->mode = LEN;
  925|     90|            Z_FALLTHROUGH;
  ------------------
  |  |   45|     90|#    define Z_FALLTHROUGH __attribute__((__fallthrough__))
  ------------------
  926|       |
  927|    612|        case LEN:
  ------------------
  |  Branch (927:9): [True: 522, False: 1.00k]
  ------------------
  928|       |            /* use inflate_fast() if we have enough input and output */
  929|    612|            if (have >= INFLATE_FAST_MIN_HAVE && left >= INFLATE_FAST_MIN_LEFT) {
  ------------------
  |  |  137|  1.22k|#define INFLATE_FAST_MIN_HAVE 15
  ------------------
                          if (have >= INFLATE_FAST_MIN_HAVE && left >= INFLATE_FAST_MIN_LEFT) {
  ------------------
  |  |  138|      0|#define INFLATE_FAST_MIN_LEFT 260
  ------------------
  |  Branch (929:17): [True: 0, False: 612]
  |  Branch (929:50): [True: 0, False: 0]
  ------------------
  930|      0|                RESTORE();
  ------------------
  |  |   88|      0|    do { \
  |  |   89|      0|        strm->next_out = put; \
  |  |   90|      0|        strm->avail_out = left; \
  |  |   91|      0|        strm->next_in = (z_const unsigned char *)next; \
  |  |   92|      0|        strm->avail_in = have; \
  |  |   93|      0|        state->hold = hold; \
  |  |   94|      0|        state->bits = bits; \
  |  |   95|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (95:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  931|      0|                FUNCTABLE_CALL(inflate_fast)(strm, out);
  ------------------
  |  |   49|      0|#  define FUNCTABLE_CALL(name) functable.name
  ------------------
  932|      0|                LOAD();
  ------------------
  |  |   77|      0|    do { \
  |  |   78|      0|        put = strm->next_out; \
  |  |   79|      0|        left = strm->avail_out; \
  |  |   80|      0|        next = strm->next_in; \
  |  |   81|      0|        have = strm->avail_in; \
  |  |   82|      0|        hold = state->hold; \
  |  |   83|      0|        bits = state->bits; \
  |  |   84|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (84:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  933|      0|                if (state->mode == TYPE)
  ------------------
  |  Branch (933:21): [True: 0, False: 0]
  ------------------
  934|      0|                    state->back = -1;
  935|      0|                break;
  936|      0|            }
  937|    612|            state->back = 0;
  938|       |
  939|       |            /* get a literal, length, or end-of-block code */
  940|  1.19k|            for (;;) {
  941|  1.19k|                here = state->lencode[BITS(state->lenbits)];
  ------------------
  |  |  114|  1.19k|    (hold & ((1U << (unsigned)(n)) - 1))
  ------------------
  942|  1.19k|                if (here.bits <= bits)
  ------------------
  |  Branch (942:21): [True: 600, False: 599]
  ------------------
  943|    600|                    break;
  944|    599|                PULLBYTE();
  ------------------
  |  |  386|    599|    do { \
  |  |  387|    599|        if (have == 0) goto inf_leave; \
  |  |  ------------------
  |  |  |  Branch (387:13): [True: 12, False: 587]
  |  |  ------------------
  |  |  388|    599|        have--; \
  |  |  389|    587|        hold += ((uint64_t)(*next++) << bits); \
  |  |  390|    587|        bits += 8; \
  |  |  391|    587|    } while (0)
  |  |  ------------------
  |  |  |  Branch (391:14): [Folded, False: 587]
  |  |  ------------------
  ------------------
  945|    599|            }
  946|    600|            if (here.op && (here.op & 0xf0) == 0) {
  ------------------
  |  Branch (946:17): [True: 314, False: 286]
  |  Branch (946:28): [True: 0, False: 314]
  ------------------
  947|      0|                last = here;
  948|      0|                for (;;) {
  949|      0|                    here = state->lencode[last.val + (BITS(last.bits + last.op) >> last.bits)];
  ------------------
  |  |  114|      0|    (hold & ((1U << (unsigned)(n)) - 1))
  ------------------
  950|      0|                    if ((unsigned)last.bits + (unsigned)here.bits <= bits)
  ------------------
  |  Branch (950:25): [True: 0, False: 0]
  ------------------
  951|      0|                        break;
  952|      0|                    PULLBYTE();
  ------------------
  |  |  386|      0|    do { \
  |  |  387|      0|        if (have == 0) goto inf_leave; \
  |  |  ------------------
  |  |  |  Branch (387:13): [True: 0, False: 0]
  |  |  ------------------
  |  |  388|      0|        have--; \
  |  |  389|      0|        hold += ((uint64_t)(*next++) << bits); \
  |  |  390|      0|        bits += 8; \
  |  |  391|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (391:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  953|      0|                }
  954|      0|                DROPBITS(last.bits);
  ------------------
  |  |  118|      0|    do { \
  |  |  119|      0|        hold >>= (n); \
  |  |  120|      0|        bits -= (unsigned)(n); \
  |  |  121|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (121:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  955|      0|                state->back += last.bits;
  956|      0|            }
  957|    600|            DROPBITS(here.bits);
  ------------------
  |  |  118|    600|    do { \
  |  |  119|    600|        hold >>= (n); \
  |  |  120|    600|        bits -= (unsigned)(n); \
  |  |  121|    600|    } while (0)
  |  |  ------------------
  |  |  |  Branch (121:14): [Folded, False: 600]
  |  |  ------------------
  ------------------
  958|    600|            state->back += here.bits;
  959|    600|            state->length = here.val;
  960|       |
  961|       |            /* process literal */
  962|    600|            if ((int)(here.op) == 0) {
  ------------------
  |  Branch (962:17): [True: 286, False: 314]
  ------------------
  963|    286|                Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ?
  964|    286|                        "inflate:         literal '%c'\n" :
  965|    286|                        "inflate:         literal 0x%02x\n", here.val));
  966|    286|                state->mode = LIT;
  967|    286|                break;
  968|    286|            }
  969|       |
  970|       |            /* process end of block */
  971|    314|            if (here.op & 32) {
  ------------------
  |  Branch (971:17): [True: 64, False: 250]
  ------------------
  972|     64|                Tracevv((stderr, "inflate:         end of block\n"));
  973|     64|                state->back = -1;
  974|     64|                state->mode = TYPE;
  975|     64|                break;
  976|     64|            }
  977|       |
  978|       |            /* invalid code */
  979|    250|            if (here.op & 64) {
  ------------------
  |  Branch (979:17): [True: 0, False: 250]
  ------------------
  980|      0|                SET_BAD("invalid literal/length code");
  ------------------
  |  |  132|      0|    do { \
  |  |  133|      0|        state->mode = BAD; \
  |  |  134|      0|        strm->msg = (char *)errmsg; \
  |  |  135|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (135:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  981|      0|                break;
  982|      0|            }
  983|       |
  984|       |            /* length code */
  985|    250|            state->extra = (here.op & MAX_BITS);
  ------------------
  |  |   39|    250|#define MAX_BITS 15
  ------------------
  986|    250|            state->mode = LENEXT;
  987|    250|            Z_FALLTHROUGH;
  ------------------
  |  |   45|    250|#    define Z_FALLTHROUGH __attribute__((__fallthrough__))
  ------------------
  988|       |
  989|    251|        case LENEXT:
  ------------------
  |  Branch (989:9): [True: 1, False: 1.52k]
  ------------------
  990|       |            /* get extra bits, if any */
  991|    251|            if (state->extra) {
  ------------------
  |  Branch (991:17): [True: 141, False: 110]
  ------------------
  992|    141|                NEEDBITS(state->extra);
  ------------------
  |  |  107|    141|    do { \
  |  |  108|    180|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (108:16): [True: 41, False: 139]
  |  |  ------------------
  |  |  109|    141|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  386|     41|    do { \
  |  |  |  |  387|     41|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (387:13): [True: 2, False: 39]
  |  |  |  |  ------------------
  |  |  |  |  388|     41|        have--; \
  |  |  |  |  389|     39|        hold += ((uint64_t)(*next++) << bits); \
  |  |  |  |  390|     39|        bits += 8; \
  |  |  |  |  391|     39|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (391:14): [Folded, False: 39]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  110|    141|    } while (0)
  |  |  ------------------
  |  |  |  Branch (110:14): [Folded, False: 139]
  |  |  ------------------
  ------------------
  993|    139|                state->length += BITS(state->extra);
  ------------------
  |  |  114|    139|    (hold & ((1U << (unsigned)(n)) - 1))
  ------------------
  994|    139|                DROPBITS(state->extra);
  ------------------
  |  |  118|    139|    do { \
  |  |  119|    139|        hold >>= (n); \
  |  |  120|    139|        bits -= (unsigned)(n); \
  |  |  121|    139|    } while (0)
  |  |  ------------------
  |  |  |  Branch (121:14): [Folded, False: 139]
  |  |  ------------------
  ------------------
  995|    139|                state->back += state->extra;
  996|    139|            }
  997|    249|            Tracevv((stderr, "inflate:         length %u\n", state->length));
  998|    249|            state->was = state->length;
  999|    249|            state->mode = DIST;
 1000|    249|            Z_FALLTHROUGH;
  ------------------
  |  |   45|    249|#    define Z_FALLTHROUGH __attribute__((__fallthrough__))
  ------------------
 1001|       |
 1002|    250|        case DIST:
  ------------------
  |  Branch (1002:9): [True: 1, False: 1.52k]
  ------------------
 1003|       |            /* get distance code */
 1004|    400|            for (;;) {
 1005|    400|                here = state->distcode[BITS(state->distbits)];
  ------------------
  |  |  114|    400|    (hold & ((1U << (unsigned)(n)) - 1))
  ------------------
 1006|    400|                if (here.bits <= bits)
  ------------------
  |  Branch (1006:21): [True: 248, False: 152]
  ------------------
 1007|    248|                    break;
 1008|    152|                PULLBYTE();
  ------------------
  |  |  386|    152|    do { \
  |  |  387|    152|        if (have == 0) goto inf_leave; \
  |  |  ------------------
  |  |  |  Branch (387:13): [True: 2, False: 150]
  |  |  ------------------
  |  |  388|    152|        have--; \
  |  |  389|    150|        hold += ((uint64_t)(*next++) << bits); \
  |  |  390|    150|        bits += 8; \
  |  |  391|    150|    } while (0)
  |  |  ------------------
  |  |  |  Branch (391:14): [Folded, False: 150]
  |  |  ------------------
  ------------------
 1009|    152|            }
 1010|    248|            if ((here.op & 0xf0) == 0) {
  ------------------
  |  Branch (1010:17): [True: 0, False: 248]
  ------------------
 1011|      0|                last = here;
 1012|      0|                for (;;) {
 1013|      0|                    here = state->distcode[last.val + (BITS(last.bits + last.op) >> last.bits)];
  ------------------
  |  |  114|      0|    (hold & ((1U << (unsigned)(n)) - 1))
  ------------------
 1014|      0|                    if ((unsigned)last.bits + (unsigned)here.bits <= bits)
  ------------------
  |  Branch (1014:25): [True: 0, False: 0]
  ------------------
 1015|      0|                        break;
 1016|      0|                    PULLBYTE();
  ------------------
  |  |  386|      0|    do { \
  |  |  387|      0|        if (have == 0) goto inf_leave; \
  |  |  ------------------
  |  |  |  Branch (387:13): [True: 0, False: 0]
  |  |  ------------------
  |  |  388|      0|        have--; \
  |  |  389|      0|        hold += ((uint64_t)(*next++) << bits); \
  |  |  390|      0|        bits += 8; \
  |  |  391|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (391:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1017|      0|                }
 1018|      0|                DROPBITS(last.bits);
  ------------------
  |  |  118|      0|    do { \
  |  |  119|      0|        hold >>= (n); \
  |  |  120|      0|        bits -= (unsigned)(n); \
  |  |  121|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (121:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1019|      0|                state->back += last.bits;
 1020|      0|            }
 1021|    248|            DROPBITS(here.bits);
  ------------------
  |  |  118|    248|    do { \
  |  |  119|    248|        hold >>= (n); \
  |  |  120|    248|        bits -= (unsigned)(n); \
  |  |  121|    248|    } while (0)
  |  |  ------------------
  |  |  |  Branch (121:14): [Folded, False: 248]
  |  |  ------------------
  ------------------
 1022|    248|            state->back += here.bits;
 1023|    248|            if (here.op & 64) {
  ------------------
  |  Branch (1023:17): [True: 1, False: 247]
  ------------------
 1024|      1|                SET_BAD("invalid distance code");
  ------------------
  |  |  132|      1|    do { \
  |  |  133|      1|        state->mode = BAD; \
  |  |  134|      1|        strm->msg = (char *)errmsg; \
  |  |  135|      1|    } while (0)
  |  |  ------------------
  |  |  |  Branch (135:14): [Folded, False: 1]
  |  |  ------------------
  ------------------
 1025|      1|                break;
 1026|      1|            }
 1027|    247|            state->offset = here.val;
 1028|    247|            state->extra = (here.op & MAX_BITS);
  ------------------
  |  |   39|    247|#define MAX_BITS 15
  ------------------
 1029|    247|            state->mode = DISTEXT;
 1030|    247|            Z_FALLTHROUGH;
  ------------------
  |  |   45|    247|#    define Z_FALLTHROUGH __attribute__((__fallthrough__))
  ------------------
 1031|       |
 1032|    248|        case DISTEXT:
  ------------------
  |  Branch (1032:9): [True: 1, False: 1.52k]
  ------------------
 1033|       |            /* get distance extra bits, if any */
 1034|    248|            if (state->extra) {
  ------------------
  |  Branch (1034:17): [True: 122, False: 126]
  ------------------
 1035|    122|                NEEDBITS(state->extra);
  ------------------
  |  |  107|    122|    do { \
  |  |  108|    169|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (108:16): [True: 49, False: 120]
  |  |  ------------------
  |  |  109|    122|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  386|     49|    do { \
  |  |  |  |  387|     49|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (387:13): [True: 2, False: 47]
  |  |  |  |  ------------------
  |  |  |  |  388|     49|        have--; \
  |  |  |  |  389|     47|        hold += ((uint64_t)(*next++) << bits); \
  |  |  |  |  390|     47|        bits += 8; \
  |  |  |  |  391|     47|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (391:14): [Folded, False: 47]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  110|    122|    } while (0)
  |  |  ------------------
  |  |  |  Branch (110:14): [Folded, False: 120]
  |  |  ------------------
  ------------------
 1036|    120|                state->offset += BITS(state->extra);
  ------------------
  |  |  114|    120|    (hold & ((1U << (unsigned)(n)) - 1))
  ------------------
 1037|    120|                DROPBITS(state->extra);
  ------------------
  |  |  118|    120|    do { \
  |  |  119|    120|        hold >>= (n); \
  |  |  120|    120|        bits -= (unsigned)(n); \
  |  |  121|    120|    } while (0)
  |  |  ------------------
  |  |  |  Branch (121:14): [Folded, False: 120]
  |  |  ------------------
  ------------------
 1038|    120|                state->back += state->extra;
 1039|    120|            }
 1040|       |#ifdef INFLATE_STRICT
 1041|       |            if (state->offset > state->dmax) {
 1042|       |                SET_BAD("invalid distance too far back");
 1043|       |                break;
 1044|       |            }
 1045|       |#endif
 1046|    246|            Tracevv((stderr, "inflate:         distance %u\n", state->offset));
 1047|    246|            state->mode = MATCH;
 1048|    246|            Z_FALLTHROUGH;
  ------------------
  |  |   45|    246|#    define Z_FALLTHROUGH __attribute__((__fallthrough__))
  ------------------
 1049|       |
 1050|    261|        case MATCH:
  ------------------
  |  Branch (1050:9): [True: 15, False: 1.51k]
  ------------------
 1051|       |            /* copy match from window to output */
 1052|    261|            if (left == 0)
  ------------------
  |  Branch (1052:17): [True: 16, False: 245]
  ------------------
 1053|     16|                goto inf_leave;
 1054|    245|            copy = out - left;
 1055|    245|            if (state->offset > copy) {         /* copy from window */
  ------------------
  |  Branch (1055:17): [True: 8, False: 237]
  ------------------
 1056|      8|                copy = state->offset - copy;
 1057|      8|                if (copy > state->whave) {
  ------------------
  |  Branch (1057:21): [True: 8, False: 0]
  ------------------
 1058|       |#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR
 1059|       |                    if (state->sane) {
 1060|       |                        SET_BAD("invalid distance too far back");
 1061|       |                        break;
 1062|       |                    }
 1063|       |                    Trace((stderr, "inflate.c too far\n"));
 1064|       |                    copy -= state->whave;
 1065|       |                    copy = MIN(copy, state->length);
 1066|       |                    copy = MIN(copy, left);
 1067|       |                    left -= copy;
 1068|       |                    state->length -= copy;
 1069|       |                    do {
 1070|       |                        *put++ = 0;
 1071|       |                    } while (--copy);
 1072|       |                    if (state->length == 0)
 1073|       |                        state->mode = LEN;
 1074|       |#else
 1075|      8|                    SET_BAD("invalid distance too far back");
  ------------------
  |  |  132|      8|    do { \
  |  |  133|      8|        state->mode = BAD; \
  |  |  134|      8|        strm->msg = (char *)errmsg; \
  |  |  135|      8|    } while (0)
  |  |  ------------------
  |  |  |  Branch (135:14): [Folded, False: 8]
  |  |  ------------------
  ------------------
 1076|      8|#endif
 1077|      8|                    break;
 1078|      8|                }
 1079|      0|                if (copy > state->wnext) {
  ------------------
  |  Branch (1079:21): [True: 0, False: 0]
  ------------------
 1080|      0|                    copy -= state->wnext;
 1081|      0|                    from = state->window + (state->wsize - copy);
 1082|      0|                } else {
 1083|      0|                    from = state->window + (state->wnext - copy);
 1084|      0|                }
 1085|      0|                copy = MIN(copy, state->length);
  ------------------
  |  |  124|      0|#define MIN(a, b) ((a) > (b) ? (b) : (a))
  |  |  ------------------
  |  |  |  Branch (124:20): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1086|      0|                copy = MIN(copy, left);
  ------------------
  |  |  124|      0|#define MIN(a, b) ((a) > (b) ? (b) : (a))
  |  |  ------------------
  |  |  |  Branch (124:20): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1087|       |
 1088|      0|                put = chunkcopy_safe(put, from, copy, put + left);
 1089|    237|            } else {
 1090|    237|                copy = MIN(state->length, left);
  ------------------
  |  |  124|    237|#define MIN(a, b) ((a) > (b) ? (b) : (a))
  |  |  ------------------
  |  |  |  Branch (124:20): [True: 7, False: 230]
  |  |  ------------------
  ------------------
 1091|       |
 1092|    237|                put = FUNCTABLE_CALL(chunkmemset_safe)(put, put - state->offset, copy, left);
  ------------------
  |  |   49|    237|#  define FUNCTABLE_CALL(name) functable.name
  ------------------
 1093|    237|            }
 1094|    237|            left -= copy;
 1095|    237|            state->length -= copy;
 1096|    237|            if (state->length == 0)
  ------------------
  |  Branch (1096:17): [True: 230, False: 7]
  ------------------
 1097|    230|                state->mode = LEN;
 1098|    237|            break;
 1099|       |
 1100|    286|        case LIT:
  ------------------
  |  Branch (1100:9): [True: 286, False: 1.24k]
  ------------------
 1101|    286|            if (left == 0)
  ------------------
  |  Branch (1101:17): [True: 0, False: 286]
  ------------------
 1102|      0|                goto inf_leave;
 1103|    286|            *put++ = (unsigned char)(state->length);
 1104|    286|            left--;
 1105|    286|            state->mode = LEN;
 1106|    286|            break;
 1107|       |
 1108|     67|        case CHECK:
  ------------------
  |  Branch (1108:9): [True: 67, False: 1.45k]
  ------------------
 1109|     67|            if (state->wrap) {
  ------------------
  |  Branch (1109:17): [True: 67, False: 0]
  ------------------
 1110|     67|                NEEDBITS(32);
  ------------------
  |  |  107|     67|    do { \
  |  |  108|    136|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (108:16): [True: 119, False: 17]
  |  |  ------------------
  |  |  109|    119|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  386|    119|    do { \
  |  |  |  |  387|    119|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (387:13): [True: 50, False: 69]
  |  |  |  |  ------------------
  |  |  |  |  388|    119|        have--; \
  |  |  |  |  389|     69|        hold += ((uint64_t)(*next++) << bits); \
  |  |  |  |  390|     69|        bits += 8; \
  |  |  |  |  391|     69|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (391:14): [Folded, False: 69]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  110|     67|    } while (0)
  |  |  ------------------
  |  |  |  Branch (110:14): [Folded, False: 17]
  |  |  ------------------
  ------------------
 1111|     17|                out -= left;
 1112|     17|                strm->total_out += out;
 1113|     17|                state->total += out;
 1114|       |
 1115|       |                /* compute crc32 checksum if not in raw mode */
 1116|     17|                if (INFLATE_NEED_CHECKSUM(strm) && state->wrap & 4) {
  ------------------
  |  |   31|     34|#  define INFLATE_NEED_CHECKSUM(strm) 1
  |  |  ------------------
  |  |  |  Branch (31:39): [True: 17, Folded]
  |  |  ------------------
  ------------------
  |  Branch (1116:52): [True: 17, False: 0]
  ------------------
 1117|     17|                    if (out) {
  ------------------
  |  Branch (1117:25): [True: 16, False: 1]
  ------------------
 1118|     16|                        inf_chksum(strm, put - out, out);
 1119|     16|                    }
 1120|     17|#ifdef GUNZIP
 1121|     17|                    if (state->flags)
  ------------------
  |  Branch (1121:25): [True: 0, False: 17]
  ------------------
 1122|      0|                        strm->adler = state->check = FUNCTABLE_CALL(crc32_fold_final)(&state->crc_fold);
  ------------------
  |  |   49|      0|#  define FUNCTABLE_CALL(name) functable.name
  ------------------
 1123|     17|#endif
 1124|     17|                }
 1125|     17|                out = left;
 1126|     17|                if ((state->wrap & 4) && (
  ------------------
  |  Branch (1126:21): [True: 17, False: 0]
  |  Branch (1126:42): [True: 16, False: 1]
  ------------------
 1127|     17|#ifdef GUNZIP
 1128|     17|                     state->flags ? hold :
  ------------------
  |  Branch (1128:22): [True: 0, False: 17]
  ------------------
 1129|     17|#endif
 1130|     17|                     ZSWAP32((unsigned)hold)) != state->check) {
  ------------------
  |  |  170|     17|#  define ZSWAP32(q) __builtin_bswap32(q)
  ------------------
 1131|     16|                    SET_BAD("incorrect data check");
  ------------------
  |  |  132|     16|    do { \
  |  |  133|     16|        state->mode = BAD; \
  |  |  134|     16|        strm->msg = (char *)errmsg; \
  |  |  135|     16|    } while (0)
  |  |  ------------------
  |  |  |  Branch (135:14): [Folded, False: 16]
  |  |  ------------------
  ------------------
 1132|     16|                    break;
 1133|     16|                }
 1134|      1|                INITBITS();
  ------------------
  |  |   99|      1|    do { \
  |  |  100|      1|        hold = 0; \
  |  |  101|      1|        bits = 0; \
  |  |  102|      1|    } while (0)
  |  |  ------------------
  |  |  |  Branch (102:14): [Folded, False: 1]
  |  |  ------------------
  ------------------
 1135|      1|                Tracev((stderr, "inflate:   check matches trailer\n"));
 1136|      1|            }
 1137|      1|#ifdef GUNZIP
 1138|      1|            state->mode = LENGTH;
 1139|      1|            Z_FALLTHROUGH;
  ------------------
  |  |   45|      1|#    define Z_FALLTHROUGH __attribute__((__fallthrough__))
  ------------------
 1140|       |
 1141|      1|        case LENGTH:
  ------------------
  |  Branch (1141:9): [True: 0, False: 1.52k]
  ------------------
 1142|      1|            if (state->wrap && state->flags) {
  ------------------
  |  Branch (1142:17): [True: 1, False: 0]
  |  Branch (1142:32): [True: 0, False: 1]
  ------------------
 1143|      0|                NEEDBITS(32);
  ------------------
  |  |  107|      0|    do { \
  |  |  108|      0|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (108:16): [True: 0, False: 0]
  |  |  ------------------
  |  |  109|      0|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  386|      0|    do { \
  |  |  |  |  387|      0|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (387:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  388|      0|        have--; \
  |  |  |  |  389|      0|        hold += ((uint64_t)(*next++) << bits); \
  |  |  |  |  390|      0|        bits += 8; \
  |  |  |  |  391|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (391:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  110|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (110:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1144|      0|                if ((state->wrap & 4) && hold != (state->total & 0xffffffff)) {
  ------------------
  |  Branch (1144:21): [True: 0, False: 0]
  |  Branch (1144:42): [True: 0, False: 0]
  ------------------
 1145|      0|                    SET_BAD("incorrect length check");
  ------------------
  |  |  132|      0|    do { \
  |  |  133|      0|        state->mode = BAD; \
  |  |  134|      0|        strm->msg = (char *)errmsg; \
  |  |  135|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (135:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1146|      0|                    break;
 1147|      0|                }
 1148|      0|                INITBITS();
  ------------------
  |  |   99|      0|    do { \
  |  |  100|      0|        hold = 0; \
  |  |  101|      0|        bits = 0; \
  |  |  102|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (102:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1149|      0|                Tracev((stderr, "inflate:   length matches trailer\n"));
 1150|      0|            }
 1151|      1|#endif
 1152|      1|            state->mode = DONE;
 1153|      1|            Z_FALLTHROUGH;
  ------------------
  |  |   45|      1|#    define Z_FALLTHROUGH __attribute__((__fallthrough__))
  ------------------
 1154|       |
 1155|      1|        case DONE:
  ------------------
  |  Branch (1155:9): [True: 0, False: 1.52k]
  ------------------
 1156|       |            /* inflate stream terminated properly */
 1157|      1|            ret = Z_STREAM_END;
  ------------------
  |  |  181|      1|#define Z_STREAM_END    1
  ------------------
 1158|      1|            goto inf_leave;
 1159|       |
 1160|     66|        case BAD:
  ------------------
  |  Branch (1160:9): [True: 66, False: 1.46k]
  ------------------
 1161|     66|            ret = Z_DATA_ERROR;
  ------------------
  |  |  185|     66|#define Z_DATA_ERROR   (-3)
  ------------------
 1162|     66|            goto inf_leave;
 1163|       |
 1164|      0|        case SYNC:
  ------------------
  |  Branch (1164:9): [True: 0, False: 1.52k]
  ------------------
 1165|       |
 1166|      0|        default:                 /* can't happen, but makes compilers happy */
  ------------------
  |  Branch (1166:9): [True: 0, False: 1.52k]
  ------------------
 1167|      0|            return Z_STREAM_ERROR;
  ------------------
  |  |  184|      0|#define Z_STREAM_ERROR (-2)
  ------------------
 1168|  1.52k|        }
 1169|       |
 1170|       |    /*
 1171|       |       Return from inflate(), updating the total counts and the check value.
 1172|       |       If there was no progress during the inflate() call, return a buffer
 1173|       |       error.  Call updatewindow() to create and/or update the window state.
 1174|       |     */
 1175|    229|  inf_leave:
 1176|    229|    RESTORE();
  ------------------
  |  |   88|    229|    do { \
  |  |   89|    229|        strm->next_out = put; \
  |  |   90|    229|        strm->avail_out = left; \
  |  |   91|    229|        strm->next_in = (z_const unsigned char *)next; \
  |  |   92|    229|        strm->avail_in = have; \
  |  |   93|    229|        state->hold = hold; \
  |  |   94|    229|        state->bits = bits; \
  |  |   95|    229|    } while (0)
  |  |  ------------------
  |  |  |  Branch (95:14): [Folded, False: 229]
  |  |  ------------------
  ------------------
 1177|    229|    uint32_t check_bytes = out - strm->avail_out;
 1178|    229|    if (INFLATE_NEED_UPDATEWINDOW(strm) &&
  ------------------
  |  |   33|    458|#  define INFLATE_NEED_UPDATEWINDOW(strm) 1
  |  |  ------------------
  |  |  |  Branch (33:43): [True: 229, Folded]
  |  |  ------------------
  ------------------
 1179|    229|            (state->wsize || (out != strm->avail_out && state->mode < BAD &&
  ------------------
  |  Branch (1179:14): [True: 57, False: 172]
  |  Branch (1179:31): [True: 69, False: 103]
  |  Branch (1179:57): [True: 57, False: 12]
  ------------------
 1180|    114|                 (state->mode < CHECK || flush != Z_FINISH)))) {
  ------------------
  |  |  175|     25|#define Z_FINISH        4
  ------------------
  |  Branch (1180:19): [True: 32, False: 25]
  |  Branch (1180:42): [True: 25, False: 0]
  ------------------
 1181|       |        /* update sliding window with respective checksum if not in "raw" mode */
 1182|    114|        updatewindow(strm, strm->next_out, check_bytes, state->wrap & 4);
 1183|    114|    }
 1184|    229|    in -= strm->avail_in;
 1185|    229|    out -= strm->avail_out;
 1186|    229|    strm->total_in += in;
 1187|    229|    strm->total_out += out;
 1188|    229|    state->total += out;
 1189|       |
 1190|    229|    strm->data_type = (int)state->bits + (state->last ? 64 : 0) +
  ------------------
  |  Branch (1190:43): [True: 146, False: 83]
  ------------------
 1191|    229|                      (state->mode == TYPE ? 128 : 0) + (state->mode == LEN_ || state->mode == COPY_ ? 256 : 0);
  ------------------
  |  Branch (1191:24): [True: 0, False: 229]
  |  Branch (1191:58): [True: 0, False: 229]
  |  Branch (1191:81): [True: 0, False: 229]
  ------------------
 1192|    229|    if (((in == 0 && out == 0) || flush == Z_FINISH) && ret == Z_OK) {
  ------------------
  |  |  175|    148|#define Z_FINISH        4
  ------------------
                  if (((in == 0 && out == 0) || flush == Z_FINISH) && ret == Z_OK) {
  ------------------
  |  |  180|     81|#define Z_OK            0
  ------------------
  |  Branch (1192:11): [True: 81, False: 148]
  |  Branch (1192:22): [True: 81, False: 0]
  |  Branch (1192:35): [True: 0, False: 148]
  |  Branch (1192:57): [True: 81, False: 0]
  ------------------
 1193|       |        /* when no sliding window is used, hash the output bytes if no CHECK state */
 1194|     81|        if (INFLATE_NEED_CHECKSUM(strm) && !state->wsize && flush == Z_FINISH) {
  ------------------
  |  |   31|    162|#  define INFLATE_NEED_CHECKSUM(strm) 1
  |  |  ------------------
  |  |  |  Branch (31:39): [True: 81, Folded]
  |  |  ------------------
  ------------------
                      if (INFLATE_NEED_CHECKSUM(strm) && !state->wsize && flush == Z_FINISH) {
  ------------------
  |  |  175|     24|#define Z_FINISH        4
  ------------------
  |  Branch (1194:44): [True: 24, False: 57]
  |  Branch (1194:61): [True: 0, False: 24]
  ------------------
 1195|      0|            inf_chksum(strm, put - check_bytes, check_bytes);
 1196|      0|        }
 1197|     81|        ret = Z_BUF_ERROR;
  ------------------
  |  |  187|     81|#define Z_BUF_ERROR    (-5)
  ------------------
 1198|     81|    }
 1199|    229|    return ret;
 1200|    230|}
zng_inflateEnd:
 1202|    149|int32_t Z_EXPORT PREFIX(inflateEnd)(PREFIX3(stream) *strm) {
 1203|    149|    if (inflateStateCheck(strm))
  ------------------
  |  Branch (1203:9): [True: 0, False: 149]
  ------------------
 1204|      0|        return Z_STREAM_ERROR;
  ------------------
  |  |  184|      0|#define Z_STREAM_ERROR (-2)
  ------------------
 1205|       |
 1206|       |    /* Free allocated buffers */
 1207|    149|    free_inflate(strm);
 1208|       |
 1209|    149|    Tracev((stderr, "inflate: end\n"));
 1210|    149|    return Z_OK;
  ------------------
  |  |  180|    149|#define Z_OK            0
  ------------------
 1211|    149|}
inflate.c:inflateStateCheck:
   51|    826|static int inflateStateCheck(PREFIX3(stream) *strm) {
   52|    826|    struct inflate_state *state;
   53|    826|    if (strm == NULL || strm->zalloc == NULL || strm->zfree == NULL)
  ------------------
  |  Branch (53:9): [True: 0, False: 826]
  |  Branch (53:25): [True: 0, False: 826]
  |  Branch (53:49): [True: 0, False: 826]
  ------------------
   54|      0|        return 1;
   55|    826|    state = (struct inflate_state *)strm->state;
   56|    826|    if (state == NULL || state->alloc_bufs == NULL || state->strm != strm || state->mode < HEAD || state->mode > SYNC)
  ------------------
  |  Branch (56:9): [True: 0, False: 826]
  |  Branch (56:26): [True: 0, False: 826]
  |  Branch (56:55): [True: 0, False: 826]
  |  Branch (56:78): [True: 0, False: 826]
  |  Branch (56:100): [True: 0, False: 826]
  ------------------
   57|      0|        return 1;
   58|    826|    return 0;
   59|    826|}
inflate.c:inf_chksum:
   39|     16|static inline void inf_chksum(PREFIX3(stream) *strm, const uint8_t *src, uint32_t len) {
   40|     16|    struct inflate_state *state = (struct inflate_state*)strm->state;
   41|     16|#ifdef GUNZIP
   42|     16|    if (state->flags) {
  ------------------
  |  Branch (42:9): [True: 0, False: 16]
  ------------------
   43|      0|        FUNCTABLE_CALL(crc32_fold)(&state->crc_fold, src, len, 0);
  ------------------
  |  |   49|      0|#  define FUNCTABLE_CALL(name) functable.name
  ------------------
   44|      0|    } else
   45|     16|#endif
   46|     16|    {
   47|     16|        strm->adler = state->check = FUNCTABLE_CALL(adler32)(state->check, src, len);
  ------------------
  |  |   49|     16|#  define FUNCTABLE_CALL(name) functable.name
  ------------------
   48|     16|    }
   49|     16|}
inflate.c:updatewindow:
  324|    114|static void updatewindow(PREFIX3(stream) *strm, const uint8_t *end, uint32_t len, int32_t cksum) {
  325|    114|    struct inflate_state *state;
  326|    114|    uint32_t dist;
  327|       |
  328|    114|    state = (struct inflate_state *)strm->state;
  329|       |
  330|       |    /* if window not in use yet, initialize */
  331|    114|    if (state->wsize == 0)
  ------------------
  |  Branch (331:9): [True: 57, False: 57]
  ------------------
  332|     57|        state->wsize = 1U << state->wbits;
  333|       |
  334|       |    /* len state->wsize or less output bytes into the circular window */
  335|    114|    if (len >= state->wsize) {
  ------------------
  |  Branch (335:9): [True: 0, False: 114]
  ------------------
  336|       |        /* Only do this if the caller specifies to checksum bytes AND the platform requires
  337|       |         * it (s/390 being the primary exception to this) */
  338|      0|        if (INFLATE_NEED_CHECKSUM(strm) && cksum) {
  ------------------
  |  |   31|      0|#  define INFLATE_NEED_CHECKSUM(strm) 1
  |  |  ------------------
  |  |  |  Branch (31:39): [True: 0, Folded]
  |  |  ------------------
  ------------------
  |  Branch (338:44): [True: 0, False: 0]
  ------------------
  339|       |            /* We have to split the checksum over non-copied and copied bytes */
  340|      0|            if (len > state->wsize)
  ------------------
  |  Branch (340:17): [True: 0, False: 0]
  ------------------
  341|      0|                inf_chksum(strm, end - len, len - state->wsize);
  342|      0|            inf_chksum_cpy(strm, state->window, end - state->wsize, state->wsize);
  343|      0|        } else {
  344|      0|            memcpy(state->window, end - state->wsize, state->wsize);
  345|      0|        }
  346|       |
  347|      0|        state->wnext = 0;
  348|      0|        state->whave = state->wsize;
  349|    114|    } else {
  350|    114|        dist = state->wsize - state->wnext;
  351|       |        /* Only do this if the caller specifies to checksum bytes AND the platform requires
  352|       |         * We need to maintain the correct order here for the checksum */
  353|    114|        dist = MIN(dist, len);
  ------------------
  |  |  124|    114|#define MIN(a, b) ((a) > (b) ? (b) : (a))
  |  |  ------------------
  |  |  |  Branch (124:20): [True: 114, False: 0]
  |  |  ------------------
  ------------------
  354|    114|        if (INFLATE_NEED_CHECKSUM(strm) && cksum) {
  ------------------
  |  |   31|    228|#  define INFLATE_NEED_CHECKSUM(strm) 1
  |  |  ------------------
  |  |  |  Branch (31:39): [True: 114, Folded]
  |  |  ------------------
  ------------------
  |  Branch (354:44): [True: 114, False: 0]
  ------------------
  355|    114|            inf_chksum_cpy(strm, state->window + state->wnext, end - len, dist);
  356|    114|        } else {
  357|      0|            memcpy(state->window + state->wnext, end - len, dist);
  358|      0|        }
  359|    114|        len -= dist;
  360|    114|        if (len) {
  ------------------
  |  Branch (360:13): [True: 0, False: 114]
  ------------------
  361|      0|            if (INFLATE_NEED_CHECKSUM(strm) && cksum) {
  ------------------
  |  |   31|      0|#  define INFLATE_NEED_CHECKSUM(strm) 1
  |  |  ------------------
  |  |  |  Branch (31:39): [True: 0, Folded]
  |  |  ------------------
  ------------------
  |  Branch (361:48): [True: 0, False: 0]
  ------------------
  362|      0|                inf_chksum_cpy(strm, state->window, end - len, len);
  363|      0|            } else {
  364|      0|                memcpy(state->window, end - len, len);
  365|      0|            }
  366|       |
  367|      0|            state->wnext = len;
  368|      0|            state->whave = state->wsize;
  369|    114|        } else {
  370|    114|            state->wnext += dist;
  371|    114|            if (state->wnext == state->wsize)
  ------------------
  |  Branch (371:17): [True: 0, False: 114]
  ------------------
  372|      0|                state->wnext = 0;
  373|    114|            if (state->whave < state->wsize)
  ------------------
  |  Branch (373:17): [True: 114, False: 0]
  ------------------
  374|    114|                state->whave += dist;
  375|    114|        }
  376|    114|    }
  377|    114|}
inflate.c:inf_chksum_cpy:
   26|    114|                           const uint8_t *src, uint32_t copy) {
   27|    114|    if (!copy) return;
  ------------------
  |  Branch (27:9): [True: 57, False: 57]
  ------------------
   28|     57|    struct inflate_state *state = (struct inflate_state*)strm->state;
   29|     57|#ifdef GUNZIP
   30|     57|    if (state->flags) {
  ------------------
  |  Branch (30:9): [True: 0, False: 57]
  ------------------
   31|      0|        FUNCTABLE_CALL(crc32_fold_copy)(&state->crc_fold, dst, src, copy);
  ------------------
  |  |   49|      0|#  define FUNCTABLE_CALL(name) functable.name
  ------------------
   32|      0|    } else
   33|     57|#endif
   34|     57|    {
   35|     57|        strm->adler = state->check = FUNCTABLE_CALL(adler32_fold_copy)(state->check, dst, src, copy);
  ------------------
  |  |   49|     57|#  define FUNCTABLE_CALL(name) functable.name
  ------------------
   36|     57|    }
   37|     57|}

zng_inflate_table:
   31|     58|                                code * *table, unsigned *bits, uint16_t *work) {
   32|     58|    unsigned len;               /* a code's length in bits */
   33|     58|    unsigned sym;               /* index of code symbols */
   34|     58|    unsigned min, max;          /* minimum and maximum code lengths */
   35|     58|    unsigned root;              /* number of index bits for root table */
   36|     58|    unsigned curr;              /* number of index bits for current table */
   37|     58|    unsigned drop;              /* code bits to drop for sub-table */
   38|     58|    int left;                   /* number of prefix codes available */
   39|     58|    unsigned used;              /* code entries in table used */
   40|     58|    unsigned huff;              /* Huffman code */
   41|     58|    unsigned incr;              /* for incrementing code, index */
   42|     58|    unsigned fill;              /* index for replicating entries */
   43|     58|    unsigned low;               /* low bits for current root entry */
   44|     58|    unsigned mask;              /* mask for low root bits */
   45|     58|    code here;                  /* table entry for duplication */
   46|     58|    code *next;                 /* next available space in table */
   47|     58|    const uint16_t *base;       /* base value table to use */
   48|     58|    const uint16_t *extra;      /* extra bits table to use */
   49|     58|    unsigned match;             /* use base and extra for symbol >= match */
   50|     58|    uint16_t count[MAX_BITS+1];  /* number of codes of each length */
   51|     58|    uint16_t offs[MAX_BITS+1];   /* offsets in table for each length */
   52|     58|    static const uint16_t lbase[31] = { /* Length codes 257..285 base */
   53|     58|        3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31,
   54|     58|        35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0};
   55|     58|    static const uint16_t lext[31] = { /* Length codes 257..285 extra */
   56|     58|        16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18,
   57|     58|        19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 203, 77};
   58|     58|    static const uint16_t dbase[32] = { /* Distance codes 0..29 base */
   59|     58|        1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,
   60|     58|        257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,
   61|     58|        8193, 12289, 16385, 24577, 0, 0};
   62|     58|    static const uint16_t dext[32] = { /* Distance codes 0..29 extra */
   63|     58|        16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22,
   64|     58|        23, 23, 24, 24, 25, 25, 26, 26, 27, 27,
   65|     58|        28, 28, 29, 29, 64, 64};
   66|       |
   67|       |    /*
   68|       |       Process a set of code lengths to create a canonical Huffman code.  The
   69|       |       code lengths are lens[0..codes-1].  Each length corresponds to the
   70|       |       symbols 0..codes-1.  The Huffman code is generated by first sorting the
   71|       |       symbols by length from short to long, and retaining the symbol order
   72|       |       for codes with equal lengths.  Then the code starts with all zero bits
   73|       |       for the first code of the shortest length, and the codes are integer
   74|       |       increments for the same length, and zeros are appended as the length
   75|       |       increases.  For the deflate format, these bits are stored backwards
   76|       |       from their more natural integer increment ordering, and so when the
   77|       |       decoding tables are built in the large loop below, the integer codes
   78|       |       are incremented backwards.
   79|       |
   80|       |       This routine assumes, but does not check, that all of the entries in
   81|       |       lens[] are in the range 0..MAXBITS.  The caller must assure this.
   82|       |       1..MAXBITS is interpreted as that code length.  zero means that that
   83|       |       symbol does not occur in this code.
   84|       |
   85|       |       The codes are sorted by computing a count of codes for each length,
   86|       |       creating from that a table of starting indices for each length in the
   87|       |       sorted table, and then entering the symbols in order in the sorted
   88|       |       table.  The sorted table is work[], with that space being provided by
   89|       |       the caller.
   90|       |
   91|       |       The length counts are used for other purposes as well, i.e. finding
   92|       |       the minimum and maximum length codes, determining if there are any
   93|       |       codes at all, checking for a valid set of lengths, and looking ahead
   94|       |       at length counts to determine sub-table sizes when building the
   95|       |       decoding tables.
   96|       |     */
   97|       |
   98|       |    /* accumulate lengths for codes (assumes lens[] all in 0..MAXBITS) */
   99|    986|    for (len = 0; len <= MAX_BITS; len++)
  ------------------
  |  |   39|    986|#define MAX_BITS 15
  ------------------
  |  Branch (99:19): [True: 928, False: 58]
  ------------------
  100|    928|        count[len] = 0;
  101|  2.37k|    for (sym = 0; sym < codes; sym++)
  ------------------
  |  Branch (101:19): [True: 2.31k, False: 58]
  ------------------
  102|  2.31k|        count[lens[sym]]++;
  103|       |
  104|       |    /* bound code lengths, force root to be within code lengths */
  105|     58|    root = *bits;
  106|    644|    for (max = MAX_BITS; max >= 1; max--)
  ------------------
  |  |   39|     58|#define MAX_BITS 15
  ------------------
  |  Branch (106:26): [True: 642, False: 2]
  ------------------
  107|    642|        if (count[max] != 0) break;
  ------------------
  |  Branch (107:13): [True: 56, False: 586]
  ------------------
  108|     58|    root = MIN(root, max);
  ------------------
  |  |  124|     58|#define MIN(a, b) ((a) > (b) ? (b) : (a))
  |  |  ------------------
  |  |  |  Branch (124:20): [True: 36, False: 22]
  |  |  ------------------
  ------------------
  109|     58|    if (UNLIKELY(max == 0)) {           /* no symbols to code at all */
  ------------------
  |  |  214|     58|#  define UNLIKELY(x)           __builtin_expect(!!(x), 0)
  |  |  ------------------
  |  |  |  Branch (214:33): [True: 2, False: 56]
  |  |  ------------------
  ------------------
  110|      2|        here.op = (unsigned char)64;    /* invalid code marker */
  111|      2|        here.bits = (unsigned char)1;
  112|      2|        here.val = (uint16_t)0;
  113|      2|        *(*table)++ = here;             /* make a table to force an error */
  114|      2|        *(*table)++ = here;
  115|      2|        *bits = 1;
  116|      2|        return 0;     /* no symbols, but wait for decoding to report error */
  117|      2|    }
  118|     98|    for (min = 1; min < max; min++)
  ------------------
  |  Branch (118:19): [True: 95, False: 3]
  ------------------
  119|     95|        if (count[min] != 0) break;
  ------------------
  |  Branch (119:13): [True: 53, False: 42]
  ------------------
  120|     56|    root = MAX(root, min);
  ------------------
  |  |  126|     56|#define MAX(a, b) ((a) < (b) ? (b) : (a))
  |  |  ------------------
  |  |  |  Branch (126:20): [True: 0, False: 56]
  |  |  ------------------
  ------------------
  121|       |
  122|       |    /* check for an over-subscribed or incomplete set of lengths */
  123|     56|    left = 1;
  124|    743|    for (len = 1; len <= MAX_BITS; len++) {
  ------------------
  |  |   39|    743|#define MAX_BITS 15
  ------------------
  |  Branch (124:19): [True: 700, False: 43]
  ------------------
  125|    700|        left <<= 1;
  126|    700|        left -= count[len];
  127|    700|        if (left < 0) return -1;        /* over-subscribed */
  ------------------
  |  Branch (127:13): [True: 13, False: 687]
  ------------------
  128|    700|    }
  129|     43|    if (left > 0 && (type == CODES || max != 1))
  ------------------
  |  Branch (129:9): [True: 9, False: 34]
  |  Branch (129:22): [True: 4, False: 5]
  |  Branch (129:39): [True: 5, False: 0]
  ------------------
  130|      9|        return -1;                      /* incomplete set */
  131|       |
  132|       |    /* generate offsets into symbol table for each length for sorting */
  133|     34|    offs[1] = 0;
  134|    510|    for (len = 1; len < MAX_BITS; len++)
  ------------------
  |  |   39|    510|#define MAX_BITS 15
  ------------------
  |  Branch (134:19): [True: 476, False: 34]
  ------------------
  135|    476|        offs[len + 1] = offs[len] + count[len];
  136|       |
  137|       |    /* sort symbols by length, by symbol order within each length */
  138|    680|    for (sym = 0; sym < codes; sym++)
  ------------------
  |  Branch (138:19): [True: 646, False: 34]
  ------------------
  139|    646|        if (lens[sym] != 0) work[offs[lens[sym]]++] = (uint16_t)sym;
  ------------------
  |  Branch (139:13): [True: 195, False: 451]
  ------------------
  140|       |
  141|       |    /*
  142|       |       Create and fill in decoding tables.  In this loop, the table being
  143|       |       filled is at next and has curr index bits.  The code being used is huff
  144|       |       with length len.  That code is converted to an index by dropping drop
  145|       |       bits off of the bottom.  For codes where len is less than drop + curr,
  146|       |       those top drop + curr - len bits are incremented through all values to
  147|       |       fill the table with replicated entries.
  148|       |
  149|       |       root is the number of index bits for the root table.  When len exceeds
  150|       |       root, sub-tables are created pointed to by the root entry with an index
  151|       |       of the low root bits of huff.  This is saved in low to check for when a
  152|       |       new sub-table should be started.  drop is zero when the root table is
  153|       |       being filled, and drop is root when sub-tables are being filled.
  154|       |
  155|       |       When a new sub-table is needed, it is necessary to look ahead in the
  156|       |       code lengths to determine what size sub-table is needed.  The length
  157|       |       counts are used for this, and so count[] is decremented as codes are
  158|       |       entered in the tables.
  159|       |
  160|       |       used keeps track of how many table entries have been allocated from the
  161|       |       provided *table space.  It is checked for LENS and DIST tables against
  162|       |       the constants ENOUGH_LENS and ENOUGH_DISTS to guard against changes in
  163|       |       the initial root table size constants.  See the comments in inftrees.h
  164|       |       for more information.
  165|       |
  166|       |       sym increments through all symbols, and the loop terminates when
  167|       |       all codes of length max, i.e. all codes, have been processed.  This
  168|       |       routine permits incomplete codes, so another loop after this one fills
  169|       |       in the rest of the decoding tables with invalid code markers.
  170|       |     */
  171|       |
  172|       |    /* set up for code type */
  173|     34|    switch (type) {
  174|     34|    case CODES:
  ------------------
  |  Branch (174:5): [True: 34, False: 0]
  ------------------
  175|     34|        base = extra = work;    /* dummy value--not used */
  176|     34|        match = 20;
  177|     34|        break;
  178|      0|    case LENS:
  ------------------
  |  Branch (178:5): [True: 0, False: 34]
  ------------------
  179|      0|        base = lbase;
  180|      0|        extra = lext;
  181|      0|        match = 257;
  182|      0|        break;
  183|      0|    default:    /* DISTS */
  ------------------
  |  Branch (183:5): [True: 0, False: 34]
  ------------------
  184|      0|        base = dbase;
  185|      0|        extra = dext;
  186|      0|        match = 0;
  187|     34|    }
  188|       |
  189|       |    /* initialize state for loop */
  190|     34|    huff = 0;                   /* starting code */
  191|     34|    sym = 0;                    /* starting code symbol */
  192|     34|    len = min;                  /* starting code length */
  193|     34|    next = *table;              /* current table to fill in */
  194|     34|    curr = root;                /* current table index bits */
  195|     34|    drop = 0;                   /* current bits to drop from code for index */
  196|     34|    low = (unsigned)(-1);       /* trigger new sub-table when len > root */
  197|     34|    used = 1U << root;          /* use root table entries */
  198|     34|    mask = used - 1;            /* mask for comparing low */
  199|       |
  200|       |    /* check available table space */
  201|     34|    if ((type == LENS && used > ENOUGH_LENS) ||
  ------------------
  |  |   52|      0|#define ENOUGH_LENS 1332
  ------------------
  |  Branch (201:10): [True: 0, False: 34]
  |  Branch (201:26): [True: 0, False: 0]
  ------------------
  202|     34|        (type == DISTS && used > ENOUGH_DISTS))
  ------------------
  |  |   53|      0|#define ENOUGH_DISTS 592
  ------------------
  |  Branch (202:10): [True: 0, False: 34]
  |  Branch (202:27): [True: 0, False: 0]
  ------------------
  203|      0|        return 1;
  204|       |
  205|       |    /* process all codes and make table entries */
  206|    195|    for (;;) {
  207|       |        /* create table entry */
  208|    195|        here.bits = (unsigned char)(len - drop);
  209|    195|        if (LIKELY(work[sym] >= match)) {
  ------------------
  |  |  213|    195|#  define LIKELY(x)             __builtin_expect(!!(x), 1)
  |  |  ------------------
  |  |  |  Branch (213:33): [True: 0, False: 195]
  |  |  ------------------
  ------------------
  210|      0|            here.op = (unsigned char)(extra[work[sym] - match]);
  211|      0|            here.val = base[work[sym] - match];
  212|    195|        } else if (work[sym] + 1U < match) {
  ------------------
  |  Branch (212:20): [True: 195, False: 0]
  ------------------
  213|    195|            here.op = (unsigned char)0;
  214|    195|            here.val = work[sym];
  215|    195|        } else {
  216|      0|            here.op = (unsigned char)(32 + 64);         /* end of block */
  217|      0|            here.val = 0;
  218|      0|        }
  219|       |
  220|       |        /* replicate for those indices with low len bits equal to huff */
  221|    195|        incr = 1U << (len - drop);
  222|    195|        fill = 1U << curr;
  223|    195|        min = fill;                 /* save offset to next table */
  224|  1.36k|        do {
  225|  1.36k|            fill -= incr;
  226|  1.36k|            next[(huff >> drop) + fill] = here;
  227|  1.36k|        } while (fill != 0);
  ------------------
  |  Branch (227:18): [True: 1.17k, False: 195]
  ------------------
  228|       |
  229|       |        /* backwards increment the len-bit code huff */
  230|    195|        incr = 1U << (len - 1);
  231|    356|        while (huff & incr)
  ------------------
  |  Branch (231:16): [True: 161, False: 195]
  ------------------
  232|    161|            incr >>= 1;
  233|    195|        if (incr != 0) {
  ------------------
  |  Branch (233:13): [True: 161, False: 34]
  ------------------
  234|    161|            huff &= incr - 1;
  235|    161|            huff += incr;
  236|    161|        } else {
  237|     34|            huff = 0;
  238|     34|        }
  239|       |
  240|       |        /* go to next symbol, update count, len */
  241|    195|        sym++;
  242|    195|        if (--(count[len]) == 0) {
  ------------------
  |  Branch (242:13): [True: 118, False: 77]
  ------------------
  243|    118|            if (len == max)
  ------------------
  |  Branch (243:17): [True: 34, False: 84]
  ------------------
  244|     34|                break;
  245|     84|            len = lens[work[sym]];
  246|     84|        }
  247|       |
  248|       |        /* create new sub-table if needed */
  249|    161|        if (len > root && (huff & mask) != low) {
  ------------------
  |  Branch (249:13): [True: 0, False: 161]
  |  Branch (249:27): [True: 0, False: 0]
  ------------------
  250|       |            /* if first time, transition to sub-tables */
  251|      0|            if (drop == 0)
  ------------------
  |  Branch (251:17): [True: 0, False: 0]
  ------------------
  252|      0|                drop = root;
  253|       |
  254|       |            /* increment past last table */
  255|      0|            next += min;            /* here min is 1 << curr */
  256|       |
  257|       |            /* determine length of next table */
  258|      0|            curr = len - drop;
  259|      0|            left = (int)(1 << curr);
  260|      0|            while (curr + drop < max) {
  ------------------
  |  Branch (260:20): [True: 0, False: 0]
  ------------------
  261|      0|                left -= count[curr + drop];
  262|      0|                if (left <= 0)
  ------------------
  |  Branch (262:21): [True: 0, False: 0]
  ------------------
  263|      0|                    break;
  264|      0|                curr++;
  265|      0|                left <<= 1;
  266|      0|            }
  267|       |
  268|       |            /* check for enough space */
  269|      0|            used += 1U << curr;
  270|      0|            if ((type == LENS && used > ENOUGH_LENS) || (type == DISTS && used > ENOUGH_DISTS))
  ------------------
  |  |   52|      0|#define ENOUGH_LENS 1332
  ------------------
                          if ((type == LENS && used > ENOUGH_LENS) || (type == DISTS && used > ENOUGH_DISTS))
  ------------------
  |  |   53|      0|#define ENOUGH_DISTS 592
  ------------------
  |  Branch (270:18): [True: 0, False: 0]
  |  Branch (270:34): [True: 0, False: 0]
  |  Branch (270:58): [True: 0, False: 0]
  |  Branch (270:75): [True: 0, False: 0]
  ------------------
  271|      0|                return 1;
  272|       |
  273|       |            /* point entry in root table to sub-table */
  274|      0|            low = huff & mask;
  275|      0|            (*table)[low].op = (unsigned char)curr;
  276|      0|            (*table)[low].bits = (unsigned char)root;
  277|      0|            (*table)[low].val = (uint16_t)(next - *table);
  278|      0|        }
  279|    161|    }
  280|       |
  281|       |    /* fill in remaining table entry if code is incomplete (guaranteed to have
  282|       |       at most one remaining entry, since if the code is incomplete, the
  283|       |       maximum code length that was allowed to get this far is one bit) */
  284|     34|    if (UNLIKELY(huff != 0)) {
  ------------------
  |  |  214|     34|#  define UNLIKELY(x)           __builtin_expect(!!(x), 0)
  |  |  ------------------
  |  |  |  Branch (214:33): [True: 0, False: 34]
  |  |  ------------------
  ------------------
  285|      0|        here.op = (unsigned char)64;            /* invalid code marker */
  286|      0|        here.bits = (unsigned char)(len - drop);
  287|      0|        here.val = (uint16_t)0;
  288|      0|        next[huff] = here;
  289|      0|    }
  290|       |
  291|       |    /* set return parameters */
  292|     34|    *table += used;
  293|     34|    *bits = root;
  294|     34|    return 0;
  295|     34|}

zng_uncompress2:
   25|    149|z_int32_t Z_EXPORT PREFIX(uncompress2)(unsigned char *dest, z_uintmax_t *destLen, const unsigned char *source, z_uintmax_t *sourceLen) {
   26|    149|    PREFIX3(stream) stream;
  ------------------
  |  |   99|    149|#  define PREFIX3(x) zng_ ## x
  ------------------
   27|    149|    int err;
   28|    149|    const unsigned int max = (unsigned int)-1;
   29|    149|    z_uintmax_t len, left;
  ------------------
  |  |  109|    149|#  define z_uintmax_t size_t
  ------------------
   30|    149|    unsigned char buf[1];    /* for detection of incomplete stream when *destLen == 0 */
   31|       |
   32|    149|    len = *sourceLen;
   33|    149|    if (*destLen) {
  ------------------
  |  Branch (33:9): [True: 149, False: 0]
  ------------------
   34|    149|        left = *destLen;
   35|    149|        *destLen = 0;
   36|    149|    } else {
   37|      0|        left = 1;
   38|      0|        dest = buf;
   39|      0|    }
   40|       |
   41|    149|    stream.next_in = (z_const unsigned char *)source;
   42|    149|    stream.avail_in = 0;
   43|    149|    stream.zalloc = NULL;
   44|    149|    stream.zfree = NULL;
   45|    149|    stream.opaque = NULL;
   46|       |
   47|    149|    err = PREFIX(inflateInit)(&stream);
  ------------------
  |  |   97|    149|#  define PREFIX(x) zng_ ## x
  ------------------
   48|    149|    if (err != Z_OK) return err;
  ------------------
  |  |  180|    149|#define Z_OK            0
  ------------------
  |  Branch (48:9): [True: 0, False: 149]
  ------------------
   49|       |
   50|    149|    stream.next_out = dest;
   51|    149|    stream.avail_out = 0;
   52|       |
   53|    230|    do {
   54|    230|        if (stream.avail_out == 0) {
  ------------------
  |  Branch (54:13): [True: 157, False: 73]
  ------------------
   55|    157|            stream.avail_out = left > (unsigned long)max ? max : (unsigned int)left;
  ------------------
  |  Branch (55:32): [True: 0, False: 157]
  ------------------
   56|    157|            left -= stream.avail_out;
   57|    157|        }
   58|    230|        if (stream.avail_in == 0) {
  ------------------
  |  Branch (58:13): [True: 222, False: 8]
  ------------------
   59|    222|            stream.avail_in = len > (unsigned long)max ? max : (unsigned int)len;
  ------------------
  |  Branch (59:31): [True: 0, False: 222]
  ------------------
   60|    222|            len -= stream.avail_in;
   61|    222|        }
   62|    230|        err = PREFIX(inflate)(&stream, Z_NO_FLUSH);
  ------------------
  |  |   97|    230|#  define PREFIX(x) zng_ ## x
  ------------------
                      err = PREFIX(inflate)(&stream, Z_NO_FLUSH);
  ------------------
  |  |  171|    230|#define Z_NO_FLUSH      0
  ------------------
   63|    230|    } while (err == Z_OK);
  ------------------
  |  |  180|    230|#define Z_OK            0
  ------------------
  |  Branch (63:14): [True: 81, False: 149]
  ------------------
   64|       |
   65|    149|    *sourceLen -= len + stream.avail_in;
   66|    149|    if (dest != buf)
  ------------------
  |  Branch (66:9): [True: 149, False: 0]
  ------------------
   67|    149|        *destLen = (z_size_t)stream.total_out;
   68|      0|    else if (stream.total_out && err == Z_BUF_ERROR)
  ------------------
  |  |  187|      0|#define Z_BUF_ERROR    (-5)
  ------------------
  |  Branch (68:14): [True: 0, False: 0]
  |  Branch (68:34): [True: 0, False: 0]
  ------------------
   69|      0|        left = 1;
   70|       |
   71|    149|    PREFIX(inflateEnd)(&stream);
  ------------------
  |  |   97|    149|#  define PREFIX(x) zng_ ## x
  ------------------
   72|    149|    return err == Z_STREAM_END ? Z_OK :
  ------------------
  |  |  181|    149|#define Z_STREAM_END    1
  ------------------
                  return err == Z_STREAM_END ? Z_OK :
  ------------------
  |  |  180|      1|#define Z_OK            0
  ------------------
  |  Branch (72:12): [True: 1, False: 148]
  ------------------
   73|    149|           err == Z_NEED_DICT ? Z_DATA_ERROR  :
  ------------------
  |  |  182|    148|#define Z_NEED_DICT     2
  ------------------
                         err == Z_NEED_DICT ? Z_DATA_ERROR  :
  ------------------
  |  |  185|      1|#define Z_DATA_ERROR   (-3)
  ------------------
  |  Branch (73:12): [True: 1, False: 147]
  ------------------
   74|    148|           err == Z_BUF_ERROR && left + stream.avail_out ? Z_DATA_ERROR :
  ------------------
  |  |  187|    294|#define Z_BUF_ERROR    (-5)
  ------------------
                         err == Z_BUF_ERROR && left + stream.avail_out ? Z_DATA_ERROR :
  ------------------
  |  |  185|     73|#define Z_DATA_ERROR   (-3)
  ------------------
  |  Branch (74:12): [True: 81, False: 66]
  |  Branch (74:34): [True: 73, False: 8]
  ------------------
   75|    147|           err;
   76|    149|}
zng_uncompress:
   78|    149|z_int32_t Z_EXPORT PREFIX(uncompress)(unsigned char *dest, z_uintmax_t *destLen, const unsigned char *source, z_uintmax_t sourceLen) {
   79|    149|    return PREFIX(uncompress2)(dest, destLen, source, &sourceLen);
  ------------------
  |  |   97|    149|#  define PREFIX(x) zng_ ## x
  ------------------
   80|    149|}

chunkset_avx2.c:zng_memread_2:
   12|     15|static inline uint16_t zng_memread_2(const void *ptr) {
   13|     15|#if defined(HAVE_MAY_ALIAS)
   14|     15|    typedef struct { uint16_t val; } __attribute__ ((__packed__, __may_alias__)) unaligned_uint16_t;
   15|     15|    return ((const unaligned_uint16_t *)ptr)->val;
   16|       |#else
   17|       |    uint16_t val;
   18|       |    memcpy(&val, ptr, sizeof(val));
   19|       |    return val;
   20|       |#endif
   21|     15|}
chunkset_avx2.c:zng_memread_4:
   23|     13|static inline uint32_t zng_memread_4(const void *ptr) {
   24|     13|#if defined(HAVE_MAY_ALIAS)
   25|     13|    typedef struct { uint32_t val; } __attribute__ ((__packed__, __may_alias__)) unaligned_uint32_t;
   26|     13|    return ((const unaligned_uint32_t *)ptr)->val;
   27|       |#else
   28|       |    uint32_t val;
   29|       |    memcpy(&val, ptr, sizeof(val));
   30|       |    return val;
   31|       |#endif
   32|     13|}
chunkset_avx2.c:zng_memread_8:
   34|      9|static inline uint64_t zng_memread_8(const void *ptr) {
   35|      9|#if defined(HAVE_MAY_ALIAS)
   36|      9|    typedef struct { uint64_t val; } __attribute__ ((__packed__, __may_alias__)) unaligned_uint64_t;
   37|      9|    return ((const unaligned_uint64_t *)ptr)->val;
   38|       |#else
   39|       |    uint64_t val;
   40|       |    memcpy(&val, ptr, sizeof(val));
   41|       |    return val;
   42|       |#endif
   43|      9|}

zng_zcalloc:
  105|    149|void Z_INTERNAL *PREFIX(zcalloc)(void *opaque, unsigned items, unsigned size) {
  106|    149|    Z_UNUSED(opaque);
  ------------------
  |  |  128|    149|#define Z_UNUSED(var) (void)(var)
  ------------------
  107|    149|    return zng_alloc((size_t)items * (size_t)size);
  108|    149|}
zng_zcfree:
  110|    149|void Z_INTERNAL PREFIX(zcfree)(void *opaque, void *ptr) {
  111|    149|    Z_UNUSED(opaque);
  ------------------
  |  |  128|    149|#define Z_UNUSED(var) (void)(var)
  ------------------
  112|    149|    zng_free(ptr);
  113|    149|}

zutil.c:zng_alloc:
   12|    149|static inline void *zng_alloc(size_t size) {
   13|    149|    return (void *)malloc(size);
   14|    149|}
zutil.c:zng_free:
   16|    149|static inline void zng_free(void *ptr) {
   17|    149|    free(ptr);
   18|    149|}

zstd_compress.c:ZSTD_customMalloc:
   27|     56|{
   28|     56|    if (customMem.customAlloc)
  ------------------
  |  Branch (28:9): [True: 0, False: 56]
  ------------------
   29|      0|        return customMem.customAlloc(customMem.opaque, size);
   30|     56|    return ZSTD_malloc(size);
  ------------------
  |  |   66|     56|#define ZSTD_malloc(s) malloc(s)
  ------------------
   31|     56|}
zstd_compress.c:ZSTD_customFree:
   50|    140|{
   51|    140|    if (ptr!=NULL) {
  ------------------
  |  Branch (51:9): [True: 56, False: 84]
  ------------------
   52|     56|        if (customMem.customFree)
  ------------------
  |  Branch (52:13): [True: 0, False: 56]
  ------------------
   53|      0|            customMem.customFree(customMem.opaque, ptr);
   54|     56|        else
   55|     56|            ZSTD_free(ptr);
  ------------------
  |  |   68|     56|#define ZSTD_free(p) free((p))
  ------------------
   56|     56|    }
   57|    140|}
zstd_ddict.c:ZSTD_customMalloc:
   27|     22|{
   28|     22|    if (customMem.customAlloc)
  ------------------
  |  Branch (28:9): [True: 0, False: 22]
  ------------------
   29|      0|        return customMem.customAlloc(customMem.opaque, size);
   30|     22|    return ZSTD_malloc(size);
  ------------------
  |  |   66|     22|#define ZSTD_malloc(s) malloc(s)
  ------------------
   31|     22|}
zstd_ddict.c:ZSTD_customFree:
   50|     22|{
   51|     22|    if (ptr!=NULL) {
  ------------------
  |  Branch (51:9): [True: 22, False: 0]
  ------------------
   52|     22|        if (customMem.customFree)
  ------------------
  |  Branch (52:13): [True: 0, False: 22]
  ------------------
   53|      0|            customMem.customFree(customMem.opaque, ptr);
   54|     22|        else
   55|     22|            ZSTD_free(ptr);
  ------------------
  |  |   68|     22|#define ZSTD_free(p) free((p))
  ------------------
   56|     22|    }
   57|     22|}
zstd_decompress.c:ZSTD_customFree:
   50|    808|{
   51|    808|    if (ptr!=NULL) {
  ------------------
  |  Branch (51:9): [True: 404, False: 404]
  ------------------
   52|    404|        if (customMem.customFree)
  ------------------
  |  Branch (52:13): [True: 0, False: 404]
  ------------------
   53|      0|            customMem.customFree(customMem.opaque, ptr);
   54|    404|        else
   55|    404|            ZSTD_free(ptr);
  ------------------
  |  |   68|    404|#define ZSTD_free(p) free((p))
  ------------------
   56|    404|    }
   57|    808|}
zstd_decompress.c:ZSTD_customMalloc:
   27|    404|{
   28|    404|    if (customMem.customAlloc)
  ------------------
  |  Branch (28:9): [True: 0, False: 404]
  ------------------
   29|      0|        return customMem.customAlloc(customMem.opaque, size);
   30|    404|    return ZSTD_malloc(size);
  ------------------
  |  |   66|    404|#define ZSTD_malloc(s) malloc(s)
  ------------------
   31|    404|}

zstd_compress.c:ZSTD_highbit32:
  175|  17.8k|{
  176|  17.8k|    assert(val != 0);
  ------------------
  |  |   70|  17.8k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  177|  17.8k|    return 31 - ZSTD_countLeadingZeros32(val);
  178|  17.8k|}
zstd_compress.c:ZSTD_countLeadingZeros32:
   70|  17.8k|{
   71|  17.8k|    assert(val != 0);
  ------------------
  |  |   70|  17.8k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
   72|       |#if defined(_MSC_VER)
   73|       |#  if STATIC_BMI2
   74|       |    return (unsigned)_lzcnt_u32(val);
   75|       |#  else
   76|       |    if (val != 0) {
   77|       |        unsigned long r;
   78|       |        _BitScanReverse(&r, val);
   79|       |        return (unsigned)(31 - r);
   80|       |    } else {
   81|       |        __assume(0); /* Should not reach this code path */
   82|       |    }
   83|       |#  endif
   84|       |#elif defined(__GNUC__) && (__GNUC__ >= 4)
   85|       |    return (unsigned)__builtin_clz(val);
   86|       |#elif defined(__ICCARM__)
   87|       |    return (unsigned)__builtin_clz(val);
   88|       |#else
   89|       |    return ZSTD_countLeadingZeros32_fallback(val);
   90|       |#endif
   91|  17.8k|}
zstd_double_fast.c:ZSTD_NbCommonBytes:
  158|    384|{
  159|    384|    if (MEM_isLittleEndian()) {
  ------------------
  |  Branch (159:9): [True: 384, False: 0]
  ------------------
  160|    384|        if (MEM_64bits()) {
  ------------------
  |  Branch (160:13): [True: 384, False: 0]
  ------------------
  161|    384|            return ZSTD_countTrailingZeros64((U64)val) >> 3;
  162|    384|        } else {
  163|      0|            return ZSTD_countTrailingZeros32((U32)val) >> 3;
  164|      0|        }
  165|    384|    } else {  /* Big Endian CPU */
  166|      0|        if (MEM_64bits()) {
  ------------------
  |  Branch (166:13): [True: 0, False: 0]
  ------------------
  167|      0|            return ZSTD_countLeadingZeros64((U64)val) >> 3;
  168|      0|        } else {
  169|      0|            return ZSTD_countLeadingZeros32((U32)val) >> 3;
  170|      0|        }
  171|      0|    }
  172|    384|}
zstd_double_fast.c:ZSTD_countTrailingZeros64:
   94|    384|{
   95|    384|    assert(val != 0);
  ------------------
  |  |   70|    384|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
   96|       |#if defined(_MSC_VER) && defined(_WIN64)
   97|       |#  if STATIC_BMI2
   98|       |    return (unsigned)_tzcnt_u64(val);
   99|       |#  else
  100|       |    if (val != 0) {
  101|       |        unsigned long r;
  102|       |        _BitScanForward64(&r, val);
  103|       |        return (unsigned)r;
  104|       |    } else {
  105|       |        __assume(0); /* Should not reach this code path */
  106|       |    }
  107|       |#  endif
  108|       |#elif defined(__GNUC__) && (__GNUC__ >= 4) && defined(__LP64__)
  109|       |    return (unsigned)__builtin_ctzll(val);
  110|       |#elif defined(__ICCARM__)
  111|       |    return (unsigned)__builtin_ctzll(val);
  112|       |#else
  113|       |    {
  114|       |        U32 mostSignificantWord = (U32)(val >> 32);
  115|       |        U32 leastSignificantWord = (U32)val;
  116|       |        if (leastSignificantWord == 0) {
  117|       |            return 32 + ZSTD_countTrailingZeros32(mostSignificantWord);
  118|       |        } else {
  119|       |            return ZSTD_countTrailingZeros32(leastSignificantWord);
  120|       |        }
  121|       |    }
  122|       |#endif
  123|    384|}
zstd_lazy.c:ZSTD_NbCommonBytes:
  158|  99.8k|{
  159|  99.8k|    if (MEM_isLittleEndian()) {
  ------------------
  |  Branch (159:9): [True: 99.8k, False: 0]
  ------------------
  160|  99.8k|        if (MEM_64bits()) {
  ------------------
  |  Branch (160:13): [True: 99.8k, False: 0]
  ------------------
  161|  99.8k|            return ZSTD_countTrailingZeros64((U64)val) >> 3;
  162|  99.8k|        } else {
  163|      0|            return ZSTD_countTrailingZeros32((U32)val) >> 3;
  164|      0|        }
  165|  99.8k|    } else {  /* Big Endian CPU */
  166|      0|        if (MEM_64bits()) {
  ------------------
  |  Branch (166:13): [True: 0, False: 0]
  ------------------
  167|      0|            return ZSTD_countLeadingZeros64((U64)val) >> 3;
  168|      0|        } else {
  169|      0|            return ZSTD_countLeadingZeros32((U32)val) >> 3;
  170|      0|        }
  171|      0|    }
  172|  99.8k|}
zstd_lazy.c:ZSTD_countTrailingZeros64:
   94|  99.8k|{
   95|  99.8k|    assert(val != 0);
  ------------------
  |  |   70|  99.8k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
   96|       |#if defined(_MSC_VER) && defined(_WIN64)
   97|       |#  if STATIC_BMI2
   98|       |    return (unsigned)_tzcnt_u64(val);
   99|       |#  else
  100|       |    if (val != 0) {
  101|       |        unsigned long r;
  102|       |        _BitScanForward64(&r, val);
  103|       |        return (unsigned)r;
  104|       |    } else {
  105|       |        __assume(0); /* Should not reach this code path */
  106|       |    }
  107|       |#  endif
  108|       |#elif defined(__GNUC__) && (__GNUC__ >= 4) && defined(__LP64__)
  109|       |    return (unsigned)__builtin_ctzll(val);
  110|       |#elif defined(__ICCARM__)
  111|       |    return (unsigned)__builtin_ctzll(val);
  112|       |#else
  113|       |    {
  114|       |        U32 mostSignificantWord = (U32)(val >> 32);
  115|       |        U32 leastSignificantWord = (U32)val;
  116|       |        if (leastSignificantWord == 0) {
  117|       |            return 32 + ZSTD_countTrailingZeros32(mostSignificantWord);
  118|       |        } else {
  119|       |            return ZSTD_countTrailingZeros32(leastSignificantWord);
  120|       |        }
  121|       |    }
  122|       |#endif
  123|  99.8k|}
zstd_lazy.c:ZSTD_countLeadingZeros32:
   70|  81.4k|{
   71|  81.4k|    assert(val != 0);
  ------------------
  |  |   70|  81.4k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
   72|       |#if defined(_MSC_VER)
   73|       |#  if STATIC_BMI2
   74|       |    return (unsigned)_lzcnt_u32(val);
   75|       |#  else
   76|       |    if (val != 0) {
   77|       |        unsigned long r;
   78|       |        _BitScanReverse(&r, val);
   79|       |        return (unsigned)(31 - r);
   80|       |    } else {
   81|       |        __assume(0); /* Should not reach this code path */
   82|       |    }
   83|       |#  endif
   84|       |#elif defined(__GNUC__) && (__GNUC__ >= 4)
   85|       |    return (unsigned)__builtin_clz(val);
   86|       |#elif defined(__ICCARM__)
   87|       |    return (unsigned)__builtin_clz(val);
   88|       |#else
   89|       |    return ZSTD_countLeadingZeros32_fallback(val);
   90|       |#endif
   91|  81.4k|}
zstd_lazy.c:ZSTD_highbit32:
  175|  81.4k|{
  176|  81.4k|    assert(val != 0);
  ------------------
  |  |   70|  81.4k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  177|  81.4k|    return 31 - ZSTD_countLeadingZeros32(val);
  178|  81.4k|}
zstd_opt.c:ZSTD_NbCommonBytes:
  158|   208k|{
  159|   208k|    if (MEM_isLittleEndian()) {
  ------------------
  |  Branch (159:9): [True: 208k, False: 0]
  ------------------
  160|   208k|        if (MEM_64bits()) {
  ------------------
  |  Branch (160:13): [True: 208k, False: 0]
  ------------------
  161|   208k|            return ZSTD_countTrailingZeros64((U64)val) >> 3;
  162|   208k|        } else {
  163|      0|            return ZSTD_countTrailingZeros32((U32)val) >> 3;
  164|      0|        }
  165|   208k|    } else {  /* Big Endian CPU */
  166|      0|        if (MEM_64bits()) {
  ------------------
  |  Branch (166:13): [True: 0, False: 0]
  ------------------
  167|      0|            return ZSTD_countLeadingZeros64((U64)val) >> 3;
  168|      0|        } else {
  169|      0|            return ZSTD_countLeadingZeros32((U32)val) >> 3;
  170|      0|        }
  171|      0|    }
  172|   208k|}
zstd_opt.c:ZSTD_countTrailingZeros64:
   94|   208k|{
   95|   208k|    assert(val != 0);
  ------------------
  |  |   70|   208k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
   96|       |#if defined(_MSC_VER) && defined(_WIN64)
   97|       |#  if STATIC_BMI2
   98|       |    return (unsigned)_tzcnt_u64(val);
   99|       |#  else
  100|       |    if (val != 0) {
  101|       |        unsigned long r;
  102|       |        _BitScanForward64(&r, val);
  103|       |        return (unsigned)r;
  104|       |    } else {
  105|       |        __assume(0); /* Should not reach this code path */
  106|       |    }
  107|       |#  endif
  108|       |#elif defined(__GNUC__) && (__GNUC__ >= 4) && defined(__LP64__)
  109|       |    return (unsigned)__builtin_ctzll(val);
  110|       |#elif defined(__ICCARM__)
  111|       |    return (unsigned)__builtin_ctzll(val);
  112|       |#else
  113|       |    {
  114|       |        U32 mostSignificantWord = (U32)(val >> 32);
  115|       |        U32 leastSignificantWord = (U32)val;
  116|       |        if (leastSignificantWord == 0) {
  117|       |            return 32 + ZSTD_countTrailingZeros32(mostSignificantWord);
  118|       |        } else {
  119|       |            return ZSTD_countTrailingZeros32(leastSignificantWord);
  120|       |        }
  121|       |    }
  122|       |#endif
  123|   208k|}
zstd_opt.c:ZSTD_countLeadingZeros32:
   70|  1.35M|{
   71|  1.35M|    assert(val != 0);
  ------------------
  |  |   70|  1.35M|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
   72|       |#if defined(_MSC_VER)
   73|       |#  if STATIC_BMI2
   74|       |    return (unsigned)_lzcnt_u32(val);
   75|       |#  else
   76|       |    if (val != 0) {
   77|       |        unsigned long r;
   78|       |        _BitScanReverse(&r, val);
   79|       |        return (unsigned)(31 - r);
   80|       |    } else {
   81|       |        __assume(0); /* Should not reach this code path */
   82|       |    }
   83|       |#  endif
   84|       |#elif defined(__GNUC__) && (__GNUC__ >= 4)
   85|       |    return (unsigned)__builtin_clz(val);
   86|       |#elif defined(__ICCARM__)
   87|       |    return (unsigned)__builtin_clz(val);
   88|       |#else
   89|       |    return ZSTD_countLeadingZeros32_fallback(val);
   90|       |#endif
   91|  1.35M|}
zstd_opt.c:ZSTD_highbit32:
  175|  1.35M|{
  176|  1.35M|    assert(val != 0);
  ------------------
  |  |   70|  1.35M|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  177|  1.35M|    return 31 - ZSTD_countLeadingZeros32(val);
  178|  1.35M|}
zstd_decompress_block.c:ZSTD_highbit32:
  175|  27.2k|{
  176|  27.2k|    assert(val != 0);
  ------------------
  |  |   70|  27.2k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  177|  27.2k|    return 31 - ZSTD_countLeadingZeros32(val);
  178|  27.2k|}
zstd_decompress_block.c:ZSTD_countLeadingZeros32:
   70|  27.2k|{
   71|  27.2k|    assert(val != 0);
  ------------------
  |  |   70|  27.2k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
   72|       |#if defined(_MSC_VER)
   73|       |#  if STATIC_BMI2
   74|       |    return (unsigned)_lzcnt_u32(val);
   75|       |#  else
   76|       |    if (val != 0) {
   77|       |        unsigned long r;
   78|       |        _BitScanReverse(&r, val);
   79|       |        return (unsigned)(31 - r);
   80|       |    } else {
   81|       |        __assume(0); /* Should not reach this code path */
   82|       |    }
   83|       |#  endif
   84|       |#elif defined(__GNUC__) && (__GNUC__ >= 4)
   85|       |    return (unsigned)__builtin_clz(val);
   86|       |#elif defined(__ICCARM__)
   87|       |    return (unsigned)__builtin_clz(val);
   88|       |#else
   89|       |    return ZSTD_countLeadingZeros32_fallback(val);
   90|       |#endif
   91|  27.2k|}
entropy_common.c:ZSTD_countTrailingZeros32:
   29|  1.07k|{
   30|  1.07k|    assert(val != 0);
  ------------------
  |  |   70|  1.07k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
   31|       |#if defined(_MSC_VER)
   32|       |#  if STATIC_BMI2
   33|       |    return (unsigned)_tzcnt_u32(val);
   34|       |#  else
   35|       |    if (val != 0) {
   36|       |        unsigned long r;
   37|       |        _BitScanForward(&r, val);
   38|       |        return (unsigned)r;
   39|       |    } else {
   40|       |        __assume(0); /* Should not reach this code path */
   41|       |    }
   42|       |#  endif
   43|       |#elif defined(__GNUC__) && (__GNUC__ >= 4)
   44|       |    return (unsigned)__builtin_ctz(val);
   45|       |#elif defined(__ICCARM__)
   46|       |    return (unsigned)__builtin_ctz(val);
   47|       |#else
   48|       |    return ZSTD_countTrailingZeros32_fallback(val);
   49|       |#endif
   50|  1.07k|}
entropy_common.c:ZSTD_highbit32:
  175|  14.2k|{
  176|  14.2k|    assert(val != 0);
  ------------------
  |  |   70|  14.2k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  177|  14.2k|    return 31 - ZSTD_countLeadingZeros32(val);
  178|  14.2k|}
entropy_common.c:ZSTD_countLeadingZeros32:
   70|  14.2k|{
   71|  14.2k|    assert(val != 0);
  ------------------
  |  |   70|  14.2k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
   72|       |#if defined(_MSC_VER)
   73|       |#  if STATIC_BMI2
   74|       |    return (unsigned)_lzcnt_u32(val);
   75|       |#  else
   76|       |    if (val != 0) {
   77|       |        unsigned long r;
   78|       |        _BitScanReverse(&r, val);
   79|       |        return (unsigned)(31 - r);
   80|       |    } else {
   81|       |        __assume(0); /* Should not reach this code path */
   82|       |    }
   83|       |#  endif
   84|       |#elif defined(__GNUC__) && (__GNUC__ >= 4)
   85|       |    return (unsigned)__builtin_clz(val);
   86|       |#elif defined(__ICCARM__)
   87|       |    return (unsigned)__builtin_clz(val);
   88|       |#else
   89|       |    return ZSTD_countLeadingZeros32_fallback(val);
   90|       |#endif
   91|  14.2k|}
fse_decompress.c:ZSTD_highbit32:
  175|  72.0k|{
  176|  72.0k|    assert(val != 0);
  ------------------
  |  |   70|  72.0k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  177|  72.0k|    return 31 - ZSTD_countLeadingZeros32(val);
  178|  72.0k|}
fse_decompress.c:ZSTD_countLeadingZeros32:
   70|  72.0k|{
   71|  72.0k|    assert(val != 0);
  ------------------
  |  |   70|  72.0k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
   72|       |#if defined(_MSC_VER)
   73|       |#  if STATIC_BMI2
   74|       |    return (unsigned)_lzcnt_u32(val);
   75|       |#  else
   76|       |    if (val != 0) {
   77|       |        unsigned long r;
   78|       |        _BitScanReverse(&r, val);
   79|       |        return (unsigned)(31 - r);
   80|       |    } else {
   81|       |        __assume(0); /* Should not reach this code path */
   82|       |    }
   83|       |#  endif
   84|       |#elif defined(__GNUC__) && (__GNUC__ >= 4)
   85|       |    return (unsigned)__builtin_clz(val);
   86|       |#elif defined(__ICCARM__)
   87|       |    return (unsigned)__builtin_clz(val);
   88|       |#else
   89|       |    return ZSTD_countLeadingZeros32_fallback(val);
   90|       |#endif
   91|  72.0k|}
fse_compress.c:ZSTD_highbit32:
  175|   185k|{
  176|   185k|    assert(val != 0);
  ------------------
  |  |   70|   185k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  177|   185k|    return 31 - ZSTD_countLeadingZeros32(val);
  178|   185k|}
fse_compress.c:ZSTD_countLeadingZeros32:
   70|   185k|{
   71|   185k|    assert(val != 0);
  ------------------
  |  |   70|   185k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
   72|       |#if defined(_MSC_VER)
   73|       |#  if STATIC_BMI2
   74|       |    return (unsigned)_lzcnt_u32(val);
   75|       |#  else
   76|       |    if (val != 0) {
   77|       |        unsigned long r;
   78|       |        _BitScanReverse(&r, val);
   79|       |        return (unsigned)(31 - r);
   80|       |    } else {
   81|       |        __assume(0); /* Should not reach this code path */
   82|       |    }
   83|       |#  endif
   84|       |#elif defined(__GNUC__) && (__GNUC__ >= 4)
   85|       |    return (unsigned)__builtin_clz(val);
   86|       |#elif defined(__ICCARM__)
   87|       |    return (unsigned)__builtin_clz(val);
   88|       |#else
   89|       |    return ZSTD_countLeadingZeros32_fallback(val);
   90|       |#endif
   91|   185k|}
huf_compress.c:ZSTD_highbit32:
  175|  2.35M|{
  176|  2.35M|    assert(val != 0);
  ------------------
  |  |   70|  2.35M|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  177|  2.35M|    return 31 - ZSTD_countLeadingZeros32(val);
  178|  2.35M|}
huf_compress.c:ZSTD_countLeadingZeros32:
   70|  2.35M|{
   71|  2.35M|    assert(val != 0);
  ------------------
  |  |   70|  2.35M|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
   72|       |#if defined(_MSC_VER)
   73|       |#  if STATIC_BMI2
   74|       |    return (unsigned)_lzcnt_u32(val);
   75|       |#  else
   76|       |    if (val != 0) {
   77|       |        unsigned long r;
   78|       |        _BitScanReverse(&r, val);
   79|       |        return (unsigned)(31 - r);
   80|       |    } else {
   81|       |        __assume(0); /* Should not reach this code path */
   82|       |    }
   83|       |#  endif
   84|       |#elif defined(__GNUC__) && (__GNUC__ >= 4)
   85|       |    return (unsigned)__builtin_clz(val);
   86|       |#elif defined(__ICCARM__)
   87|       |    return (unsigned)__builtin_clz(val);
   88|       |#else
   89|       |    return ZSTD_countLeadingZeros32_fallback(val);
   90|       |#endif
   91|  2.35M|}
huf_decompress.c:ZSTD_highbit32:
  175|  2.74k|{
  176|  2.74k|    assert(val != 0);
  ------------------
  |  |   70|  2.74k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  177|  2.74k|    return 31 - ZSTD_countLeadingZeros32(val);
  178|  2.74k|}
huf_decompress.c:ZSTD_countLeadingZeros32:
   70|  2.74k|{
   71|  2.74k|    assert(val != 0);
  ------------------
  |  |   70|  2.74k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
   72|       |#if defined(_MSC_VER)
   73|       |#  if STATIC_BMI2
   74|       |    return (unsigned)_lzcnt_u32(val);
   75|       |#  else
   76|       |    if (val != 0) {
   77|       |        unsigned long r;
   78|       |        _BitScanReverse(&r, val);
   79|       |        return (unsigned)(31 - r);
   80|       |    } else {
   81|       |        __assume(0); /* Should not reach this code path */
   82|       |    }
   83|       |#  endif
   84|       |#elif defined(__GNUC__) && (__GNUC__ >= 4)
   85|       |    return (unsigned)__builtin_clz(val);
   86|       |#elif defined(__ICCARM__)
   87|       |    return (unsigned)__builtin_clz(val);
   88|       |#else
   89|       |    return ZSTD_countLeadingZeros32_fallback(val);
   90|       |#endif
   91|  2.74k|}

zstd_compress_sequences.c:BIT_initCStream:
  152|  2.80k|{
  153|  2.80k|    bitC->bitContainer = 0;
  154|  2.80k|    bitC->bitPos = 0;
  155|  2.80k|    bitC->startPtr = (char*)startPtr;
  156|  2.80k|    bitC->ptr = bitC->startPtr;
  157|  2.80k|    bitC->endPtr = bitC->startPtr + dstCapacity - sizeof(bitC->bitContainer);
  158|  2.80k|    if (dstCapacity <= sizeof(bitC->bitContainer)) return ERROR(dstSize_tooSmall);
  ------------------
  |  |   49|    109|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|    109|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|    109|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (158:9): [True: 109, False: 2.69k]
  ------------------
  159|  2.69k|    return 0;
  160|  2.80k|}
zstd_compress_sequences.c:BIT_addBits:
  182|  75.3k|{
  183|  75.3k|    DEBUG_STATIC_ASSERT(BIT_MASK_SIZE == 32);
  ------------------
  |  |   39|  75.3k|#define DEBUG_STATIC_ASSERT(c) (void)sizeof(char[(c) ? 1 : -1])
  ------------------
  184|  75.3k|    assert(nbBits < BIT_MASK_SIZE);
  ------------------
  |  |   70|  75.3k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  185|  75.3k|    assert(nbBits + bitC->bitPos < sizeof(bitC->bitContainer) * 8);
  ------------------
  |  |   70|  75.3k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  186|  75.3k|    bitC->bitContainer |= BIT_getLowerBits(value, nbBits) << bitC->bitPos;
  187|  75.3k|    bitC->bitPos += nbBits;
  188|  75.3k|}
zstd_compress_sequences.c:BIT_getLowerBits:
  163|  75.3k|{
  164|       |#if STATIC_BMI2 && !defined(ZSTD_NO_INTRINSICS)
  165|       |#  if (defined(__x86_64__) || defined(_M_X64)) && !defined(__ILP32__)
  166|       |    return _bzhi_u64(bitContainer, nbBits);
  167|       |#  else
  168|       |    DEBUG_STATIC_ASSERT(sizeof(bitContainer) == sizeof(U32));
  169|       |    return _bzhi_u32(bitContainer, nbBits);
  170|       |#  endif
  171|       |#else
  172|  75.3k|    assert(nbBits < BIT_MASK_SIZE);
  ------------------
  |  |   70|  75.3k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  173|  75.3k|    return bitContainer & BIT_mask[nbBits];
  174|  75.3k|#endif
  175|  75.3k|}
zstd_compress_sequences.c:BIT_flushBits:
  222|  23.3k|{
  223|  23.3k|    size_t const nbBytes = bitC->bitPos >> 3;
  224|  23.3k|    assert(bitC->bitPos < sizeof(bitC->bitContainer) * 8);
  ------------------
  |  |   70|  23.3k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  225|  23.3k|    assert(bitC->ptr <= bitC->endPtr);
  ------------------
  |  |   70|  23.3k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  226|  23.3k|    MEM_writeLEST(bitC->ptr, bitC->bitContainer);
  227|  23.3k|    bitC->ptr += nbBytes;
  228|  23.3k|    if (bitC->ptr > bitC->endPtr) bitC->ptr = bitC->endPtr;
  ------------------
  |  Branch (228:9): [True: 537, False: 22.8k]
  ------------------
  229|  23.3k|    bitC->bitPos &= 7;
  230|  23.3k|    bitC->bitContainer >>= nbBytes*8;
  231|  23.3k|}
zstd_compress_sequences.c:BIT_closeCStream:
  237|  2.69k|{
  238|  2.69k|    BIT_addBitsFast(bitC, 1, 1);   /* endMark */
  239|  2.69k|    BIT_flushBits(bitC);
  240|  2.69k|    if (bitC->ptr >= bitC->endPtr) return 0; /* overflow detected */
  ------------------
  |  Branch (240:9): [True: 291, False: 2.40k]
  ------------------
  241|  2.40k|    return (size_t)(bitC->ptr - bitC->startPtr) + (bitC->bitPos > 0);
  242|  2.69k|}
zstd_compress_sequences.c:BIT_addBitsFast:
  195|  2.69k|{
  196|  2.69k|    assert((value>>nbBits) == 0);
  ------------------
  |  |   70|  2.69k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  197|  2.69k|    assert(nbBits + bitC->bitPos < sizeof(bitC->bitContainer) * 8);
  ------------------
  |  |   70|  2.69k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  198|  2.69k|    bitC->bitContainer |= value << bitC->bitPos;
  199|  2.69k|    bitC->bitPos += nbBits;
  200|  2.69k|}
zstd_decompress_block.c:BIT_initDStream:
  255|  3.84k|{
  256|  3.84k|    if (srcSize < 1) { ZSTD_memset(bitD, 0, sizeof(*bitD)); return ERROR(srcSize_wrong); }
  ------------------
  |  |   46|     17|# define ZSTD_memset(p,v,l) __builtin_memset((p),(v),(l))
  ------------------
                  if (srcSize < 1) { ZSTD_memset(bitD, 0, sizeof(*bitD)); return ERROR(srcSize_wrong); }
  ------------------
  |  |   49|     17|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|     17|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|     17|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (256:9): [True: 17, False: 3.82k]
  ------------------
  257|       |
  258|  3.82k|    bitD->start = (const char*)srcBuffer;
  259|  3.82k|    bitD->limitPtr = bitD->start + sizeof(bitD->bitContainer);
  260|       |
  261|  3.82k|    if (srcSize >=  sizeof(bitD->bitContainer)) {  /* normal case */
  ------------------
  |  Branch (261:9): [True: 2.41k, False: 1.40k]
  ------------------
  262|  2.41k|        bitD->ptr   = (const char*)srcBuffer + srcSize - sizeof(bitD->bitContainer);
  263|  2.41k|        bitD->bitContainer = MEM_readLEST(bitD->ptr);
  264|  2.41k|        { BYTE const lastByte = ((const BYTE*)srcBuffer)[srcSize-1];
  265|  2.41k|          bitD->bitsConsumed = lastByte ? 8 - ZSTD_highbit32(lastByte) : 0;  /* ensures bitsConsumed is always set */
  ------------------
  |  Branch (265:32): [True: 2.41k, False: 0]
  ------------------
  266|  2.41k|          if (lastByte == 0) return ERROR(GENERIC); /* endMark not present */ }
  ------------------
  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (266:15): [True: 0, False: 2.41k]
  ------------------
  267|  2.41k|    } else {
  268|  1.40k|        bitD->ptr   = bitD->start;
  269|  1.40k|        bitD->bitContainer = *(const BYTE*)(bitD->start);
  270|  1.40k|        switch(srcSize)
  271|  1.40k|        {
  272|     70|        case 7: bitD->bitContainer += (BitContainerType)(((const BYTE*)(srcBuffer))[6]) << (sizeof(bitD->bitContainer)*8 - 16);
  ------------------
  |  Branch (272:9): [True: 70, False: 1.33k]
  ------------------
  273|     70|                ZSTD_FALLTHROUGH;
  ------------------
  |  |  288|     70|#  define ZSTD_FALLTHROUGH ; __attribute__((__fallthrough__))
  ------------------
  274|       |
  275|    508|        case 6: bitD->bitContainer += (BitContainerType)(((const BYTE*)(srcBuffer))[5]) << (sizeof(bitD->bitContainer)*8 - 24);
  ------------------
  |  Branch (275:9): [True: 438, False: 970]
  ------------------
  276|    508|                ZSTD_FALLTHROUGH;
  ------------------
  |  |  288|    508|#  define ZSTD_FALLTHROUGH ; __attribute__((__fallthrough__))
  ------------------
  277|       |
  278|    776|        case 5: bitD->bitContainer += (BitContainerType)(((const BYTE*)(srcBuffer))[4]) << (sizeof(bitD->bitContainer)*8 - 32);
  ------------------
  |  Branch (278:9): [True: 268, False: 1.14k]
  ------------------
  279|    776|                ZSTD_FALLTHROUGH;
  ------------------
  |  |  288|    776|#  define ZSTD_FALLTHROUGH ; __attribute__((__fallthrough__))
  ------------------
  280|       |
  281|  1.12k|        case 4: bitD->bitContainer += (BitContainerType)(((const BYTE*)(srcBuffer))[3]) << 24;
  ------------------
  |  Branch (281:9): [True: 353, False: 1.05k]
  ------------------
  282|  1.12k|                ZSTD_FALLTHROUGH;
  ------------------
  |  |  288|  1.12k|#  define ZSTD_FALLTHROUGH ; __attribute__((__fallthrough__))
  ------------------
  283|       |
  284|  1.38k|        case 3: bitD->bitContainer += (BitContainerType)(((const BYTE*)(srcBuffer))[2]) << 16;
  ------------------
  |  Branch (284:9): [True: 259, False: 1.14k]
  ------------------
  285|  1.38k|                ZSTD_FALLTHROUGH;
  ------------------
  |  |  288|  1.38k|#  define ZSTD_FALLTHROUGH ; __attribute__((__fallthrough__))
  ------------------
  286|       |
  287|  1.39k|        case 2: bitD->bitContainer += (BitContainerType)(((const BYTE*)(srcBuffer))[1]) <<  8;
  ------------------
  |  Branch (287:9): [True: 5, False: 1.40k]
  ------------------
  288|  1.39k|                ZSTD_FALLTHROUGH;
  ------------------
  |  |  288|  1.39k|#  define ZSTD_FALLTHROUGH ; __attribute__((__fallthrough__))
  ------------------
  289|       |
  290|  1.40k|        default: break;
  ------------------
  |  Branch (290:9): [True: 15, False: 1.39k]
  ------------------
  291|  1.40k|        }
  292|  1.40k|        {   BYTE const lastByte = ((const BYTE*)srcBuffer)[srcSize-1];
  293|  1.40k|            bitD->bitsConsumed = lastByte ? 8 - ZSTD_highbit32(lastByte) : 0;
  ------------------
  |  Branch (293:34): [True: 1.39k, False: 10]
  ------------------
  294|  1.40k|            if (lastByte == 0) return ERROR(corruption_detected);  /* endMark not present */
  ------------------
  |  |   49|     10|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|     10|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|     10|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (294:17): [True: 10, False: 1.39k]
  ------------------
  295|  1.40k|        }
  296|  1.39k|        bitD->bitsConsumed += (U32)(sizeof(bitD->bitContainer) - srcSize)*8;
  297|  1.39k|    }
  298|       |
  299|  3.81k|    return srcSize;
  300|  3.82k|}
zstd_decompress_block.c:BIT_readBits:
  363|  50.8k|{
  364|  50.8k|    BitContainerType const value = BIT_lookBits(bitD, nbBits);
  365|  50.8k|    BIT_skipBits(bitD, nbBits);
  366|  50.8k|    return value;
  367|  50.8k|}
zstd_decompress_block.c:BIT_lookBits:
  331|  50.8k|{
  332|       |    /* arbitrate between double-shift and shift+mask */
  333|  50.8k|#if 1
  334|       |    /* if bitD->bitsConsumed + nbBits > sizeof(bitD->bitContainer)*8,
  335|       |     * bitstream is likely corrupted, and result is undefined */
  336|  50.8k|    return BIT_getMiddleBits(bitD->bitContainer, (sizeof(bitD->bitContainer)*8) - bitD->bitsConsumed - nbBits, nbBits);
  337|       |#else
  338|       |    /* this code path is slower on my os-x laptop */
  339|       |    U32 const regMask = sizeof(bitD->bitContainer)*8 - 1;
  340|       |    return ((bitD->bitContainer << (bitD->bitsConsumed & regMask)) >> 1) >> ((regMask-nbBits) & regMask);
  341|       |#endif
  342|  50.8k|}
zstd_decompress_block.c:BIT_getMiddleBits:
  308|  50.8k|{
  309|  50.8k|    U32 const regMask = sizeof(bitContainer)*8 - 1;
  310|       |    /* if start > regMask, bitstream is corrupted, and result is undefined */
  311|  50.8k|    assert(nbBits < BIT_MASK_SIZE);
  ------------------
  |  |   70|  50.8k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  312|       |    /* x86 transform & ((1 << nbBits) - 1) to bzhi instruction, it is better
  313|       |     * than accessing memory. When bmi2 instruction is not present, we consider
  314|       |     * such cpus old (pre-Haswell, 2013) and their performance is not of that
  315|       |     * importance.
  316|       |     */
  317|  50.8k|#if defined(__x86_64__) || defined(_M_X64)
  318|  50.8k|    return (bitContainer >> (start & regMask)) & ((((U64)1) << nbBits) - 1);
  319|       |#else
  320|       |    return (bitContainer >> (start & regMask)) & BIT_mask[nbBits];
  321|       |#endif
  322|  50.8k|}
zstd_decompress_block.c:BIT_skipBits:
  354|  66.6k|{
  355|  66.6k|    bitD->bitsConsumed += nbBits;
  356|  66.6k|}
zstd_decompress_block.c:BIT_reloadDStream:
  413|  24.5k|{
  414|       |    /* note : once in overflow mode, a bitstream remains in this mode until it's reset */
  415|  24.5k|    if (UNLIKELY(bitD->bitsConsumed > (sizeof(bitD->bitContainer)*8))) {
  ------------------
  |  |  196|  24.5k|#define UNLIKELY(x) (__builtin_expect((x), 0))
  |  |  ------------------
  |  |  |  Branch (196:21): [True: 52, False: 24.5k]
  |  |  ------------------
  ------------------
  416|     52|        static const BitContainerType zeroFilled = 0;
  417|     52|        bitD->ptr = (const char*)&zeroFilled; /* aliasing is allowed for char */
  418|       |        /* overflow detected, erroneous scenario or end of stream: no update */
  419|     52|        return BIT_DStream_overflow;
  420|     52|    }
  421|       |
  422|  24.5k|    assert(bitD->ptr >= bitD->start);
  ------------------
  |  |   70|  24.5k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  423|       |
  424|  24.5k|    if (bitD->ptr >= bitD->limitPtr) {
  ------------------
  |  Branch (424:9): [True: 2.08k, False: 22.4k]
  ------------------
  425|  2.08k|        return BIT_reloadDStream_internal(bitD);
  426|  2.08k|    }
  427|  22.4k|    if (bitD->ptr == bitD->start) {
  ------------------
  |  Branch (427:9): [True: 14.1k, False: 8.29k]
  ------------------
  428|       |        /* reached end of bitStream => no update */
  429|  14.1k|        if (bitD->bitsConsumed < sizeof(bitD->bitContainer)*8) return BIT_DStream_endOfBuffer;
  ------------------
  |  Branch (429:13): [True: 13.5k, False: 576]
  ------------------
  430|    576|        return BIT_DStream_completed;
  431|  14.1k|    }
  432|       |    /* start < ptr < limitPtr => cautious update */
  433|  8.29k|    {   U32 nbBytes = bitD->bitsConsumed >> 3;
  434|  8.29k|        BIT_DStream_status result = BIT_DStream_unfinished;
  435|  8.29k|        if (nbBytes > (size_t)(bitD->ptr - bitD->start)) {
  ------------------
  |  Branch (435:13): [True: 652, False: 7.63k]
  ------------------
  436|    652|            nbBytes = (U32)(bitD->ptr - bitD->start);  /* ptr > start */
  437|    652|            result = BIT_DStream_endOfBuffer;
  438|    652|        }
  439|  8.29k|        bitD->ptr -= nbBytes;
  440|  8.29k|        bitD->bitsConsumed -= nbBytes*8;
  441|  8.29k|        bitD->bitContainer = MEM_readLEST(bitD->ptr);   /* reminder : srcSize > sizeof(bitD->bitContainer), otherwise bitD->ptr == bitD->start */
  442|  8.29k|        return result;
  443|  22.4k|    }
  444|  22.4k|}
zstd_decompress_block.c:BIT_reloadDStream_internal:
  385|  2.08k|{
  386|  2.08k|    assert(bitD->bitsConsumed <= sizeof(bitD->bitContainer)*8);
  ------------------
  |  |   70|  2.08k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  387|  2.08k|    bitD->ptr -= bitD->bitsConsumed >> 3;
  388|  2.08k|    assert(bitD->ptr >= bitD->start);
  ------------------
  |  |   70|  2.08k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  389|  2.08k|    bitD->bitsConsumed &= 7;
  390|  2.08k|    bitD->bitContainer = MEM_readLEST(bitD->ptr);
  391|  2.08k|    return BIT_DStream_unfinished;
  392|  2.08k|}
zstd_decompress_block.c:BIT_readBitsFast:
  372|  15.7k|{
  373|  15.7k|    BitContainerType const value = BIT_lookBitsFast(bitD, nbBits);
  374|  15.7k|    assert(nbBits >= 1);
  ------------------
  |  |   70|  15.7k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  375|  15.7k|    BIT_skipBits(bitD, nbBits);
  376|  15.7k|    return value;
  377|  15.7k|}
zstd_decompress_block.c:BIT_lookBitsFast:
  347|  15.7k|{
  348|  15.7k|    U32 const regMask = sizeof(bitD->bitContainer)*8 - 1;
  349|  15.7k|    assert(nbBits >= 1);
  ------------------
  |  |   70|  15.7k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  350|  15.7k|    return (bitD->bitContainer << (bitD->bitsConsumed & regMask)) >> (((regMask+1)-nbBits) & regMask);
  351|  15.7k|}
zstd_decompress_block.c:BIT_endOfDStream:
  450|  3.80k|{
  451|  3.80k|    return ((DStream->ptr == DStream->start) && (DStream->bitsConsumed == sizeof(DStream->bitContainer)*8));
  ------------------
  |  Branch (451:13): [True: 3.80k, False: 1]
  |  Branch (451:49): [True: 3.80k, False: 0]
  ------------------
  452|  3.80k|}
fse_decompress.c:BIT_initDStream:
  255|  2.18k|{
  256|  2.18k|    if (srcSize < 1) { ZSTD_memset(bitD, 0, sizeof(*bitD)); return ERROR(srcSize_wrong); }
  ------------------
  |  |   46|      0|# define ZSTD_memset(p,v,l) __builtin_memset((p),(v),(l))
  ------------------
                  if (srcSize < 1) { ZSTD_memset(bitD, 0, sizeof(*bitD)); return ERROR(srcSize_wrong); }
  ------------------
  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (256:9): [True: 0, False: 2.18k]
  ------------------
  257|       |
  258|  2.18k|    bitD->start = (const char*)srcBuffer;
  259|  2.18k|    bitD->limitPtr = bitD->start + sizeof(bitD->bitContainer);
  260|       |
  261|  2.18k|    if (srcSize >=  sizeof(bitD->bitContainer)) {  /* normal case */
  ------------------
  |  Branch (261:9): [True: 2.12k, False: 58]
  ------------------
  262|  2.12k|        bitD->ptr   = (const char*)srcBuffer + srcSize - sizeof(bitD->bitContainer);
  263|  2.12k|        bitD->bitContainer = MEM_readLEST(bitD->ptr);
  264|  2.12k|        { BYTE const lastByte = ((const BYTE*)srcBuffer)[srcSize-1];
  265|  2.12k|          bitD->bitsConsumed = lastByte ? 8 - ZSTD_highbit32(lastByte) : 0;  /* ensures bitsConsumed is always set */
  ------------------
  |  Branch (265:32): [True: 2.12k, False: 0]
  ------------------
  266|  2.12k|          if (lastByte == 0) return ERROR(GENERIC); /* endMark not present */ }
  ------------------
  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (266:15): [True: 0, False: 2.12k]
  ------------------
  267|  2.12k|    } else {
  268|     58|        bitD->ptr   = bitD->start;
  269|     58|        bitD->bitContainer = *(const BYTE*)(bitD->start);
  270|     58|        switch(srcSize)
  271|     58|        {
  272|     18|        case 7: bitD->bitContainer += (BitContainerType)(((const BYTE*)(srcBuffer))[6]) << (sizeof(bitD->bitContainer)*8 - 16);
  ------------------
  |  Branch (272:9): [True: 18, False: 40]
  ------------------
  273|     18|                ZSTD_FALLTHROUGH;
  ------------------
  |  |  288|     18|#  define ZSTD_FALLTHROUGH ; __attribute__((__fallthrough__))
  ------------------
  274|       |
  275|     42|        case 6: bitD->bitContainer += (BitContainerType)(((const BYTE*)(srcBuffer))[5]) << (sizeof(bitD->bitContainer)*8 - 24);
  ------------------
  |  Branch (275:9): [True: 24, False: 34]
  ------------------
  276|     42|                ZSTD_FALLTHROUGH;
  ------------------
  |  |  288|     42|#  define ZSTD_FALLTHROUGH ; __attribute__((__fallthrough__))
  ------------------
  277|       |
  278|     42|        case 5: bitD->bitContainer += (BitContainerType)(((const BYTE*)(srcBuffer))[4]) << (sizeof(bitD->bitContainer)*8 - 32);
  ------------------
  |  Branch (278:9): [True: 0, False: 58]
  ------------------
  279|     42|                ZSTD_FALLTHROUGH;
  ------------------
  |  |  288|     42|#  define ZSTD_FALLTHROUGH ; __attribute__((__fallthrough__))
  ------------------
  280|       |
  281|     44|        case 4: bitD->bitContainer += (BitContainerType)(((const BYTE*)(srcBuffer))[3]) << 24;
  ------------------
  |  Branch (281:9): [True: 2, False: 56]
  ------------------
  282|     44|                ZSTD_FALLTHROUGH;
  ------------------
  |  |  288|     44|#  define ZSTD_FALLTHROUGH ; __attribute__((__fallthrough__))
  ------------------
  283|       |
  284|     54|        case 3: bitD->bitContainer += (BitContainerType)(((const BYTE*)(srcBuffer))[2]) << 16;
  ------------------
  |  Branch (284:9): [True: 10, False: 48]
  ------------------
  285|     54|                ZSTD_FALLTHROUGH;
  ------------------
  |  |  288|     54|#  define ZSTD_FALLTHROUGH ; __attribute__((__fallthrough__))
  ------------------
  286|       |
  287|     58|        case 2: bitD->bitContainer += (BitContainerType)(((const BYTE*)(srcBuffer))[1]) <<  8;
  ------------------
  |  Branch (287:9): [True: 4, False: 54]
  ------------------
  288|     58|                ZSTD_FALLTHROUGH;
  ------------------
  |  |  288|     58|#  define ZSTD_FALLTHROUGH ; __attribute__((__fallthrough__))
  ------------------
  289|       |
  290|     58|        default: break;
  ------------------
  |  Branch (290:9): [True: 0, False: 58]
  ------------------
  291|     58|        }
  292|     58|        {   BYTE const lastByte = ((const BYTE*)srcBuffer)[srcSize-1];
  293|     58|            bitD->bitsConsumed = lastByte ? 8 - ZSTD_highbit32(lastByte) : 0;
  ------------------
  |  Branch (293:34): [True: 58, False: 0]
  ------------------
  294|     58|            if (lastByte == 0) return ERROR(corruption_detected);  /* endMark not present */
  ------------------
  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (294:17): [True: 0, False: 58]
  ------------------
  295|     58|        }
  296|     58|        bitD->bitsConsumed += (U32)(sizeof(bitD->bitContainer) - srcSize)*8;
  297|     58|    }
  298|       |
  299|  2.18k|    return srcSize;
  300|  2.18k|}
fse_decompress.c:BIT_readBits:
  363|   415k|{
  364|   415k|    BitContainerType const value = BIT_lookBits(bitD, nbBits);
  365|   415k|    BIT_skipBits(bitD, nbBits);
  366|   415k|    return value;
  367|   415k|}
fse_decompress.c:BIT_lookBits:
  331|   415k|{
  332|       |    /* arbitrate between double-shift and shift+mask */
  333|   415k|#if 1
  334|       |    /* if bitD->bitsConsumed + nbBits > sizeof(bitD->bitContainer)*8,
  335|       |     * bitstream is likely corrupted, and result is undefined */
  336|   415k|    return BIT_getMiddleBits(bitD->bitContainer, (sizeof(bitD->bitContainer)*8) - bitD->bitsConsumed - nbBits, nbBits);
  337|       |#else
  338|       |    /* this code path is slower on my os-x laptop */
  339|       |    U32 const regMask = sizeof(bitD->bitContainer)*8 - 1;
  340|       |    return ((bitD->bitContainer << (bitD->bitsConsumed & regMask)) >> 1) >> ((regMask-nbBits) & regMask);
  341|       |#endif
  342|   415k|}
fse_decompress.c:BIT_getMiddleBits:
  308|   415k|{
  309|   415k|    U32 const regMask = sizeof(bitContainer)*8 - 1;
  310|       |    /* if start > regMask, bitstream is corrupted, and result is undefined */
  311|   415k|    assert(nbBits < BIT_MASK_SIZE);
  ------------------
  |  |   70|   415k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  312|       |    /* x86 transform & ((1 << nbBits) - 1) to bzhi instruction, it is better
  313|       |     * than accessing memory. When bmi2 instruction is not present, we consider
  314|       |     * such cpus old (pre-Haswell, 2013) and their performance is not of that
  315|       |     * importance.
  316|       |     */
  317|   415k|#if defined(__x86_64__) || defined(_M_X64)
  318|   415k|    return (bitContainer >> (start & regMask)) & ((((U64)1) << nbBits) - 1);
  319|       |#else
  320|       |    return (bitContainer >> (start & regMask)) & BIT_mask[nbBits];
  321|       |#endif
  322|   415k|}
fse_decompress.c:BIT_skipBits:
  354|   418k|{
  355|   418k|    bitD->bitsConsumed += nbBits;
  356|   418k|}
fse_decompress.c:BIT_reloadDStream:
  413|   286k|{
  414|       |    /* note : once in overflow mode, a bitstream remains in this mode until it's reset */
  415|   286k|    if (UNLIKELY(bitD->bitsConsumed > (sizeof(bitD->bitContainer)*8))) {
  ------------------
  |  |  196|   286k|#define UNLIKELY(x) (__builtin_expect((x), 0))
  |  |  ------------------
  |  |  |  Branch (196:21): [True: 2.18k, False: 284k]
  |  |  ------------------
  ------------------
  416|  2.18k|        static const BitContainerType zeroFilled = 0;
  417|  2.18k|        bitD->ptr = (const char*)&zeroFilled; /* aliasing is allowed for char */
  418|       |        /* overflow detected, erroneous scenario or end of stream: no update */
  419|  2.18k|        return BIT_DStream_overflow;
  420|  2.18k|    }
  421|       |
  422|   284k|    assert(bitD->ptr >= bitD->start);
  ------------------
  |  |   70|   284k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  423|       |
  424|   284k|    if (bitD->ptr >= bitD->limitPtr) {
  ------------------
  |  Branch (424:9): [True: 18.3k, False: 266k]
  ------------------
  425|  18.3k|        return BIT_reloadDStream_internal(bitD);
  426|  18.3k|    }
  427|   266k|    if (bitD->ptr == bitD->start) {
  ------------------
  |  Branch (427:9): [True: 233k, False: 32.9k]
  ------------------
  428|       |        /* reached end of bitStream => no update */
  429|   233k|        if (bitD->bitsConsumed < sizeof(bitD->bitContainer)*8) return BIT_DStream_endOfBuffer;
  ------------------
  |  Branch (429:13): [True: 221k, False: 11.7k]
  ------------------
  430|  11.7k|        return BIT_DStream_completed;
  431|   233k|    }
  432|       |    /* start < ptr < limitPtr => cautious update */
  433|  32.9k|    {   U32 nbBytes = bitD->bitsConsumed >> 3;
  434|  32.9k|        BIT_DStream_status result = BIT_DStream_unfinished;
  435|  32.9k|        if (nbBytes > (size_t)(bitD->ptr - bitD->start)) {
  ------------------
  |  Branch (435:13): [True: 294, False: 32.6k]
  ------------------
  436|    294|            nbBytes = (U32)(bitD->ptr - bitD->start);  /* ptr > start */
  437|    294|            result = BIT_DStream_endOfBuffer;
  438|    294|        }
  439|  32.9k|        bitD->ptr -= nbBytes;
  440|  32.9k|        bitD->bitsConsumed -= nbBytes*8;
  441|  32.9k|        bitD->bitContainer = MEM_readLEST(bitD->ptr);   /* reminder : srcSize > sizeof(bitD->bitContainer), otherwise bitD->ptr == bitD->start */
  442|  32.9k|        return result;
  443|   266k|    }
  444|   266k|}
fse_decompress.c:BIT_reloadDStream_internal:
  385|  18.3k|{
  386|  18.3k|    assert(bitD->bitsConsumed <= sizeof(bitD->bitContainer)*8);
  ------------------
  |  |   70|  18.3k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  387|  18.3k|    bitD->ptr -= bitD->bitsConsumed >> 3;
  388|  18.3k|    assert(bitD->ptr >= bitD->start);
  ------------------
  |  |   70|  18.3k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  389|  18.3k|    bitD->bitsConsumed &= 7;
  390|  18.3k|    bitD->bitContainer = MEM_readLEST(bitD->ptr);
  391|  18.3k|    return BIT_DStream_unfinished;
  392|  18.3k|}
fse_decompress.c:BIT_readBitsFast:
  372|  2.84k|{
  373|  2.84k|    BitContainerType const value = BIT_lookBitsFast(bitD, nbBits);
  374|  2.84k|    assert(nbBits >= 1);
  ------------------
  |  |   70|  2.84k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  375|  2.84k|    BIT_skipBits(bitD, nbBits);
  376|  2.84k|    return value;
  377|  2.84k|}
fse_decompress.c:BIT_lookBitsFast:
  347|  2.84k|{
  348|  2.84k|    U32 const regMask = sizeof(bitD->bitContainer)*8 - 1;
  349|  2.84k|    assert(nbBits >= 1);
  ------------------
  |  |   70|  2.84k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  350|  2.84k|    return (bitD->bitContainer << (bitD->bitsConsumed & regMask)) >> (((regMask+1)-nbBits) & regMask);
  351|  2.84k|}
fse_compress.c:BIT_initCStream:
  152|  6.52k|{
  153|  6.52k|    bitC->bitContainer = 0;
  154|  6.52k|    bitC->bitPos = 0;
  155|  6.52k|    bitC->startPtr = (char*)startPtr;
  156|  6.52k|    bitC->ptr = bitC->startPtr;
  157|  6.52k|    bitC->endPtr = bitC->startPtr + dstCapacity - sizeof(bitC->bitContainer);
  158|  6.52k|    if (dstCapacity <= sizeof(bitC->bitContainer)) return ERROR(dstSize_tooSmall);
  ------------------
  |  |   49|      2|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      2|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      2|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (158:9): [True: 2, False: 6.52k]
  ------------------
  159|  6.52k|    return 0;
  160|  6.52k|}
fse_compress.c:BIT_addBits:
  182|  1.11M|{
  183|  1.11M|    DEBUG_STATIC_ASSERT(BIT_MASK_SIZE == 32);
  ------------------
  |  |   39|  1.11M|#define DEBUG_STATIC_ASSERT(c) (void)sizeof(char[(c) ? 1 : -1])
  ------------------
  184|  1.11M|    assert(nbBits < BIT_MASK_SIZE);
  ------------------
  |  |   70|  1.11M|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  185|  1.11M|    assert(nbBits + bitC->bitPos < sizeof(bitC->bitContainer) * 8);
  ------------------
  |  |   70|  1.11M|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  186|  1.11M|    bitC->bitContainer |= BIT_getLowerBits(value, nbBits) << bitC->bitPos;
  187|  1.11M|    bitC->bitPos += nbBits;
  188|  1.11M|}
fse_compress.c:BIT_getLowerBits:
  163|  1.11M|{
  164|       |#if STATIC_BMI2 && !defined(ZSTD_NO_INTRINSICS)
  165|       |#  if (defined(__x86_64__) || defined(_M_X64)) && !defined(__ILP32__)
  166|       |    return _bzhi_u64(bitContainer, nbBits);
  167|       |#  else
  168|       |    DEBUG_STATIC_ASSERT(sizeof(bitContainer) == sizeof(U32));
  169|       |    return _bzhi_u32(bitContainer, nbBits);
  170|       |#  endif
  171|       |#else
  172|  1.11M|    assert(nbBits < BIT_MASK_SIZE);
  ------------------
  |  |   70|  1.11M|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  173|  1.11M|    return bitContainer & BIT_mask[nbBits];
  174|  1.11M|#endif
  175|  1.11M|}
fse_compress.c:BIT_flushBitsFast:
  206|   126k|{
  207|   126k|    size_t const nbBytes = bitC->bitPos >> 3;
  208|   126k|    assert(bitC->bitPos < sizeof(bitC->bitContainer) * 8);
  ------------------
  |  |   70|   126k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  209|   126k|    assert(bitC->ptr <= bitC->endPtr);
  ------------------
  |  |   70|   126k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  210|   126k|    MEM_writeLEST(bitC->ptr, bitC->bitContainer);
  211|   126k|    bitC->ptr += nbBytes;
  212|   126k|    bitC->bitPos &= 7;
  213|   126k|    bitC->bitContainer >>= nbBytes*8;
  214|   126k|}
fse_compress.c:BIT_flushBits:
  222|   173k|{
  223|   173k|    size_t const nbBytes = bitC->bitPos >> 3;
  224|   173k|    assert(bitC->bitPos < sizeof(bitC->bitContainer) * 8);
  ------------------
  |  |   70|   173k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  225|   173k|    assert(bitC->ptr <= bitC->endPtr);
  ------------------
  |  |   70|   173k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  226|   173k|    MEM_writeLEST(bitC->ptr, bitC->bitContainer);
  227|   173k|    bitC->ptr += nbBytes;
  228|   173k|    if (bitC->ptr > bitC->endPtr) bitC->ptr = bitC->endPtr;
  ------------------
  |  Branch (228:9): [True: 18, False: 173k]
  ------------------
  229|   173k|    bitC->bitPos &= 7;
  230|   173k|    bitC->bitContainer >>= nbBytes*8;
  231|   173k|}
fse_compress.c:BIT_closeCStream:
  237|  6.52k|{
  238|  6.52k|    BIT_addBitsFast(bitC, 1, 1);   /* endMark */
  239|  6.52k|    BIT_flushBits(bitC);
  240|  6.52k|    if (bitC->ptr >= bitC->endPtr) return 0; /* overflow detected */
  ------------------
  |  Branch (240:9): [True: 7, False: 6.51k]
  ------------------
  241|  6.51k|    return (size_t)(bitC->ptr - bitC->startPtr) + (bitC->bitPos > 0);
  242|  6.52k|}
fse_compress.c:BIT_addBitsFast:
  195|  6.52k|{
  196|  6.52k|    assert((value>>nbBits) == 0);
  ------------------
  |  |   70|  6.52k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  197|  6.52k|    assert(nbBits + bitC->bitPos < sizeof(bitC->bitContainer) * 8);
  ------------------
  |  |   70|  6.52k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  198|  6.52k|    bitC->bitContainer |= value << bitC->bitPos;
  199|  6.52k|    bitC->bitPos += nbBits;
  200|  6.52k|}
huf_decompress.c:BIT_initDStream:
  255|  2.74k|{
  256|  2.74k|    if (srcSize < 1) { ZSTD_memset(bitD, 0, sizeof(*bitD)); return ERROR(srcSize_wrong); }
  ------------------
  |  |   46|      0|# define ZSTD_memset(p,v,l) __builtin_memset((p),(v),(l))
  ------------------
                  if (srcSize < 1) { ZSTD_memset(bitD, 0, sizeof(*bitD)); return ERROR(srcSize_wrong); }
  ------------------
  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (256:9): [True: 0, False: 2.74k]
  ------------------
  257|       |
  258|  2.74k|    bitD->start = (const char*)srcBuffer;
  259|  2.74k|    bitD->limitPtr = bitD->start + sizeof(bitD->bitContainer);
  260|       |
  261|  2.74k|    if (srcSize >=  sizeof(bitD->bitContainer)) {  /* normal case */
  ------------------
  |  Branch (261:9): [True: 2.73k, False: 12]
  ------------------
  262|  2.73k|        bitD->ptr   = (const char*)srcBuffer + srcSize - sizeof(bitD->bitContainer);
  263|  2.73k|        bitD->bitContainer = MEM_readLEST(bitD->ptr);
  264|  2.73k|        { BYTE const lastByte = ((const BYTE*)srcBuffer)[srcSize-1];
  265|  2.73k|          bitD->bitsConsumed = lastByte ? 8 - ZSTD_highbit32(lastByte) : 0;  /* ensures bitsConsumed is always set */
  ------------------
  |  Branch (265:32): [True: 2.73k, False: 0]
  ------------------
  266|  2.73k|          if (lastByte == 0) return ERROR(GENERIC); /* endMark not present */ }
  ------------------
  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (266:15): [True: 0, False: 2.73k]
  ------------------
  267|  2.73k|    } else {
  268|     12|        bitD->ptr   = bitD->start;
  269|     12|        bitD->bitContainer = *(const BYTE*)(bitD->start);
  270|     12|        switch(srcSize)
  271|     12|        {
  272|      6|        case 7: bitD->bitContainer += (BitContainerType)(((const BYTE*)(srcBuffer))[6]) << (sizeof(bitD->bitContainer)*8 - 16);
  ------------------
  |  Branch (272:9): [True: 6, False: 6]
  ------------------
  273|      6|                ZSTD_FALLTHROUGH;
  ------------------
  |  |  288|      6|#  define ZSTD_FALLTHROUGH ; __attribute__((__fallthrough__))
  ------------------
  274|       |
  275|      6|        case 6: bitD->bitContainer += (BitContainerType)(((const BYTE*)(srcBuffer))[5]) << (sizeof(bitD->bitContainer)*8 - 24);
  ------------------
  |  Branch (275:9): [True: 0, False: 12]
  ------------------
  276|      6|                ZSTD_FALLTHROUGH;
  ------------------
  |  |  288|      6|#  define ZSTD_FALLTHROUGH ; __attribute__((__fallthrough__))
  ------------------
  277|       |
  278|      6|        case 5: bitD->bitContainer += (BitContainerType)(((const BYTE*)(srcBuffer))[4]) << (sizeof(bitD->bitContainer)*8 - 32);
  ------------------
  |  Branch (278:9): [True: 0, False: 12]
  ------------------
  279|      6|                ZSTD_FALLTHROUGH;
  ------------------
  |  |  288|      6|#  define ZSTD_FALLTHROUGH ; __attribute__((__fallthrough__))
  ------------------
  280|       |
  281|      6|        case 4: bitD->bitContainer += (BitContainerType)(((const BYTE*)(srcBuffer))[3]) << 24;
  ------------------
  |  Branch (281:9): [True: 0, False: 12]
  ------------------
  282|      6|                ZSTD_FALLTHROUGH;
  ------------------
  |  |  288|      6|#  define ZSTD_FALLTHROUGH ; __attribute__((__fallthrough__))
  ------------------
  283|       |
  284|     12|        case 3: bitD->bitContainer += (BitContainerType)(((const BYTE*)(srcBuffer))[2]) << 16;
  ------------------
  |  Branch (284:9): [True: 6, False: 6]
  ------------------
  285|     12|                ZSTD_FALLTHROUGH;
  ------------------
  |  |  288|     12|#  define ZSTD_FALLTHROUGH ; __attribute__((__fallthrough__))
  ------------------
  286|       |
  287|     12|        case 2: bitD->bitContainer += (BitContainerType)(((const BYTE*)(srcBuffer))[1]) <<  8;
  ------------------
  |  Branch (287:9): [True: 0, False: 12]
  ------------------
  288|     12|                ZSTD_FALLTHROUGH;
  ------------------
  |  |  288|     12|#  define ZSTD_FALLTHROUGH ; __attribute__((__fallthrough__))
  ------------------
  289|       |
  290|     12|        default: break;
  ------------------
  |  Branch (290:9): [True: 0, False: 12]
  ------------------
  291|     12|        }
  292|     12|        {   BYTE const lastByte = ((const BYTE*)srcBuffer)[srcSize-1];
  293|     12|            bitD->bitsConsumed = lastByte ? 8 - ZSTD_highbit32(lastByte) : 0;
  ------------------
  |  Branch (293:34): [True: 12, False: 0]
  ------------------
  294|     12|            if (lastByte == 0) return ERROR(corruption_detected);  /* endMark not present */
  ------------------
  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (294:17): [True: 0, False: 12]
  ------------------
  295|     12|        }
  296|     12|        bitD->bitsConsumed += (U32)(sizeof(bitD->bitContainer) - srcSize)*8;
  297|     12|    }
  298|       |
  299|  2.74k|    return srcSize;
  300|  2.74k|}
huf_decompress.c:BIT_reloadDStream:
  413|  72.6k|{
  414|       |    /* note : once in overflow mode, a bitstream remains in this mode until it's reset */
  415|  72.6k|    if (UNLIKELY(bitD->bitsConsumed > (sizeof(bitD->bitContainer)*8))) {
  ------------------
  |  |  196|  72.6k|#define UNLIKELY(x) (__builtin_expect((x), 0))
  |  |  ------------------
  |  |  |  Branch (196:21): [True: 0, False: 72.6k]
  |  |  ------------------
  ------------------
  416|      0|        static const BitContainerType zeroFilled = 0;
  417|      0|        bitD->ptr = (const char*)&zeroFilled; /* aliasing is allowed for char */
  418|       |        /* overflow detected, erroneous scenario or end of stream: no update */
  419|      0|        return BIT_DStream_overflow;
  420|      0|    }
  421|       |
  422|  72.6k|    assert(bitD->ptr >= bitD->start);
  ------------------
  |  |   70|  72.6k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  423|       |
  424|  72.6k|    if (bitD->ptr >= bitD->limitPtr) {
  ------------------
  |  Branch (424:9): [True: 60.4k, False: 12.1k]
  ------------------
  425|  60.4k|        return BIT_reloadDStream_internal(bitD);
  426|  60.4k|    }
  427|  12.1k|    if (bitD->ptr == bitD->start) {
  ------------------
  |  Branch (427:9): [True: 1.57k, False: 10.5k]
  ------------------
  428|       |        /* reached end of bitStream => no update */
  429|  1.57k|        if (bitD->bitsConsumed < sizeof(bitD->bitContainer)*8) return BIT_DStream_endOfBuffer;
  ------------------
  |  Branch (429:13): [True: 1.57k, False: 0]
  ------------------
  430|      0|        return BIT_DStream_completed;
  431|  1.57k|    }
  432|       |    /* start < ptr < limitPtr => cautious update */
  433|  10.5k|    {   U32 nbBytes = bitD->bitsConsumed >> 3;
  434|  10.5k|        BIT_DStream_status result = BIT_DStream_unfinished;
  435|  10.5k|        if (nbBytes > (size_t)(bitD->ptr - bitD->start)) {
  ------------------
  |  Branch (435:13): [True: 1.17k, False: 9.38k]
  ------------------
  436|  1.17k|            nbBytes = (U32)(bitD->ptr - bitD->start);  /* ptr > start */
  437|  1.17k|            result = BIT_DStream_endOfBuffer;
  438|  1.17k|        }
  439|  10.5k|        bitD->ptr -= nbBytes;
  440|  10.5k|        bitD->bitsConsumed -= nbBytes*8;
  441|  10.5k|        bitD->bitContainer = MEM_readLEST(bitD->ptr);   /* reminder : srcSize > sizeof(bitD->bitContainer), otherwise bitD->ptr == bitD->start */
  442|  10.5k|        return result;
  443|  12.1k|    }
  444|  12.1k|}
huf_decompress.c:BIT_reloadDStream_internal:
  385|  60.4k|{
  386|  60.4k|    assert(bitD->bitsConsumed <= sizeof(bitD->bitContainer)*8);
  ------------------
  |  |   70|  60.4k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  387|  60.4k|    bitD->ptr -= bitD->bitsConsumed >> 3;
  388|  60.4k|    assert(bitD->ptr >= bitD->start);
  ------------------
  |  |   70|  60.4k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  389|  60.4k|    bitD->bitsConsumed &= 7;
  390|  60.4k|    bitD->bitContainer = MEM_readLEST(bitD->ptr);
  391|  60.4k|    return BIT_DStream_unfinished;
  392|  60.4k|}
huf_decompress.c:BIT_lookBitsFast:
  347|   317k|{
  348|   317k|    U32 const regMask = sizeof(bitD->bitContainer)*8 - 1;
  349|   317k|    assert(nbBits >= 1);
  ------------------
  |  |   70|   317k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  350|   317k|    return (bitD->bitContainer << (bitD->bitsConsumed & regMask)) >> (((regMask+1)-nbBits) & regMask);
  351|   317k|}
huf_decompress.c:BIT_skipBits:
  354|   317k|{
  355|   317k|    bitD->bitsConsumed += nbBits;
  356|   317k|}
huf_decompress.c:BIT_endOfDStream:
  450|  2.74k|{
  451|  2.74k|    return ((DStream->ptr == DStream->start) && (DStream->bitsConsumed == sizeof(DStream->bitContainer)*8));
  ------------------
  |  Branch (451:13): [True: 2.74k, False: 0]
  |  Branch (451:49): [True: 2.74k, False: 0]
  ------------------
  452|  2.74k|}

zstd_decompress_block.c:ZSTD_wrappedPtrDiff:
  375|  4.86k|{
  376|  4.86k|    return lhs - rhs;
  377|  4.86k|}
zstd_decompress_block.c:ZSTD_maybeNullPtrAdd:
  412|  9.64k|{
  413|  9.64k|    return add > 0 ? (char*)ptr + add : ptr;
  ------------------
  |  Branch (413:12): [True: 9.64k, False: 0]
  ------------------
  414|  9.64k|}
huf_decompress.c:ZSTD_maybeNullPtrAdd:
  412|  2.74k|{
  413|  2.74k|    return add > 0 ? (char*)ptr + add : ptr;
  ------------------
  |  Branch (413:12): [True: 2.74k, False: 0]
  ------------------
  414|  2.74k|}

zstd_compress.c:ZSTD_cpuid:
   32|     28|MEM_STATIC ZSTD_cpuid_t ZSTD_cpuid(void) {
   33|     28|    U32 f1c = 0;
   34|     28|    U32 f1d = 0;
   35|     28|    U32 f7b = 0;
   36|     28|    U32 f7c = 0;
   37|       |#if defined(_MSC_VER) && (defined(_M_X64) || defined(_M_IX86))
   38|       |#if !defined(_M_X64) || !defined(__clang__) || __clang_major__ >= 16
   39|       |    int reg[4];
   40|       |    __cpuid((int*)reg, 0);
   41|       |    {
   42|       |        int const n = reg[0];
   43|       |        if (n >= 1) {
   44|       |            __cpuid((int*)reg, 1);
   45|       |            f1c = (U32)reg[2];
   46|       |            f1d = (U32)reg[3];
   47|       |        }
   48|       |        if (n >= 7) {
   49|       |            __cpuidex((int*)reg, 7, 0);
   50|       |            f7b = (U32)reg[1];
   51|       |            f7c = (U32)reg[2];
   52|       |        }
   53|       |    }
   54|       |#else
   55|       |    /* Clang compiler has a bug (fixed in https://reviews.llvm.org/D101338) in
   56|       |     * which the `__cpuid` intrinsic does not save and restore `rbx` as it needs
   57|       |     * to due to being a reserved register. So in that case, do the `cpuid`
   58|       |     * ourselves. Clang supports inline assembly anyway.
   59|       |     */
   60|       |    U32 n;
   61|       |    __asm__(
   62|       |        "pushq %%rbx\n\t"
   63|       |        "cpuid\n\t"
   64|       |        "popq %%rbx\n\t"
   65|       |        : "=a"(n)
   66|       |        : "a"(0)
   67|       |        : "rcx", "rdx");
   68|       |    if (n >= 1) {
   69|       |      U32 f1a;
   70|       |      __asm__(
   71|       |          "pushq %%rbx\n\t"
   72|       |          "cpuid\n\t"
   73|       |          "popq %%rbx\n\t"
   74|       |          : "=a"(f1a), "=c"(f1c), "=d"(f1d)
   75|       |          : "a"(1)
   76|       |          :);
   77|       |    }
   78|       |    if (n >= 7) {
   79|       |      __asm__(
   80|       |          "pushq %%rbx\n\t"
   81|       |          "cpuid\n\t"
   82|       |          "movq %%rbx, %%rax\n\t"
   83|       |          "popq %%rbx"
   84|       |          : "=a"(f7b), "=c"(f7c)
   85|       |          : "a"(7), "c"(0)
   86|       |          : "rdx");
   87|       |    }
   88|       |#endif
   89|       |#elif defined(__i386__) && defined(__PIC__) && !defined(__clang__) && defined(__GNUC__)
   90|       |    /* The following block like the normal cpuid branch below, but gcc
   91|       |     * reserves ebx for use of its pic register so we must specially
   92|       |     * handle the save and restore to avoid clobbering the register
   93|       |     */
   94|       |    U32 n;
   95|       |    __asm__(
   96|       |        "pushl %%ebx\n\t"
   97|       |        "cpuid\n\t"
   98|       |        "popl %%ebx\n\t"
   99|       |        : "=a"(n)
  100|       |        : "a"(0)
  101|       |        : "ecx", "edx");
  102|       |    if (n >= 1) {
  103|       |      U32 f1a;
  104|       |      __asm__(
  105|       |          "pushl %%ebx\n\t"
  106|       |          "cpuid\n\t"
  107|       |          "popl %%ebx\n\t"
  108|       |          : "=a"(f1a), "=c"(f1c), "=d"(f1d)
  109|       |          : "a"(1));
  110|       |    }
  111|       |    if (n >= 7) {
  112|       |      __asm__(
  113|       |          "pushl %%ebx\n\t"
  114|       |          "cpuid\n\t"
  115|       |          "movl %%ebx, %%eax\n\t"
  116|       |          "popl %%ebx"
  117|       |          : "=a"(f7b), "=c"(f7c)
  118|       |          : "a"(7), "c"(0)
  119|       |          : "edx");
  120|       |    }
  121|       |#elif defined(__x86_64__) || defined(_M_X64) || defined(__i386__)
  122|       |    U32 n;
  123|     28|    __asm__("cpuid" : "=a"(n) : "a"(0) : "ebx", "ecx", "edx");
  124|     28|    if (n >= 1) {
  ------------------
  |  Branch (124:9): [True: 28, False: 0]
  ------------------
  125|     28|      U32 f1a;
  126|     28|      __asm__("cpuid" : "=a"(f1a), "=c"(f1c), "=d"(f1d) : "a"(1) : "ebx");
  127|     28|    }
  128|     28|    if (n >= 7) {
  ------------------
  |  Branch (128:9): [True: 28, False: 0]
  ------------------
  129|     28|      U32 f7a;
  130|     28|      __asm__("cpuid"
  131|     28|              : "=a"(f7a), "=b"(f7b), "=c"(f7c)
  132|     28|              : "a"(7), "c"(0)
  133|     28|              : "edx");
  134|     28|    }
  135|     28|#endif
  136|     28|    {
  137|     28|        ZSTD_cpuid_t cpuid;
  138|     28|        cpuid.f1c = f1c;
  139|     28|        cpuid.f1d = f1d;
  140|     28|        cpuid.f7b = f7b;
  141|     28|        cpuid.f7c = f7c;
  142|     28|        return cpuid;
  143|     28|    }
  144|     28|}
zstd_compress.c:ZSTD_cpuid_bmi1:
  147|     28|  MEM_STATIC int ZSTD_cpuid_##name(ZSTD_cpuid_t const cpuid) {                 \
  148|     28|    return ((cpuid.r) & (1U << bit)) != 0;                                     \
  149|     28|  }
zstd_compress.c:ZSTD_cpuid_bmi2:
  147|     28|  MEM_STATIC int ZSTD_cpuid_##name(ZSTD_cpuid_t const cpuid) {                 \
  148|     28|    return ((cpuid.r) & (1U << bit)) != 0;                                     \
  149|     28|  }
zstd_decompress.c:ZSTD_cpuid:
   32|    404|MEM_STATIC ZSTD_cpuid_t ZSTD_cpuid(void) {
   33|    404|    U32 f1c = 0;
   34|    404|    U32 f1d = 0;
   35|    404|    U32 f7b = 0;
   36|    404|    U32 f7c = 0;
   37|       |#if defined(_MSC_VER) && (defined(_M_X64) || defined(_M_IX86))
   38|       |#if !defined(_M_X64) || !defined(__clang__) || __clang_major__ >= 16
   39|       |    int reg[4];
   40|       |    __cpuid((int*)reg, 0);
   41|       |    {
   42|       |        int const n = reg[0];
   43|       |        if (n >= 1) {
   44|       |            __cpuid((int*)reg, 1);
   45|       |            f1c = (U32)reg[2];
   46|       |            f1d = (U32)reg[3];
   47|       |        }
   48|       |        if (n >= 7) {
   49|       |            __cpuidex((int*)reg, 7, 0);
   50|       |            f7b = (U32)reg[1];
   51|       |            f7c = (U32)reg[2];
   52|       |        }
   53|       |    }
   54|       |#else
   55|       |    /* Clang compiler has a bug (fixed in https://reviews.llvm.org/D101338) in
   56|       |     * which the `__cpuid` intrinsic does not save and restore `rbx` as it needs
   57|       |     * to due to being a reserved register. So in that case, do the `cpuid`
   58|       |     * ourselves. Clang supports inline assembly anyway.
   59|       |     */
   60|       |    U32 n;
   61|       |    __asm__(
   62|       |        "pushq %%rbx\n\t"
   63|       |        "cpuid\n\t"
   64|       |        "popq %%rbx\n\t"
   65|       |        : "=a"(n)
   66|       |        : "a"(0)
   67|       |        : "rcx", "rdx");
   68|       |    if (n >= 1) {
   69|       |      U32 f1a;
   70|       |      __asm__(
   71|       |          "pushq %%rbx\n\t"
   72|       |          "cpuid\n\t"
   73|       |          "popq %%rbx\n\t"
   74|       |          : "=a"(f1a), "=c"(f1c), "=d"(f1d)
   75|       |          : "a"(1)
   76|       |          :);
   77|       |    }
   78|       |    if (n >= 7) {
   79|       |      __asm__(
   80|       |          "pushq %%rbx\n\t"
   81|       |          "cpuid\n\t"
   82|       |          "movq %%rbx, %%rax\n\t"
   83|       |          "popq %%rbx"
   84|       |          : "=a"(f7b), "=c"(f7c)
   85|       |          : "a"(7), "c"(0)
   86|       |          : "rdx");
   87|       |    }
   88|       |#endif
   89|       |#elif defined(__i386__) && defined(__PIC__) && !defined(__clang__) && defined(__GNUC__)
   90|       |    /* The following block like the normal cpuid branch below, but gcc
   91|       |     * reserves ebx for use of its pic register so we must specially
   92|       |     * handle the save and restore to avoid clobbering the register
   93|       |     */
   94|       |    U32 n;
   95|       |    __asm__(
   96|       |        "pushl %%ebx\n\t"
   97|       |        "cpuid\n\t"
   98|       |        "popl %%ebx\n\t"
   99|       |        : "=a"(n)
  100|       |        : "a"(0)
  101|       |        : "ecx", "edx");
  102|       |    if (n >= 1) {
  103|       |      U32 f1a;
  104|       |      __asm__(
  105|       |          "pushl %%ebx\n\t"
  106|       |          "cpuid\n\t"
  107|       |          "popl %%ebx\n\t"
  108|       |          : "=a"(f1a), "=c"(f1c), "=d"(f1d)
  109|       |          : "a"(1));
  110|       |    }
  111|       |    if (n >= 7) {
  112|       |      __asm__(
  113|       |          "pushl %%ebx\n\t"
  114|       |          "cpuid\n\t"
  115|       |          "movl %%ebx, %%eax\n\t"
  116|       |          "popl %%ebx"
  117|       |          : "=a"(f7b), "=c"(f7c)
  118|       |          : "a"(7), "c"(0)
  119|       |          : "edx");
  120|       |    }
  121|       |#elif defined(__x86_64__) || defined(_M_X64) || defined(__i386__)
  122|       |    U32 n;
  123|    404|    __asm__("cpuid" : "=a"(n) : "a"(0) : "ebx", "ecx", "edx");
  124|    404|    if (n >= 1) {
  ------------------
  |  Branch (124:9): [True: 404, False: 0]
  ------------------
  125|    404|      U32 f1a;
  126|    404|      __asm__("cpuid" : "=a"(f1a), "=c"(f1c), "=d"(f1d) : "a"(1) : "ebx");
  127|    404|    }
  128|    404|    if (n >= 7) {
  ------------------
  |  Branch (128:9): [True: 404, False: 0]
  ------------------
  129|    404|      U32 f7a;
  130|    404|      __asm__("cpuid"
  131|    404|              : "=a"(f7a), "=b"(f7b), "=c"(f7c)
  132|    404|              : "a"(7), "c"(0)
  133|    404|              : "edx");
  134|    404|    }
  135|    404|#endif
  136|    404|    {
  137|    404|        ZSTD_cpuid_t cpuid;
  138|    404|        cpuid.f1c = f1c;
  139|    404|        cpuid.f1d = f1d;
  140|    404|        cpuid.f7b = f7b;
  141|    404|        cpuid.f7c = f7c;
  142|    404|        return cpuid;
  143|    404|    }
  144|    404|}
zstd_decompress.c:ZSTD_cpuid_bmi1:
  147|    404|  MEM_STATIC int ZSTD_cpuid_##name(ZSTD_cpuid_t const cpuid) {                 \
  148|    404|    return ((cpuid.r) & (1U << bit)) != 0;                                     \
  149|    404|  }
zstd_decompress.c:ZSTD_cpuid_bmi2:
  147|    404|  MEM_STATIC int ZSTD_cpuid_##name(ZSTD_cpuid_t const cpuid) {                 \
  148|    404|    return ((cpuid.r) & (1U << bit)) != 0;                                     \
  149|    404|  }

FSE_isError:
   32|  2.23k|unsigned FSE_isError(size_t code) { return ERR_isError(code); }
FSE_readNCount_bmi2:
  212|  2.89k|{
  213|  2.89k|    if (ZSTD_USE_BMI2(bmi2)) {
  ------------------
  |  |   36|  2.89k|#  define ZSTD_USE_BMI2(bmi2) (bmi2)
  |  |  ------------------
  |  |  |  Branch (36:31): [True: 2.18k, False: 711]
  |  |  ------------------
  ------------------
  214|  2.18k|        return FSE_readNCount_body_bmi2(normalizedCounter, maxSVPtr, tableLogPtr, headerBuffer, hbSize);
  215|  2.18k|    }
  216|    711|    (void)bmi2;
  217|    711|    return FSE_readNCount_body_default(normalizedCounter, maxSVPtr, tableLogPtr, headerBuffer, hbSize);
  218|  2.89k|}
FSE_readNCount:
  223|    711|{
  224|    711|    return FSE_readNCount_bmi2(normalizedCounter, maxSVPtr, tableLogPtr, headerBuffer, hbSize, /* bmi2 */ 0);
  225|    711|}
HUF_readStats_wksp:
  335|  2.76k|{
  336|  2.76k|    if (ZSTD_USE_BMI2(flags & HUF_flags_bmi2)) {
  ------------------
  |  |   36|  2.76k|#  define ZSTD_USE_BMI2(bmi2) (bmi2)
  |  |  ------------------
  |  |  |  Branch (36:31): [True: 2.76k, False: 0]
  |  |  ------------------
  ------------------
  337|  2.76k|        return HUF_readStats_body_bmi2(huffWeight, hwSize, rankStats, nbSymbolsPtr, tableLogPtr, src, srcSize, workSpace, wkspSize);
  338|  2.76k|    }
  339|      0|    (void)flags;
  340|      0|    return HUF_readStats_body_default(huffWeight, hwSize, rankStats, nbSymbolsPtr, tableLogPtr, src, srcSize, workSpace, wkspSize);
  341|  2.76k|}
entropy_common.c:FSE_readNCount_body_bmi2:
  202|  2.18k|{
  203|  2.18k|    return FSE_readNCount_body(normalizedCounter, maxSVPtr, tableLogPtr, headerBuffer, hbSize);
  204|  2.18k|}
entropy_common.c:FSE_readNCount_body:
   45|  2.89k|{
   46|  2.89k|    const BYTE* const istart = (const BYTE*) headerBuffer;
   47|  2.89k|    const BYTE* const iend = istart + hbSize;
   48|  2.89k|    const BYTE* ip = istart;
   49|  2.89k|    int nbBits;
   50|  2.89k|    int remaining;
   51|  2.89k|    int threshold;
   52|  2.89k|    U32 bitStream;
   53|  2.89k|    int bitCount;
   54|  2.89k|    unsigned charnum = 0;
   55|  2.89k|    unsigned const maxSV1 = *maxSVPtr + 1;
   56|  2.89k|    int previous0 = 0;
   57|       |
   58|  2.89k|    if (hbSize < 8) {
  ------------------
  |  Branch (58:9): [True: 53, False: 2.84k]
  ------------------
   59|       |        /* This function only works when hbSize >= 8 */
   60|     53|        char buffer[8] = {0};
   61|     53|        ZSTD_memcpy(buffer, headerBuffer, hbSize);
  ------------------
  |  |   44|     53|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  ------------------
   62|     53|        {   size_t const countSize = FSE_readNCount(normalizedCounter, maxSVPtr, tableLogPtr,
   63|     53|                                                    buffer, sizeof(buffer));
   64|     53|            if (FSE_isError(countSize)) return countSize;
  ------------------
  |  Branch (64:17): [True: 4, False: 49]
  ------------------
   65|     49|            if (countSize > hbSize) return ERROR(corruption_detected);
  ------------------
  |  |   49|      9|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      9|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      9|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (65:17): [True: 9, False: 40]
  ------------------
   66|     40|            return countSize;
   67|     49|    }   }
   68|  2.84k|    assert(hbSize >= 8);
  ------------------
  |  |   70|  2.84k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
   69|       |
   70|       |    /* init */
   71|  2.84k|    ZSTD_memset(normalizedCounter, 0, (*maxSVPtr+1) * sizeof(normalizedCounter[0]));   /* all symbols not present in NCount have a frequency of 0 */
  ------------------
  |  |   46|  2.84k|# define ZSTD_memset(p,v,l) __builtin_memset((p),(v),(l))
  ------------------
   72|  2.84k|    bitStream = MEM_readLE32(ip);
   73|  2.84k|    nbBits = (bitStream & 0xF) + FSE_MIN_TABLELOG;   /* extract tableLog */
  ------------------
  |  |  616|  2.84k|#define FSE_MIN_TABLELOG 5
  ------------------
   74|  2.84k|    if (nbBits > FSE_TABLELOG_ABSOLUTE_MAX) return ERROR(tableLog_tooLarge);
  ------------------
  |  |  618|  2.84k|#define FSE_TABLELOG_ABSOLUTE_MAX 15
  ------------------
                  if (nbBits > FSE_TABLELOG_ABSOLUTE_MAX) return ERROR(tableLog_tooLarge);
  ------------------
  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (74:9): [True: 0, False: 2.84k]
  ------------------
   75|  2.84k|    bitStream >>= 4;
   76|  2.84k|    bitCount = 4;
   77|  2.84k|    *tableLogPtr = nbBits;
   78|  2.84k|    remaining = (1<<nbBits)+1;
   79|  2.84k|    threshold = 1<<nbBits;
   80|  2.84k|    nbBits++;
   81|       |
   82|  13.7k|    for (;;) {
   83|  13.7k|        if (previous0) {
  ------------------
  |  Branch (83:13): [True: 1.07k, False: 12.6k]
  ------------------
   84|       |            /* Count the number of repeats. Each time the
   85|       |             * 2-bit repeat code is 0b11 there is another
   86|       |             * repeat.
   87|       |             * Avoid UB by setting the high bit to 1.
   88|       |             */
   89|  1.07k|            int repeats = ZSTD_countTrailingZeros32(~bitStream | 0x80000000) >> 1;
   90|  1.07k|            while (repeats >= 12) {
  ------------------
  |  Branch (90:20): [True: 0, False: 1.07k]
  ------------------
   91|      0|                charnum += 3 * 12;
   92|      0|                if (LIKELY(ip <= iend-7)) {
  ------------------
  |  |  195|      0|#define LIKELY(x) (__builtin_expect((x), 1))
  |  |  ------------------
  |  |  |  Branch (195:19): [True: 0, False: 0]
  |  |  ------------------
  ------------------
   93|      0|                    ip += 3;
   94|      0|                } else {
   95|      0|                    bitCount -= (int)(8 * (iend - 7 - ip));
   96|      0|                    bitCount &= 31;
   97|      0|                    ip = iend - 4;
   98|      0|                }
   99|      0|                bitStream = MEM_readLE32(ip) >> bitCount;
  100|      0|                repeats = ZSTD_countTrailingZeros32(~bitStream | 0x80000000) >> 1;
  101|      0|            }
  102|  1.07k|            charnum += 3 * repeats;
  103|  1.07k|            bitStream >>= 2 * repeats;
  104|  1.07k|            bitCount += 2 * repeats;
  105|       |
  106|       |            /* Add the final repeat which isn't 0b11. */
  107|  1.07k|            assert((bitStream & 3) < 3);
  ------------------
  |  |   70|  1.07k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  108|  1.07k|            charnum += bitStream & 3;
  109|  1.07k|            bitCount += 2;
  110|       |
  111|       |            /* This is an error, but break and return an error
  112|       |             * at the end, because returning out of a loop makes
  113|       |             * it harder for the compiler to optimize.
  114|       |             */
  115|  1.07k|            if (charnum >= maxSV1) break;
  ------------------
  |  Branch (115:17): [True: 0, False: 1.07k]
  ------------------
  116|       |
  117|       |            /* We don't need to set the normalized count to 0
  118|       |             * because we already memset the whole buffer to 0.
  119|       |             */
  120|       |
  121|  1.07k|            if (LIKELY(ip <= iend-7) || (ip + (bitCount>>3) <= iend-4)) {
  ------------------
  |  |  195|  2.14k|#define LIKELY(x) (__builtin_expect((x), 1))
  |  |  ------------------
  |  |  |  Branch (195:19): [True: 1.05k, False: 17]
  |  |  ------------------
  ------------------
  |  Branch (121:41): [True: 17, False: 0]
  ------------------
  122|  1.07k|                assert((bitCount >> 3) <= 3); /* For first condition to work */
  ------------------
  |  |   70|  1.07k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  123|  1.07k|                ip += bitCount>>3;
  124|  1.07k|                bitCount &= 7;
  125|  1.07k|            } else {
  126|      0|                bitCount -= (int)(8 * (iend - 4 - ip));
  127|      0|                bitCount &= 31;
  128|      0|                ip = iend - 4;
  129|      0|            }
  130|  1.07k|            bitStream = MEM_readLE32(ip) >> bitCount;
  131|  1.07k|        }
  132|  13.7k|        {
  133|  13.7k|            int const max = (2*threshold-1) - remaining;
  134|  13.7k|            int count;
  135|       |
  136|  13.7k|            if ((bitStream & (threshold-1)) < (U32)max) {
  ------------------
  |  Branch (136:17): [True: 5.13k, False: 8.60k]
  ------------------
  137|  5.13k|                count = bitStream & (threshold-1);
  138|  5.13k|                bitCount += nbBits-1;
  139|  8.60k|            } else {
  140|  8.60k|                count = bitStream & (2*threshold-1);
  141|  8.60k|                if (count >= threshold) count -= max;
  ------------------
  |  Branch (141:21): [True: 5.75k, False: 2.84k]
  ------------------
  142|  8.60k|                bitCount += nbBits;
  143|  8.60k|            }
  144|       |
  145|  13.7k|            count--;   /* extra accuracy */
  146|       |            /* When it matters (small blocks), this is a
  147|       |             * predictable branch, because we don't use -1.
  148|       |             */
  149|  13.7k|            if (count >= 0) {
  ------------------
  |  Branch (149:17): [True: 13.3k, False: 422]
  ------------------
  150|  13.3k|                remaining -= count;
  151|  13.3k|            } else {
  152|    422|                assert(count == -1);
  ------------------
  |  |   70|    422|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  153|    422|                remaining += count;
  154|    422|            }
  155|  13.7k|            normalizedCounter[charnum++] = (short)count;
  156|  13.7k|            previous0 = !count;
  157|       |
  158|  13.7k|            assert(threshold > 1);
  ------------------
  |  |   70|  13.7k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  159|  13.7k|            if (remaining < threshold) {
  ------------------
  |  Branch (159:17): [True: 8.82k, False: 4.91k]
  ------------------
  160|       |                /* This branch can be folded into the
  161|       |                 * threshold update condition because we
  162|       |                 * know that threshold > 1.
  163|       |                 */
  164|  8.82k|                if (remaining <= 1) break;
  ------------------
  |  Branch (164:21): [True: 2.83k, False: 5.98k]
  ------------------
  165|  5.98k|                nbBits = ZSTD_highbit32(remaining) + 1;
  166|  5.98k|                threshold = 1 << (nbBits - 1);
  167|  5.98k|            }
  168|  10.9k|            if (charnum >= maxSV1) break;
  ------------------
  |  Branch (168:17): [True: 4, False: 10.8k]
  ------------------
  169|       |
  170|  10.8k|            if (LIKELY(ip <= iend-7) || (ip + (bitCount>>3) <= iend-4)) {
  ------------------
  |  |  195|  21.7k|#define LIKELY(x) (__builtin_expect((x), 1))
  |  |  ------------------
  |  |  |  Branch (195:19): [True: 10.4k, False: 425]
  |  |  ------------------
  ------------------
  |  Branch (170:41): [True: 133, False: 292]
  ------------------
  171|  10.6k|                ip += bitCount>>3;
  172|  10.6k|                bitCount &= 7;
  173|  10.6k|            } else {
  174|    292|                bitCount -= (int)(8 * (iend - 4 - ip));
  175|    292|                bitCount &= 31;
  176|    292|                ip = iend - 4;
  177|    292|            }
  178|  10.8k|            bitStream = MEM_readLE32(ip) >> bitCount;
  179|  10.8k|    }   }
  180|  2.84k|    if (remaining != 1) return ERROR(corruption_detected);
  ------------------
  |  |   49|      4|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      4|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      4|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (180:9): [True: 4, False: 2.83k]
  ------------------
  181|       |    /* Only possible when there are too many zeros. */
  182|  2.83k|    if (charnum > maxSV1) return ERROR(maxSymbolValue_tooSmall);
  ------------------
  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (182:9): [True: 0, False: 2.83k]
  ------------------
  183|  2.83k|    if (bitCount > 32) return ERROR(corruption_detected);
  ------------------
  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (183:9): [True: 0, False: 2.83k]
  ------------------
  184|  2.83k|    *maxSVPtr = charnum-1;
  185|       |
  186|  2.83k|    ip += (bitCount+7)>>3;
  187|  2.83k|    return ip-istart;
  188|  2.83k|}
entropy_common.c:FSE_readNCount_body_default:
  194|    711|{
  195|    711|    return FSE_readNCount_body(normalizedCounter, maxSVPtr, tableLogPtr, headerBuffer, hbSize);
  196|    711|}
entropy_common.c:HUF_readStats_body_bmi2:
  323|  2.76k|{
  324|  2.76k|    return HUF_readStats_body(huffWeight, hwSize, rankStats, nbSymbolsPtr, tableLogPtr, src, srcSize, workSpace, wkspSize, 1);
  325|  2.76k|}
entropy_common.c:HUF_readStats_body:
  249|  2.76k|{
  250|  2.76k|    U32 weightTotal;
  251|  2.76k|    const BYTE* ip = (const BYTE*) src;
  252|  2.76k|    size_t iSize;
  253|  2.76k|    size_t oSize;
  254|       |
  255|  2.76k|    if (!srcSize) return ERROR(srcSize_wrong);
  ------------------
  |  |   49|      9|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      9|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      9|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (255:9): [True: 9, False: 2.75k]
  ------------------
  256|  2.75k|    iSize = ip[0];
  257|       |    /* ZSTD_memset(huffWeight, 0, hwSize);   *//* is not necessary, even though some analyzer complain ... */
  258|       |
  259|  2.75k|    if (iSize >= 128) {  /* special header */
  ------------------
  |  Branch (259:9): [True: 571, False: 2.18k]
  ------------------
  260|    571|        oSize = iSize - 127;
  261|    571|        iSize = ((oSize+1)/2);
  262|    571|        if (iSize+1 > srcSize) return ERROR(srcSize_wrong);
  ------------------
  |  |   49|      7|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      7|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      7|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (262:13): [True: 7, False: 564]
  ------------------
  263|    564|        if (oSize >= hwSize) return ERROR(corruption_detected);
  ------------------
  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (263:13): [True: 0, False: 564]
  ------------------
  264|    564|        ip += 1;
  265|    564|        {   U32 n;
  266|  4.25k|            for (n=0; n<oSize; n+=2) {
  ------------------
  |  Branch (266:23): [True: 3.68k, False: 564]
  ------------------
  267|  3.68k|                huffWeight[n]   = ip[n/2] >> 4;
  268|  3.68k|                huffWeight[n+1] = ip[n/2] & 15;
  269|  3.68k|    }   }   }
  270|  2.18k|    else  {   /* header compressed with FSE (normal case) */
  271|  2.18k|        if (iSize+1 > srcSize) return ERROR(srcSize_wrong);
  ------------------
  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (271:13): [True: 0, False: 2.18k]
  ------------------
  272|       |        /* max (hwSize-1) values decoded, as last one is implied */
  273|  2.18k|        oSize = FSE_decompress_wksp_bmi2(huffWeight, hwSize-1, ip+1, iSize, 6, workSpace, wkspSize, bmi2);
  274|  2.18k|        if (FSE_isError(oSize)) return oSize;
  ------------------
  |  Branch (274:13): [True: 1, False: 2.18k]
  ------------------
  275|  2.18k|    }
  276|       |
  277|       |    /* collect weight stats */
  278|  2.74k|    ZSTD_memset(rankStats, 0, (HUF_TABLELOG_MAX + 1) * sizeof(U32));
  ------------------
  |  |   46|  2.74k|# define ZSTD_memset(p,v,l) __builtin_memset((p),(v),(l))
  ------------------
  279|  2.74k|    weightTotal = 0;
  280|   424k|    {   U32 n; for (n=0; n<oSize; n++) {
  ------------------
  |  Branch (280:26): [True: 421k, False: 2.74k]
  ------------------
  281|   421k|            if (huffWeight[n] > HUF_TABLELOG_MAX) return ERROR(corruption_detected);
  ------------------
  |  |   37|   421k|#define HUF_TABLELOG_MAX      12      /* max runtime value of tableLog (due to static allocation); can be modified up to HUF_TABLELOG_ABSOLUTEMAX */
  ------------------
                          if (huffWeight[n] > HUF_TABLELOG_MAX) return ERROR(corruption_detected);
  ------------------
  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (281:17): [True: 0, False: 421k]
  ------------------
  282|   421k|            rankStats[huffWeight[n]]++;
  283|   421k|            weightTotal += (1 << huffWeight[n]) >> 1;
  284|   421k|    }   }
  285|  2.74k|    if (weightTotal == 0) return ERROR(corruption_detected);
  ------------------
  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (285:9): [True: 0, False: 2.74k]
  ------------------
  286|       |
  287|       |    /* get last non-null symbol weight (implied, total must be 2^n) */
  288|  2.74k|    {   U32 const tableLog = ZSTD_highbit32(weightTotal) + 1;
  289|  2.74k|        if (tableLog > HUF_TABLELOG_MAX) return ERROR(corruption_detected);
  ------------------
  |  |   37|  2.74k|#define HUF_TABLELOG_MAX      12      /* max runtime value of tableLog (due to static allocation); can be modified up to HUF_TABLELOG_ABSOLUTEMAX */
  ------------------
                      if (tableLog > HUF_TABLELOG_MAX) return ERROR(corruption_detected);
  ------------------
  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (289:13): [True: 0, False: 2.74k]
  ------------------
  290|  2.74k|        *tableLogPtr = tableLog;
  291|       |        /* determine last weight */
  292|  2.74k|        {   U32 const total = 1 << tableLog;
  293|  2.74k|            U32 const rest = total - weightTotal;
  294|  2.74k|            U32 const verif = 1 << ZSTD_highbit32(rest);
  295|  2.74k|            U32 const lastWeight = ZSTD_highbit32(rest) + 1;
  296|  2.74k|            if (verif != rest) return ERROR(corruption_detected);    /* last value must be a clean power of 2 */
  ------------------
  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (296:17): [True: 0, False: 2.74k]
  ------------------
  297|  2.74k|            huffWeight[oSize] = (BYTE)lastWeight;
  298|  2.74k|            rankStats[lastWeight]++;
  299|  2.74k|    }   }
  300|       |
  301|       |    /* check tree construction validity */
  302|  2.74k|    if ((rankStats[1] < 2) || (rankStats[1] & 1)) return ERROR(corruption_detected);   /* by construction : at least 2 elts of rank 1, must be even */
  ------------------
  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (302:9): [True: 0, False: 2.74k]
  |  Branch (302:31): [True: 0, False: 2.74k]
  ------------------
  303|       |
  304|       |    /* results */
  305|  2.74k|    *nbSymbolsPtr = (U32)(oSize+1);
  306|  2.74k|    return iSize+1;
  307|  2.74k|}

zstd_common.c:ERR_isError:
   52|  14.6k|ERR_STATIC unsigned ERR_isError(size_t code) { return (code > ERROR(maxCode)); }
  ------------------
  |  |   49|  14.6k|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|  14.6k|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|  14.6k|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
zstd_common.c:ERR_getErrorCode:
   54|  5.14k|ERR_STATIC ERR_enum ERR_getErrorCode(size_t code) { if (!ERR_isError(code)) return (ERR_enum)0; return (ERR_enum) (0-code); }
  ------------------
  |  Branch (54:57): [True: 4.78k, False: 359]
  ------------------
zstd_compress.c:ERR_isError:
   52|   115k|ERR_STATIC unsigned ERR_isError(size_t code) { return (code > ERROR(maxCode)); }
  ------------------
  |  |   49|   115k|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|   115k|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|   115k|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
zstd_compress_literals.c:ERR_isError:
   52|  1.84k|ERR_STATIC unsigned ERR_isError(size_t code) { return (code > ERROR(maxCode)); }
  ------------------
  |  |   49|  1.84k|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|  1.84k|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|  1.84k|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
zstd_compress_sequences.c:ERR_isError:
   52|  19.1k|ERR_STATIC unsigned ERR_isError(size_t code) { return (code > ERROR(maxCode)); }
  ------------------
  |  |   49|  19.1k|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|  19.1k|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|  19.1k|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
zstd_ddict.c:ERR_isError:
   52|     33|ERR_STATIC unsigned ERR_isError(size_t code) { return (code > ERROR(maxCode)); }
  ------------------
  |  |   49|     33|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|     33|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|     33|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
zstd_decompress.c:ERR_isError:
   52|  41.0k|ERR_STATIC unsigned ERR_isError(size_t code) { return (code > ERROR(maxCode)); }
  ------------------
  |  |   49|  41.0k|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|  41.0k|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|  41.0k|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
zstd_decompress_block.c:ERR_isError:
   52|  45.5k|ERR_STATIC unsigned ERR_isError(size_t code) { return (code > ERROR(maxCode)); }
  ------------------
  |  |   49|  45.5k|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|  45.5k|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|  45.5k|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
entropy_common.c:ERR_isError:
   52|  2.23k|ERR_STATIC unsigned ERR_isError(size_t code) { return (code > ERROR(maxCode)); }
  ------------------
  |  |   49|  2.23k|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|  2.23k|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|  2.23k|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
fse_decompress.c:ERR_isError:
   52|  6.54k|ERR_STATIC unsigned ERR_isError(size_t code) { return (code > ERROR(maxCode)); }
  ------------------
  |  |   49|  6.54k|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|  6.54k|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|  6.54k|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
fse_compress.c:ERR_isError:
   52|  6.60k|ERR_STATIC unsigned ERR_isError(size_t code) { return (code > ERROR(maxCode)); }
  ------------------
  |  |   49|  6.60k|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|  6.60k|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|  6.60k|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
huf_compress.c:ERR_isError:
   52|  55.4k|ERR_STATIC unsigned ERR_isError(size_t code) { return (code > ERROR(maxCode)); }
  ------------------
  |  |   49|  55.4k|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|  55.4k|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|  55.4k|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
huf_decompress.c:ERR_isError:
   52|  8.27k|ERR_STATIC unsigned ERR_isError(size_t code) { return (code > ERROR(maxCode)); }
  ------------------
  |  |   49|  8.27k|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|  8.27k|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|  8.27k|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------

zstd_compress_sequences.c:FSE_initCState:
  429|  8.09k|{
  430|  8.09k|    const void* ptr = ct;
  431|  8.09k|    const U16* u16ptr = (const U16*) ptr;
  432|  8.09k|    const U32 tableLog = MEM_read16(ptr);
  433|  8.09k|    statePtr->value = (ptrdiff_t)1<<tableLog;
  434|  8.09k|    statePtr->stateTable = u16ptr+2;
  435|  8.09k|    statePtr->symbolTT = ct + 1 + (tableLog ? (1<<(tableLog-1)) : 1);
  ------------------
  |  Branch (435:36): [True: 7.86k, False: 231]
  ------------------
  436|  8.09k|    statePtr->stateLog = tableLog;
  437|  8.09k|}
zstd_compress_sequences.c:FSE_initCState2:
  444|  8.09k|{
  445|  8.09k|    FSE_initCState(statePtr, ct);
  446|  8.09k|    {   const FSE_symbolCompressionTransform symbolTT = ((const FSE_symbolCompressionTransform*)(statePtr->symbolTT))[symbol];
  447|  8.09k|        const U16* stateTable = (const U16*)(statePtr->stateTable);
  448|  8.09k|        U32 nbBitsOut  = (U32)((symbolTT.deltaNbBits + (1<<15)) >> 16);
  449|  8.09k|        statePtr->value = (nbBitsOut << 16) - symbolTT.deltaNbBits;
  450|  8.09k|        statePtr->value = stateTable[(statePtr->value >> nbBitsOut) + symbolTT.deltaFindState];
  451|  8.09k|    }
  452|  8.09k|}
zstd_compress_sequences.c:FSE_encodeSymbol:
  455|  29.5k|{
  456|  29.5k|    FSE_symbolCompressionTransform const symbolTT = ((const FSE_symbolCompressionTransform*)(statePtr->symbolTT))[symbol];
  457|  29.5k|    const U16* const stateTable = (const U16*)(statePtr->stateTable);
  458|  29.5k|    U32 const nbBitsOut  = (U32)((statePtr->value + symbolTT.deltaNbBits) >> 16);
  459|  29.5k|    BIT_addBits(bitC, (BitContainerType)statePtr->value, nbBitsOut);
  460|  29.5k|    statePtr->value = stateTable[ (statePtr->value >> nbBitsOut) + symbolTT.deltaFindState];
  461|  29.5k|}
zstd_compress_sequences.c:FSE_flushCState:
  464|  8.09k|{
  465|  8.09k|    BIT_addBits(bitC, (BitContainerType)statePtr->value, statePtr->stateLog);
  466|  8.09k|    BIT_flushBits(bitC);
  467|  8.09k|}
fse_decompress.c:FSE_initDState:
  518|  4.36k|{
  519|  4.36k|    const void* ptr = dt;
  520|  4.36k|    const FSE_DTableHeader* const DTableH = (const FSE_DTableHeader*)ptr;
  521|  4.36k|    DStatePtr->state = BIT_readBits(bitD, DTableH->tableLog);
  522|  4.36k|    BIT_reloadDStream(bitD);
  523|  4.36k|    DStatePtr->table = dt + 1;
  524|  4.36k|}
fse_decompress.c:FSE_decodeSymbolFast:
  554|  2.84k|{
  555|  2.84k|    FSE_decode_t const DInfo = ((const FSE_decode_t*)(DStatePtr->table))[DStatePtr->state];
  556|  2.84k|    U32 const nbBits = DInfo.nbBits;
  557|  2.84k|    BYTE const symbol = DInfo.symbol;
  558|  2.84k|    size_t const lowBits = BIT_readBitsFast(bitD, nbBits);
  559|       |
  560|  2.84k|    DStatePtr->state = DInfo.newState + lowBits;
  561|  2.84k|    return symbol;
  562|  2.84k|}
fse_decompress.c:FSE_decodeSymbol:
  541|   411k|{
  542|   411k|    FSE_decode_t const DInfo = ((const FSE_decode_t*)(DStatePtr->table))[DStatePtr->state];
  543|   411k|    U32 const nbBits = DInfo.nbBits;
  544|   411k|    BYTE const symbol = DInfo.symbol;
  545|   411k|    size_t const lowBits = BIT_readBits(bitD, nbBits);
  546|       |
  547|   411k|    DStatePtr->state = DInfo.newState + lowBits;
  548|   411k|    return symbol;
  549|   411k|}
fse_compress.c:FSE_initCState2:
  444|  13.0k|{
  445|  13.0k|    FSE_initCState(statePtr, ct);
  446|  13.0k|    {   const FSE_symbolCompressionTransform symbolTT = ((const FSE_symbolCompressionTransform*)(statePtr->symbolTT))[symbol];
  447|  13.0k|        const U16* stateTable = (const U16*)(statePtr->stateTable);
  448|  13.0k|        U32 nbBitsOut  = (U32)((symbolTT.deltaNbBits + (1<<15)) >> 16);
  449|  13.0k|        statePtr->value = (nbBitsOut << 16) - symbolTT.deltaNbBits;
  450|  13.0k|        statePtr->value = stateTable[(statePtr->value >> nbBitsOut) + symbolTT.deltaFindState];
  451|  13.0k|    }
  452|  13.0k|}
fse_compress.c:FSE_initCState:
  429|  13.0k|{
  430|  13.0k|    const void* ptr = ct;
  431|  13.0k|    const U16* u16ptr = (const U16*) ptr;
  432|  13.0k|    const U32 tableLog = MEM_read16(ptr);
  433|  13.0k|    statePtr->value = (ptrdiff_t)1<<tableLog;
  434|  13.0k|    statePtr->stateTable = u16ptr+2;
  435|  13.0k|    statePtr->symbolTT = ct + 1 + (tableLog ? (1<<(tableLog-1)) : 1);
  ------------------
  |  Branch (435:36): [True: 13.0k, False: 0]
  ------------------
  436|  13.0k|    statePtr->stateLog = tableLog;
  437|  13.0k|}
fse_compress.c:FSE_encodeSymbol:
  455|  1.10M|{
  456|  1.10M|    FSE_symbolCompressionTransform const symbolTT = ((const FSE_symbolCompressionTransform*)(statePtr->symbolTT))[symbol];
  457|  1.10M|    const U16* const stateTable = (const U16*)(statePtr->stateTable);
  458|  1.10M|    U32 const nbBitsOut  = (U32)((statePtr->value + symbolTT.deltaNbBits) >> 16);
  459|  1.10M|    BIT_addBits(bitC, (BitContainerType)statePtr->value, nbBitsOut);
  460|  1.10M|    statePtr->value = stateTable[ (statePtr->value >> nbBitsOut) + symbolTT.deltaFindState];
  461|  1.10M|}
fse_compress.c:FSE_flushCState:
  464|  13.0k|{
  465|  13.0k|    BIT_addBits(bitC, (BitContainerType)statePtr->value, statePtr->stateLog);
  466|  13.0k|    BIT_flushBits(bitC);
  467|  13.0k|}

FSE_decompress_wksp_bmi2:
  308|  2.18k|{
  309|  2.18k|    if (ZSTD_USE_BMI2(bmi2)) {
  ------------------
  |  |   36|  2.18k|#  define ZSTD_USE_BMI2(bmi2) (bmi2)
  |  |  ------------------
  |  |  |  Branch (36:31): [True: 2.18k, False: 0]
  |  |  ------------------
  ------------------
  310|  2.18k|        return FSE_decompress_wksp_body_bmi2(dst, dstCapacity, cSrc, cSrcSize, maxLog, workSpace, wkspSize);
  311|  2.18k|    }
  312|      0|    (void)bmi2;
  313|      0|    return FSE_decompress_wksp_body_default(dst, dstCapacity, cSrc, cSrcSize, maxLog, workSpace, wkspSize);
  314|  2.18k|}
fse_decompress.c:FSE_buildDTable_internal:
   60|  2.18k|{
   61|  2.18k|    void* const tdPtr = dt+1;   /* because *dt is unsigned, 32-bits aligned on 32-bits */
   62|  2.18k|    FSE_DECODE_TYPE* const tableDecode = (FSE_DECODE_TYPE*) (tdPtr);
  ------------------
  |  |  603|  2.18k|#define FSE_DECODE_TYPE FSE_decode_t
  ------------------
   63|  2.18k|    U16* symbolNext = (U16*)workSpace;
   64|  2.18k|    BYTE* spread = (BYTE*)(symbolNext + maxSymbolValue + 1);
   65|       |
   66|  2.18k|    U32 const maxSV1 = maxSymbolValue + 1;
   67|  2.18k|    U32 const tableSize = 1 << tableLog;
   68|  2.18k|    U32 highThreshold = tableSize-1;
   69|       |
   70|       |    /* Sanity Checks */
   71|  2.18k|    if (FSE_BUILD_DTABLE_WKSP_SIZE(tableLog, maxSymbolValue) > wkspSize) return ERROR(maxSymbolValue_tooLarge);
  ------------------
  |  |  267|  2.18k|#define FSE_BUILD_DTABLE_WKSP_SIZE(maxTableLog, maxSymbolValue) (sizeof(short) * (maxSymbolValue + 1) + (1ULL << maxTableLog) + 8)
  ------------------
                  if (FSE_BUILD_DTABLE_WKSP_SIZE(tableLog, maxSymbolValue) > wkspSize) return ERROR(maxSymbolValue_tooLarge);
  ------------------
  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (71:9): [True: 0, False: 2.18k]
  ------------------
   72|  2.18k|    if (maxSymbolValue > FSE_MAX_SYMBOL_VALUE) return ERROR(maxSymbolValue_tooLarge);
  ------------------
  |  |  595|  2.18k|#  define FSE_MAX_SYMBOL_VALUE 255
  ------------------
                  if (maxSymbolValue > FSE_MAX_SYMBOL_VALUE) return ERROR(maxSymbolValue_tooLarge);
  ------------------
  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (72:9): [True: 0, False: 2.18k]
  ------------------
   73|  2.18k|    if (tableLog > FSE_MAX_TABLELOG) return ERROR(tableLog_tooLarge);
  ------------------
  |  |  612|  2.18k|#define FSE_MAX_TABLELOG  (FSE_MAX_MEMORY_USAGE-2)
  |  |  ------------------
  |  |  |  |  582|  2.18k|#  define FSE_MAX_MEMORY_USAGE 14
  |  |  ------------------
  ------------------
                  if (tableLog > FSE_MAX_TABLELOG) return ERROR(tableLog_tooLarge);
  ------------------
  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (73:9): [True: 0, False: 2.18k]
  ------------------
   74|       |
   75|       |    /* Init, lay down lowprob symbols */
   76|  2.18k|    {   FSE_DTableHeader DTableH;
   77|  2.18k|        DTableH.tableLog = (U16)tableLog;
   78|  2.18k|        DTableH.fastMode = 1;
   79|  2.18k|        {   S16 const largeLimit= (S16)(1 << (tableLog-1));
   80|  2.18k|            U32 s;
   81|  13.0k|            for (s=0; s<maxSV1; s++) {
  ------------------
  |  Branch (81:23): [True: 10.8k, False: 2.18k]
  ------------------
   82|  10.8k|                if (normalizedCounter[s]==-1) {
  ------------------
  |  Branch (82:21): [True: 0, False: 10.8k]
  ------------------
   83|      0|                    tableDecode[highThreshold--].symbol = (FSE_FUNCTION_TYPE)s;
   84|      0|                    symbolNext[s] = 1;
   85|  10.8k|                } else {
   86|  10.8k|                    if (normalizedCounter[s] >= largeLimit) DTableH.fastMode=0;
  ------------------
  |  Branch (86:25): [True: 2.12k, False: 8.70k]
  ------------------
   87|  10.8k|                    symbolNext[s] = (U16)normalizedCounter[s];
   88|  10.8k|        }   }   }
   89|  2.18k|        ZSTD_memcpy(dt, &DTableH, sizeof(DTableH));
  ------------------
  |  |   44|  2.18k|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  ------------------
   90|  2.18k|    }
   91|       |
   92|       |    /* Spread symbols */
   93|  2.18k|    if (highThreshold == tableSize - 1) {
  ------------------
  |  Branch (93:9): [True: 2.18k, False: 0]
  ------------------
   94|  2.18k|        size_t const tableMask = tableSize-1;
   95|  2.18k|        size_t const step = FSE_TABLESTEP(tableSize);
  ------------------
  |  |  623|  2.18k|#define FSE_TABLESTEP(tableSize) (((tableSize)>>1) + ((tableSize)>>3) + 3)
  ------------------
   96|       |        /* First lay down the symbols in order.
   97|       |         * We use a uint64_t to lay down 8 bytes at a time. This reduces branch
   98|       |         * misses since small blocks generally have small table logs, so nearly
   99|       |         * all symbols have counts <= 8. We ensure we have 8 bytes at the end of
  100|       |         * our buffer to handle the over-write.
  101|       |         */
  102|  2.18k|        {   U64 const add = 0x0101010101010101ull;
  103|  2.18k|            size_t pos = 0;
  104|  2.18k|            U64 sv = 0;
  105|  2.18k|            U32 s;
  106|  13.0k|            for (s=0; s<maxSV1; ++s, sv += add) {
  ------------------
  |  Branch (106:23): [True: 10.8k, False: 2.18k]
  ------------------
  107|  10.8k|                int i;
  108|  10.8k|                int const n = normalizedCounter[s];
  109|  10.8k|                MEM_write64(spread + pos, sv);
  110|  17.0k|                for (i = 8; i < n; i += 8) {
  ------------------
  |  Branch (110:29): [True: 6.25k, False: 10.8k]
  ------------------
  111|  6.25k|                    MEM_write64(spread + pos + i, sv);
  112|  6.25k|                }
  113|  10.8k|                pos += (size_t)n;
  114|  10.8k|        }   }
  115|       |        /* Now we spread those positions across the table.
  116|       |         * The benefit of doing it in two stages is that we avoid the
  117|       |         * variable size inner loop, which caused lots of branch misses.
  118|       |         * Now we can run through all the positions without any branch misses.
  119|       |         * We unroll the loop twice, since that is what empirically worked best.
  120|       |         */
  121|  2.18k|        {
  122|  2.18k|            size_t position = 0;
  123|  2.18k|            size_t s;
  124|  2.18k|            size_t const unroll = 2;
  125|  2.18k|            assert(tableSize % unroll == 0); /* FSE_MIN_TABLELOG is 5 */
  ------------------
  |  |   70|  2.18k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  126|  37.0k|            for (s = 0; s < (size_t)tableSize; s += unroll) {
  ------------------
  |  Branch (126:25): [True: 34.9k, False: 2.18k]
  ------------------
  127|  34.9k|                size_t u;
  128|   104k|                for (u = 0; u < unroll; ++u) {
  ------------------
  |  Branch (128:29): [True: 69.8k, False: 34.9k]
  ------------------
  129|  69.8k|                    size_t const uPosition = (position + (u * step)) & tableMask;
  130|  69.8k|                    tableDecode[uPosition].symbol = spread[s + u];
  131|  69.8k|                }
  132|  34.9k|                position = (position + (unroll * step)) & tableMask;
  133|  34.9k|            }
  134|  2.18k|            assert(position == 0);
  ------------------
  |  |   70|  2.18k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  135|  2.18k|        }
  136|  2.18k|    } else {
  137|      0|        U32 const tableMask = tableSize-1;
  138|      0|        U32 const step = FSE_TABLESTEP(tableSize);
  ------------------
  |  |  623|      0|#define FSE_TABLESTEP(tableSize) (((tableSize)>>1) + ((tableSize)>>3) + 3)
  ------------------
  139|      0|        U32 s, position = 0;
  140|      0|        for (s=0; s<maxSV1; s++) {
  ------------------
  |  Branch (140:19): [True: 0, False: 0]
  ------------------
  141|      0|            int i;
  142|      0|            for (i=0; i<normalizedCounter[s]; i++) {
  ------------------
  |  Branch (142:23): [True: 0, False: 0]
  ------------------
  143|      0|                tableDecode[position].symbol = (FSE_FUNCTION_TYPE)s;
  144|      0|                position = (position + step) & tableMask;
  145|      0|                while (position > highThreshold) position = (position + step) & tableMask;   /* lowprob area */
  ------------------
  |  Branch (145:24): [True: 0, False: 0]
  ------------------
  146|      0|        }   }
  147|      0|        if (position!=0) return ERROR(GENERIC);   /* position must reach all cells once, otherwise normalizedCounter is incorrect */
  ------------------
  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (147:13): [True: 0, False: 0]
  ------------------
  148|      0|    }
  149|       |
  150|       |    /* Build Decoding table */
  151|  2.18k|    {   U32 u;
  152|  72.0k|        for (u=0; u<tableSize; u++) {
  ------------------
  |  Branch (152:19): [True: 69.8k, False: 2.18k]
  ------------------
  153|  69.8k|            FSE_FUNCTION_TYPE const symbol = (FSE_FUNCTION_TYPE)(tableDecode[u].symbol);
  ------------------
  |  |  601|  69.8k|#define FSE_FUNCTION_TYPE BYTE
  ------------------
  154|  69.8k|            U32 const nextState = symbolNext[symbol]++;
  155|  69.8k|            tableDecode[u].nbBits = (BYTE) (tableLog - ZSTD_highbit32(nextState) );
  156|  69.8k|            tableDecode[u].newState = (U16) ( (nextState << tableDecode[u].nbBits) - tableSize);
  157|  69.8k|    }   }
  158|       |
  159|  2.18k|    return 0;
  160|  2.18k|}
fse_decompress.c:FSE_decompress_wksp_body_bmi2:
  300|  2.18k|{
  301|  2.18k|    return FSE_decompress_wksp_body(dst, dstCapacity, cSrc, cSrcSize, maxLog, workSpace, wkspSize, 1);
  302|  2.18k|}
fse_decompress.c:FSE_decompress_wksp_body:
  249|  2.18k|{
  250|  2.18k|    const BYTE* const istart = (const BYTE*)cSrc;
  251|  2.18k|    const BYTE* ip = istart;
  252|  2.18k|    unsigned tableLog;
  253|  2.18k|    unsigned maxSymbolValue = FSE_MAX_SYMBOL_VALUE;
  ------------------
  |  |  595|  2.18k|#  define FSE_MAX_SYMBOL_VALUE 255
  ------------------
  254|  2.18k|    FSE_DecompressWksp* const wksp = (FSE_DecompressWksp*)workSpace;
  255|  2.18k|    size_t const dtablePos = sizeof(FSE_DecompressWksp) / sizeof(FSE_DTable);
  256|  2.18k|    FSE_DTable* const dtable = (FSE_DTable*)workSpace + dtablePos;
  257|       |
  258|  2.18k|    FSE_STATIC_ASSERT((FSE_MAX_SYMBOL_VALUE + 1) % 2 == 0);
  ------------------
  |  |   34|  2.18k|#define FSE_STATIC_ASSERT(c) DEBUG_STATIC_ASSERT(c)   /* use only *after* variable declarations */
  |  |  ------------------
  |  |  |  |   39|  2.18k|#define DEBUG_STATIC_ASSERT(c) (void)sizeof(char[(c) ? 1 : -1])
  |  |  ------------------
  ------------------
  259|  2.18k|    if (wkspSize < sizeof(*wksp)) return ERROR(GENERIC);
  ------------------
  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (259:9): [True: 0, False: 2.18k]
  ------------------
  260|       |
  261|       |    /* correct offset to dtable depends on this property */
  262|  2.18k|    FSE_STATIC_ASSERT(sizeof(FSE_DecompressWksp) % sizeof(FSE_DTable) == 0);
  ------------------
  |  |   34|  2.18k|#define FSE_STATIC_ASSERT(c) DEBUG_STATIC_ASSERT(c)   /* use only *after* variable declarations */
  |  |  ------------------
  |  |  |  |   39|  2.18k|#define DEBUG_STATIC_ASSERT(c) (void)sizeof(char[(c) ? 1 : -1])
  |  |  ------------------
  ------------------
  263|       |
  264|       |    /* normal FSE decoding mode */
  265|  2.18k|    {   size_t const NCountLength =
  266|  2.18k|            FSE_readNCount_bmi2(wksp->ncount, &maxSymbolValue, &tableLog, istart, cSrcSize, bmi2);
  267|  2.18k|        if (FSE_isError(NCountLength)) return NCountLength;
  ------------------
  |  |   33|  2.18k|#define FSE_isError ERR_isError
  ------------------
  |  Branch (267:13): [True: 1, False: 2.18k]
  ------------------
  268|  2.18k|        if (tableLog > maxLog) return ERROR(tableLog_tooLarge);
  ------------------
  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (268:13): [True: 0, False: 2.18k]
  ------------------
  269|  2.18k|        assert(NCountLength <= cSrcSize);
  ------------------
  |  |   70|  2.18k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  270|  2.18k|        ip += NCountLength;
  271|  2.18k|        cSrcSize -= NCountLength;
  272|  2.18k|    }
  273|       |
  274|  2.18k|    if (FSE_DECOMPRESS_WKSP_SIZE(tableLog, maxSymbolValue) > wkspSize) return ERROR(tableLog_tooLarge);
  ------------------
  |  |  273|  2.18k|#define FSE_DECOMPRESS_WKSP_SIZE(maxTableLog, maxSymbolValue) (FSE_DECOMPRESS_WKSP_SIZE_U32(maxTableLog, maxSymbolValue) * sizeof(unsigned))
  |  |  ------------------
  |  |  |  |  272|  2.18k|#define FSE_DECOMPRESS_WKSP_SIZE_U32(maxTableLog, maxSymbolValue) (FSE_DTABLE_SIZE_U32(maxTableLog) + 1 + FSE_BUILD_DTABLE_WKSP_SIZE_U32(maxTableLog, maxSymbolValue) + (FSE_MAX_SYMBOL_VALUE + 1) / 2 + 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  241|  2.18k|#define FSE_DTABLE_SIZE_U32(maxTableLog)                   (1 + (1<<(maxTableLog)))
  |  |  |  |  ------------------
  |  |  |  |               #define FSE_DECOMPRESS_WKSP_SIZE_U32(maxTableLog, maxSymbolValue) (FSE_DTABLE_SIZE_U32(maxTableLog) + 1 + FSE_BUILD_DTABLE_WKSP_SIZE_U32(maxTableLog, maxSymbolValue) + (FSE_MAX_SYMBOL_VALUE + 1) / 2 + 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  268|  2.18k|#define FSE_BUILD_DTABLE_WKSP_SIZE_U32(maxTableLog, maxSymbolValue) ((FSE_BUILD_DTABLE_WKSP_SIZE(maxTableLog, maxSymbolValue) + sizeof(unsigned) - 1) / sizeof(unsigned))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  267|  2.18k|#define FSE_BUILD_DTABLE_WKSP_SIZE(maxTableLog, maxSymbolValue) (sizeof(short) * (maxSymbolValue + 1) + (1ULL << maxTableLog) + 8)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define FSE_DECOMPRESS_WKSP_SIZE_U32(maxTableLog, maxSymbolValue) (FSE_DTABLE_SIZE_U32(maxTableLog) + 1 + FSE_BUILD_DTABLE_WKSP_SIZE_U32(maxTableLog, maxSymbolValue) + (FSE_MAX_SYMBOL_VALUE + 1) / 2 + 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  595|  2.18k|#  define FSE_MAX_SYMBOL_VALUE 255
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                  if (FSE_DECOMPRESS_WKSP_SIZE(tableLog, maxSymbolValue) > wkspSize) return ERROR(tableLog_tooLarge);
  ------------------
  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (274:9): [True: 0, False: 2.18k]
  ------------------
  275|  2.18k|    assert(sizeof(*wksp) + FSE_DTABLE_SIZE(tableLog) <= wkspSize);
  ------------------
  |  |   70|  2.18k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  276|  2.18k|    workSpace = (BYTE*)workSpace + sizeof(*wksp) + FSE_DTABLE_SIZE(tableLog);
  ------------------
  |  |  245|  2.18k|#define FSE_DTABLE_SIZE(maxTableLog)                   (FSE_DTABLE_SIZE_U32(maxTableLog) * sizeof(FSE_DTable))
  |  |  ------------------
  |  |  |  |  241|  2.18k|#define FSE_DTABLE_SIZE_U32(maxTableLog)                   (1 + (1<<(maxTableLog)))
  |  |  ------------------
  ------------------
  277|  2.18k|    wkspSize -= sizeof(*wksp) + FSE_DTABLE_SIZE(tableLog);
  ------------------
  |  |  245|  2.18k|#define FSE_DTABLE_SIZE(maxTableLog)                   (FSE_DTABLE_SIZE_U32(maxTableLog) * sizeof(FSE_DTable))
  |  |  ------------------
  |  |  |  |  241|  2.18k|#define FSE_DTABLE_SIZE_U32(maxTableLog)                   (1 + (1<<(maxTableLog)))
  |  |  ------------------
  ------------------
  278|       |
  279|  2.18k|    CHECK_F( FSE_buildDTable_internal(dtable, wksp->ncount, maxSymbolValue, tableLog, workSpace, wkspSize) );
  ------------------
  |  |   63|  2.18k|#define CHECK_F(f)   do { CHECK_V_F(_var_err__, f); } while (0)
  |  |  ------------------
  |  |  |  |   58|  2.18k|    size_t const e = f;     \
  |  |  |  |   59|  2.18k|    do {                    \
  |  |  |  |   60|  2.18k|        if (ERR_isError(e)) \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (60:13): [True: 0, False: 2.18k]
  |  |  |  |  ------------------
  |  |  |  |   61|  2.18k|            return e;       \
  |  |  |  |   62|  2.18k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (62:14): [Folded, False: 2.18k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (63:62): [Folded, False: 2.18k]
  |  |  ------------------
  ------------------
  280|       |
  281|  2.18k|    {
  282|  2.18k|        const void* ptr = dtable;
  283|  2.18k|        const FSE_DTableHeader* DTableH = (const FSE_DTableHeader*)ptr;
  284|  2.18k|        const U32 fastMode = DTableH->fastMode;
  285|       |
  286|       |        /* select fast mode (static) */
  287|  2.18k|        if (fastMode) return FSE_decompress_usingDTable_generic(dst, dstCapacity, ip, cSrcSize, dtable, 1);
  ------------------
  |  Branch (287:13): [True: 54, False: 2.12k]
  ------------------
  288|  2.12k|        return FSE_decompress_usingDTable_generic(dst, dstCapacity, ip, cSrcSize, dtable, 0);
  289|  2.18k|    }
  290|  2.18k|}
fse_decompress.c:FSE_decompress_usingDTable_generic:
  178|  2.18k|{
  179|  2.18k|    BYTE* const ostart = (BYTE*) dst;
  180|  2.18k|    BYTE* op = ostart;
  181|  2.18k|    BYTE* const omax = op + maxDstSize;
  182|  2.18k|    BYTE* const olimit = omax-3;
  183|       |
  184|  2.18k|    BIT_DStream_t bitD;
  185|  2.18k|    FSE_DState_t state1;
  186|  2.18k|    FSE_DState_t state2;
  187|       |
  188|       |    /* Init */
  189|  2.18k|    CHECK_F(BIT_initDStream(&bitD, cSrc, cSrcSize));
  ------------------
  |  |   63|  2.18k|#define CHECK_F(f)   do { CHECK_V_F(_var_err__, f); } while (0)
  |  |  ------------------
  |  |  |  |   58|  2.18k|    size_t const e = f;     \
  |  |  |  |   59|  2.18k|    do {                    \
  |  |  |  |   60|  2.18k|        if (ERR_isError(e)) \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (60:13): [True: 0, False: 2.18k]
  |  |  |  |  ------------------
  |  |  |  |   61|  2.18k|            return e;       \
  |  |  |  |   62|  2.18k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (62:14): [Folded, False: 2.18k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (63:62): [Folded, False: 2.18k]
  |  |  ------------------
  ------------------
  190|       |
  191|  2.18k|    FSE_initDState(&state1, &bitD, dt);
  192|  2.18k|    FSE_initDState(&state2, &bitD, dt);
  193|       |
  194|  2.18k|    RETURN_ERROR_IF(BIT_reloadDStream(&bitD)==BIT_DStream_overflow, corruption_detected, "");
  ------------------
  |  |  114|  2.18k|    do {                                                                       \
  |  |  115|  2.18k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 0, False: 2.18k]
  |  |  ------------------
  |  |  116|      0|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|      0|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|      0|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|      0|    do {                                           \
  |  |  |  |   99|      0|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|      0|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|      0|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|      0|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|      0|        }                                                                      \
  |  |  123|  2.18k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 2.18k]
  |  |  ------------------
  ------------------
  195|       |
  196|  2.18k|#define FSE_GETSYMBOL(statePtr) fast ? FSE_decodeSymbolFast(statePtr, &bitD) : FSE_decodeSymbol(statePtr, &bitD)
  197|       |
  198|       |    /* 4 symbols per loop */
  199|  46.9k|    for ( ; (BIT_reloadDStream(&bitD)==BIT_DStream_unfinished) & (op<olimit) ; op+=4) {
  ------------------
  |  Branch (199:13): [True: 44.7k, False: 2.18k]
  ------------------
  200|  44.7k|        op[0] = FSE_GETSYMBOL(&state1);
  ------------------
  |  |  196|  44.7k|#define FSE_GETSYMBOL(statePtr) fast ? FSE_decodeSymbolFast(statePtr, &bitD) : FSE_decodeSymbol(statePtr, &bitD)
  |  |  ------------------
  |  |  |  Branch (196:33): [True: 288, False: 44.4k]
  |  |  ------------------
  ------------------
  201|       |
  202|  44.7k|        if (FSE_MAX_TABLELOG*2+7 > sizeof(bitD.bitContainer)*8)    /* This test must be static */
  ------------------
  |  |  612|  44.7k|#define FSE_MAX_TABLELOG  (FSE_MAX_MEMORY_USAGE-2)
  |  |  ------------------
  |  |  |  |  582|  44.7k|#  define FSE_MAX_MEMORY_USAGE 14
  |  |  ------------------
  ------------------
  |  Branch (202:13): [Folded, False: 44.7k]
  ------------------
  203|      0|            BIT_reloadDStream(&bitD);
  204|       |
  205|  44.7k|        op[1] = FSE_GETSYMBOL(&state2);
  ------------------
  |  |  196|  44.7k|#define FSE_GETSYMBOL(statePtr) fast ? FSE_decodeSymbolFast(statePtr, &bitD) : FSE_decodeSymbol(statePtr, &bitD)
  |  |  ------------------
  |  |  |  Branch (196:33): [True: 288, False: 44.4k]
  |  |  ------------------
  ------------------
  206|       |
  207|  44.7k|        if (FSE_MAX_TABLELOG*4+7 > sizeof(bitD.bitContainer)*8)    /* This test must be static */
  ------------------
  |  |  612|  44.7k|#define FSE_MAX_TABLELOG  (FSE_MAX_MEMORY_USAGE-2)
  |  |  ------------------
  |  |  |  |  582|  44.7k|#  define FSE_MAX_MEMORY_USAGE 14
  |  |  ------------------
  ------------------
  |  Branch (207:13): [Folded, False: 44.7k]
  ------------------
  208|      0|            { if (BIT_reloadDStream(&bitD) > BIT_DStream_unfinished) { op+=2; break; } }
  ------------------
  |  Branch (208:19): [True: 0, False: 0]
  ------------------
  209|       |
  210|  44.7k|        op[2] = FSE_GETSYMBOL(&state1);
  ------------------
  |  |  196|  44.7k|#define FSE_GETSYMBOL(statePtr) fast ? FSE_decodeSymbolFast(statePtr, &bitD) : FSE_decodeSymbol(statePtr, &bitD)
  |  |  ------------------
  |  |  |  Branch (196:33): [True: 288, False: 44.4k]
  |  |  ------------------
  ------------------
  211|       |
  212|  44.7k|        if (FSE_MAX_TABLELOG*2+7 > sizeof(bitD.bitContainer)*8)    /* This test must be static */
  ------------------
  |  |  612|  44.7k|#define FSE_MAX_TABLELOG  (FSE_MAX_MEMORY_USAGE-2)
  |  |  ------------------
  |  |  |  |  582|  44.7k|#  define FSE_MAX_MEMORY_USAGE 14
  |  |  ------------------
  ------------------
  |  Branch (212:13): [Folded, False: 44.7k]
  ------------------
  213|      0|            BIT_reloadDStream(&bitD);
  214|       |
  215|  44.7k|        op[3] = FSE_GETSYMBOL(&state2);
  ------------------
  |  |  196|  44.7k|#define FSE_GETSYMBOL(statePtr) fast ? FSE_decodeSymbolFast(statePtr, &bitD) : FSE_decodeSymbol(statePtr, &bitD)
  |  |  ------------------
  |  |  |  Branch (196:33): [True: 288, False: 44.4k]
  |  |  ------------------
  ------------------
  216|  44.7k|    }
  217|       |
  218|       |    /* tail */
  219|       |    /* note : BIT_reloadDStream(&bitD) >= FSE_DStream_partiallyFilled; Ends at exactly BIT_DStream_completed */
  220|   117k|    while (1) {
  ------------------
  |  Branch (220:12): [True: 117k, Folded]
  ------------------
  221|   117k|        if (op>(omax-2)) return ERROR(dstSize_tooSmall);
  ------------------
  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (221:13): [True: 0, False: 117k]
  ------------------
  222|   117k|        *op++ = FSE_GETSYMBOL(&state1);
  ------------------
  |  |  196|   117k|#define FSE_GETSYMBOL(statePtr) fast ? FSE_decodeSymbolFast(statePtr, &bitD) : FSE_decodeSymbol(statePtr, &bitD)
  |  |  ------------------
  |  |  |  Branch (196:33): [True: 836, False: 116k]
  |  |  ------------------
  ------------------
  223|   117k|        if (BIT_reloadDStream(&bitD)==BIT_DStream_overflow) {
  ------------------
  |  Branch (223:13): [True: 1.25k, False: 115k]
  ------------------
  224|  1.25k|            *op++ = FSE_GETSYMBOL(&state2);
  ------------------
  |  |  196|  1.25k|#define FSE_GETSYMBOL(statePtr) fast ? FSE_decodeSymbolFast(statePtr, &bitD) : FSE_decodeSymbol(statePtr, &bitD)
  |  |  ------------------
  |  |  |  Branch (196:33): [True: 32, False: 1.21k]
  |  |  ------------------
  ------------------
  225|  1.25k|            break;
  226|  1.25k|        }
  227|       |
  228|   115k|        if (op>(omax-2)) return ERROR(dstSize_tooSmall);
  ------------------
  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (228:13): [True: 0, False: 115k]
  ------------------
  229|   115k|        *op++ = FSE_GETSYMBOL(&state2);
  ------------------
  |  |  196|   115k|#define FSE_GETSYMBOL(statePtr) fast ? FSE_decodeSymbolFast(statePtr, &bitD) : FSE_decodeSymbol(statePtr, &bitD)
  |  |  ------------------
  |  |  |  Branch (196:33): [True: 804, False: 115k]
  |  |  ------------------
  ------------------
  230|   115k|        if (BIT_reloadDStream(&bitD)==BIT_DStream_overflow) {
  ------------------
  |  Branch (230:13): [True: 932, False: 115k]
  ------------------
  231|    932|            *op++ = FSE_GETSYMBOL(&state1);
  ------------------
  |  |  196|    932|#define FSE_GETSYMBOL(statePtr) fast ? FSE_decodeSymbolFast(statePtr, &bitD) : FSE_decodeSymbol(statePtr, &bitD)
  |  |  ------------------
  |  |  |  Branch (196:33): [True: 22, False: 910]
  |  |  ------------------
  ------------------
  232|    932|            break;
  233|    932|    }   }
  234|       |
  235|  2.18k|    assert(op >= ostart);
  ------------------
  |  |   70|  2.18k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  236|  2.18k|    return (size_t)(op-ostart);
  237|  2.18k|}

zstd_compress.c:MEM_32bits:
  137|  13.0k|MEM_STATIC unsigned MEM_32bits(void) { return sizeof(size_t)==4; }
zstd_compress.c:MEM_writeLE32:
  330|  4.35k|{
  331|  4.35k|    if (MEM_isLittleEndian())
  ------------------
  |  Branch (331:9): [True: 4.35k, False: 0]
  ------------------
  332|  4.35k|        MEM_write32(memPtr, val32);
  333|      0|    else
  334|      0|        MEM_write32(memPtr, MEM_swap32(val32));
  335|  4.35k|}
zstd_compress.c:MEM_write32:
  188|  4.35k|MEM_STATIC void MEM_write32(void* memPtr, U32 value) { *(unalign32*)memPtr = value; }
zstd_compress.c:MEM_writeLE24:
  316|  2.90k|{
  317|  2.90k|    MEM_writeLE16(memPtr, (U16)val);
  318|  2.90k|    ((BYTE*)memPtr)[2] = (BYTE)(val>>16);
  319|  2.90k|}
zstd_compress.c:MEM_writeLE16:
  300|  2.90k|{
  301|  2.90k|    if (MEM_isLittleEndian()) {
  ------------------
  |  Branch (301:9): [True: 2.90k, False: 0]
  ------------------
  302|  2.90k|        MEM_write16(memPtr, val);
  303|  2.90k|    } else {
  304|      0|        BYTE* p = (BYTE*)memPtr;
  305|      0|        p[0] = (BYTE)val;
  306|      0|        p[1] = (BYTE)(val>>8);
  307|      0|    }
  308|  2.90k|}
zstd_compress.c:MEM_write16:
  187|  2.90k|MEM_STATIC void MEM_write16(void* memPtr, U16 value) { *(unalign16*)memPtr = value; }
zstd_compress.c:MEM_64bits:
  138|  12.9k|MEM_STATIC unsigned MEM_64bits(void) { return sizeof(size_t)==8; }
zstd_compress.c:MEM_isLittleEndian:
  141|  7.25k|{
  142|  7.25k|#if defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
  143|  7.25k|    return 1;
  144|       |#elif defined(__BYTE_ORDER__) && defined(__ORDER_BIG_ENDIAN__) && (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
  145|       |    return 0;
  146|       |#elif defined(__clang__) && __LITTLE_ENDIAN__
  147|       |    return 1;
  148|       |#elif defined(__clang__) && __BIG_ENDIAN__
  149|       |    return 0;
  150|       |#elif defined(_MSC_VER) && (_M_X64 || _M_IX86)
  151|       |    return 1;
  152|       |#elif defined(__DMC__) && defined(_M_IX86)
  153|       |    return 1;
  154|       |#elif defined(__IAR_SYSTEMS_ICC__) && __LITTLE_ENDIAN__
  155|       |    return 1;
  156|       |#else
  157|       |    const union { U32 u; BYTE c[4]; } one = { 1 };   /* don't use static : performance detrimental  */
  158|       |    return one.c[0];
  159|       |#endif
  160|  7.25k|}
zstd_compress_literals.c:MEM_writeLE16:
  300|  2.51k|{
  301|  2.51k|    if (MEM_isLittleEndian()) {
  ------------------
  |  Branch (301:9): [True: 2.51k, False: 0]
  ------------------
  302|  2.51k|        MEM_write16(memPtr, val);
  303|  2.51k|    } else {
  304|      0|        BYTE* p = (BYTE*)memPtr;
  305|      0|        p[0] = (BYTE)val;
  306|      0|        p[1] = (BYTE)(val>>8);
  307|      0|    }
  308|  2.51k|}
zstd_compress_literals.c:MEM_isLittleEndian:
  141|  2.51k|{
  142|  2.51k|#if defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
  143|  2.51k|    return 1;
  144|       |#elif defined(__BYTE_ORDER__) && defined(__ORDER_BIG_ENDIAN__) && (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
  145|       |    return 0;
  146|       |#elif defined(__clang__) && __LITTLE_ENDIAN__
  147|       |    return 1;
  148|       |#elif defined(__clang__) && __BIG_ENDIAN__
  149|       |    return 0;
  150|       |#elif defined(_MSC_VER) && (_M_X64 || _M_IX86)
  151|       |    return 1;
  152|       |#elif defined(__DMC__) && defined(_M_IX86)
  153|       |    return 1;
  154|       |#elif defined(__IAR_SYSTEMS_ICC__) && __LITTLE_ENDIAN__
  155|       |    return 1;
  156|       |#else
  157|       |    const union { U32 u; BYTE c[4]; } one = { 1 };   /* don't use static : performance detrimental  */
  158|       |    return one.c[0];
  159|       |#endif
  160|  2.51k|}
zstd_compress_literals.c:MEM_write16:
  187|  2.51k|MEM_STATIC void MEM_write16(void* memPtr, U16 value) { *(unalign16*)memPtr = value; }
zstd_compress_literals.c:MEM_writeLE24:
  316|  1.84k|{
  317|  1.84k|    MEM_writeLE16(memPtr, (U16)val);
  318|  1.84k|    ((BYTE*)memPtr)[2] = (BYTE)(val>>16);
  319|  1.84k|}
zstd_compress_sequences.c:MEM_read16:
  182|  8.09k|MEM_STATIC U16 MEM_read16(const void* ptr) { return *(const unalign16*)ptr; }
zstd_compress_sequences.c:MEM_32bits:
  137|  80.7k|MEM_STATIC unsigned MEM_32bits(void) { return sizeof(size_t)==4; }
zstd_compress_sequences.c:MEM_writeLEST:
  362|  23.3k|{
  363|  23.3k|    if (MEM_32bits())
  ------------------
  |  Branch (363:9): [True: 0, False: 23.3k]
  ------------------
  364|      0|        MEM_writeLE32(memPtr, (U32)val);
  365|  23.3k|    else
  366|  23.3k|        MEM_writeLE64(memPtr, (U64)val);
  367|  23.3k|}
zstd_compress_sequences.c:MEM_isLittleEndian:
  141|  23.3k|{
  142|  23.3k|#if defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
  143|  23.3k|    return 1;
  144|       |#elif defined(__BYTE_ORDER__) && defined(__ORDER_BIG_ENDIAN__) && (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
  145|       |    return 0;
  146|       |#elif defined(__clang__) && __LITTLE_ENDIAN__
  147|       |    return 1;
  148|       |#elif defined(__clang__) && __BIG_ENDIAN__
  149|       |    return 0;
  150|       |#elif defined(_MSC_VER) && (_M_X64 || _M_IX86)
  151|       |    return 1;
  152|       |#elif defined(__DMC__) && defined(_M_IX86)
  153|       |    return 1;
  154|       |#elif defined(__IAR_SYSTEMS_ICC__) && __LITTLE_ENDIAN__
  155|       |    return 1;
  156|       |#else
  157|       |    const union { U32 u; BYTE c[4]; } one = { 1 };   /* don't use static : performance detrimental  */
  158|       |    return one.c[0];
  159|       |#endif
  160|  23.3k|}
zstd_compress_sequences.c:MEM_writeLE64:
  346|  23.3k|{
  347|  23.3k|    if (MEM_isLittleEndian())
  ------------------
  |  Branch (347:9): [True: 23.3k, False: 0]
  ------------------
  348|  23.3k|        MEM_write64(memPtr, val64);
  349|      0|    else
  350|      0|        MEM_write64(memPtr, MEM_swap64(val64));
  351|  23.3k|}
zstd_compress_sequences.c:MEM_write64:
  189|  23.3k|MEM_STATIC void MEM_write64(void* memPtr, U64 value) { *(unalign64*)memPtr = value; }
zstd_double_fast.c:MEM_readLE32:
  322|  21.9k|{
  323|  21.9k|    if (MEM_isLittleEndian())
  ------------------
  |  Branch (323:9): [True: 21.9k, False: 0]
  ------------------
  324|  21.9k|        return MEM_read32(memPtr);
  325|      0|    else
  326|      0|        return MEM_swap32(MEM_read32(memPtr));
  327|  21.9k|}
zstd_double_fast.c:MEM_isLittleEndian:
  141|  44.7k|{
  142|  44.7k|#if defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
  143|  44.7k|    return 1;
  144|       |#elif defined(__BYTE_ORDER__) && defined(__ORDER_BIG_ENDIAN__) && (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
  145|       |    return 0;
  146|       |#elif defined(__clang__) && __LITTLE_ENDIAN__
  147|       |    return 1;
  148|       |#elif defined(__clang__) && __BIG_ENDIAN__
  149|       |    return 0;
  150|       |#elif defined(_MSC_VER) && (_M_X64 || _M_IX86)
  151|       |    return 1;
  152|       |#elif defined(__DMC__) && defined(_M_IX86)
  153|       |    return 1;
  154|       |#elif defined(__IAR_SYSTEMS_ICC__) && __LITTLE_ENDIAN__
  155|       |    return 1;
  156|       |#else
  157|       |    const union { U32 u; BYTE c[4]; } one = { 1 };   /* don't use static : performance detrimental  */
  158|       |    return one.c[0];
  159|       |#endif
  160|  44.7k|}
zstd_double_fast.c:MEM_read32:
  183|   107k|MEM_STATIC U32 MEM_read32(const void* ptr) { return *(const unalign32*)ptr; }
zstd_double_fast.c:MEM_readLE64:
  338|  22.4k|{
  339|  22.4k|    if (MEM_isLittleEndian())
  ------------------
  |  Branch (339:9): [True: 22.4k, False: 0]
  ------------------
  340|  22.4k|        return MEM_read64(memPtr);
  341|      0|    else
  342|      0|        return MEM_swap64(MEM_read64(memPtr));
  343|  22.4k|}
zstd_double_fast.c:MEM_read64:
  184|  64.8k|MEM_STATIC U64 MEM_read64(const void* ptr) { return *(const unalign64*)ptr; }
zstd_double_fast.c:MEM_readST:
  185|    782|MEM_STATIC size_t MEM_readST(const void* ptr) { return *(const unalignArch*)ptr; }
zstd_double_fast.c:MEM_64bits:
  138|    435|MEM_STATIC unsigned MEM_64bits(void) { return sizeof(size_t)==8; }
zstd_double_fast.c:MEM_read16:
  182|     88|MEM_STATIC U16 MEM_read16(const void* ptr) { return *(const unalign16*)ptr; }
zstd_lazy.c:MEM_readLE32:
  322|   420k|{
  323|   420k|    if (MEM_isLittleEndian())
  ------------------
  |  Branch (323:9): [True: 420k, False: 0]
  ------------------
  324|   420k|        return MEM_read32(memPtr);
  325|      0|    else
  326|      0|        return MEM_swap32(MEM_read32(memPtr));
  327|   420k|}
zstd_lazy.c:MEM_isLittleEndian:
  141|   520k|{
  142|   520k|#if defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
  143|   520k|    return 1;
  144|       |#elif defined(__BYTE_ORDER__) && defined(__ORDER_BIG_ENDIAN__) && (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
  145|       |    return 0;
  146|       |#elif defined(__clang__) && __LITTLE_ENDIAN__
  147|       |    return 1;
  148|       |#elif defined(__clang__) && __BIG_ENDIAN__
  149|       |    return 0;
  150|       |#elif defined(_MSC_VER) && (_M_X64 || _M_IX86)
  151|       |    return 1;
  152|       |#elif defined(__DMC__) && defined(_M_IX86)
  153|       |    return 1;
  154|       |#elif defined(__IAR_SYSTEMS_ICC__) && __LITTLE_ENDIAN__
  155|       |    return 1;
  156|       |#else
  157|       |    const union { U32 u; BYTE c[4]; } one = { 1 };   /* don't use static : performance detrimental  */
  158|       |    return one.c[0];
  159|       |#endif
  160|   520k|}
zstd_lazy.c:MEM_read32:
  183|   949k|MEM_STATIC U32 MEM_read32(const void* ptr) { return *(const unalign32*)ptr; }
zstd_lazy.c:MEM_readST:
  185|   263k|MEM_STATIC size_t MEM_readST(const void* ptr) { return *(const unalignArch*)ptr; }
zstd_lazy.c:MEM_64bits:
  138|   102k|MEM_STATIC unsigned MEM_64bits(void) { return sizeof(size_t)==8; }
zstd_lazy.c:MEM_read16:
  182|  3.19k|MEM_STATIC U16 MEM_read16(const void* ptr) { return *(const unalign16*)ptr; }
zstd_opt.c:MEM_readLE32:
  322|   621k|{
  323|   621k|    if (MEM_isLittleEndian())
  ------------------
  |  Branch (323:9): [True: 621k, False: 0]
  ------------------
  324|   621k|        return MEM_read32(memPtr);
  325|      0|    else
  326|      0|        return MEM_swap32(MEM_read32(memPtr));
  327|   621k|}
zstd_opt.c:MEM_isLittleEndian:
  141|  2.04M|{
  142|  2.04M|#if defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
  143|  2.04M|    return 1;
  144|       |#elif defined(__BYTE_ORDER__) && defined(__ORDER_BIG_ENDIAN__) && (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
  145|       |    return 0;
  146|       |#elif defined(__clang__) && __LITTLE_ENDIAN__
  147|       |    return 1;
  148|       |#elif defined(__clang__) && __BIG_ENDIAN__
  149|       |    return 0;
  150|       |#elif defined(_MSC_VER) && (_M_X64 || _M_IX86)
  151|       |    return 1;
  152|       |#elif defined(__DMC__) && defined(_M_IX86)
  153|       |    return 1;
  154|       |#elif defined(__IAR_SYSTEMS_ICC__) && __LITTLE_ENDIAN__
  155|       |    return 1;
  156|       |#else
  157|       |    const union { U32 u; BYTE c[4]; } one = { 1 };   /* don't use static : performance detrimental  */
  158|       |    return one.c[0];
  159|       |#endif
  160|  2.04M|}
zstd_opt.c:MEM_read32:
  183|  1.85M|MEM_STATIC U32 MEM_read32(const void* ptr) { return *(const unalign32*)ptr; }
zstd_opt.c:MEM_readST:
  185|   537k|MEM_STATIC size_t MEM_readST(const void* ptr) { return *(const unalignArch*)ptr; }
zstd_opt.c:MEM_64bits:
  138|   212k|MEM_STATIC unsigned MEM_64bits(void) { return sizeof(size_t)==8; }
zstd_opt.c:MEM_read16:
  182|  5.65k|MEM_STATIC U16 MEM_read16(const void* ptr) { return *(const unalign16*)ptr; }
zstd_ddict.c:MEM_readLE32:
  322|     11|{
  323|     11|    if (MEM_isLittleEndian())
  ------------------
  |  Branch (323:9): [True: 11, False: 0]
  ------------------
  324|     11|        return MEM_read32(memPtr);
  325|      0|    else
  326|      0|        return MEM_swap32(MEM_read32(memPtr));
  327|     11|}
zstd_ddict.c:MEM_isLittleEndian:
  141|     11|{
  142|     11|#if defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
  143|     11|    return 1;
  144|       |#elif defined(__BYTE_ORDER__) && defined(__ORDER_BIG_ENDIAN__) && (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
  145|       |    return 0;
  146|       |#elif defined(__clang__) && __LITTLE_ENDIAN__
  147|       |    return 1;
  148|       |#elif defined(__clang__) && __BIG_ENDIAN__
  149|       |    return 0;
  150|       |#elif defined(_MSC_VER) && (_M_X64 || _M_IX86)
  151|       |    return 1;
  152|       |#elif defined(__DMC__) && defined(_M_IX86)
  153|       |    return 1;
  154|       |#elif defined(__IAR_SYSTEMS_ICC__) && __LITTLE_ENDIAN__
  155|       |    return 1;
  156|       |#else
  157|       |    const union { U32 u; BYTE c[4]; } one = { 1 };   /* don't use static : performance detrimental  */
  158|       |    return one.c[0];
  159|       |#endif
  160|     11|}
zstd_ddict.c:MEM_read32:
  183|     11|MEM_STATIC U32 MEM_read32(const void* ptr) { return *(const unalign32*)ptr; }
zstd_decompress.c:MEM_readLE32:
  322|  10.3k|{
  323|  10.3k|    if (MEM_isLittleEndian())
  ------------------
  |  Branch (323:9): [True: 10.3k, False: 0]
  ------------------
  324|  10.3k|        return MEM_read32(memPtr);
  325|      0|    else
  326|      0|        return MEM_swap32(MEM_read32(memPtr));
  327|  10.3k|}
zstd_decompress.c:MEM_isLittleEndian:
  141|  10.5k|{
  142|  10.5k|#if defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
  143|  10.5k|    return 1;
  144|       |#elif defined(__BYTE_ORDER__) && defined(__ORDER_BIG_ENDIAN__) && (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
  145|       |    return 0;
  146|       |#elif defined(__clang__) && __LITTLE_ENDIAN__
  147|       |    return 1;
  148|       |#elif defined(__clang__) && __BIG_ENDIAN__
  149|       |    return 0;
  150|       |#elif defined(_MSC_VER) && (_M_X64 || _M_IX86)
  151|       |    return 1;
  152|       |#elif defined(__DMC__) && defined(_M_IX86)
  153|       |    return 1;
  154|       |#elif defined(__IAR_SYSTEMS_ICC__) && __LITTLE_ENDIAN__
  155|       |    return 1;
  156|       |#else
  157|       |    const union { U32 u; BYTE c[4]; } one = { 1 };   /* don't use static : performance detrimental  */
  158|       |    return one.c[0];
  159|       |#endif
  160|  10.5k|}
zstd_decompress.c:MEM_read32:
  183|  10.3k|MEM_STATIC U32 MEM_read32(const void* ptr) { return *(const unalign32*)ptr; }
zstd_decompress.c:MEM_readLE16:
  290|     97|{
  291|     97|    if (MEM_isLittleEndian())
  ------------------
  |  Branch (291:9): [True: 97, False: 0]
  ------------------
  292|     97|        return MEM_read16(memPtr);
  293|      0|    else {
  294|      0|        const BYTE* p = (const BYTE*)memPtr;
  295|      0|        return (U16)(p[0] + (p[1]<<8));
  296|      0|    }
  297|     97|}
zstd_decompress.c:MEM_read16:
  182|     97|MEM_STATIC U16 MEM_read16(const void* ptr) { return *(const unalign16*)ptr; }
zstd_decompress.c:MEM_readLE64:
  338|     41|{
  339|     41|    if (MEM_isLittleEndian())
  ------------------
  |  Branch (339:9): [True: 41, False: 0]
  ------------------
  340|     41|        return MEM_read64(memPtr);
  341|      0|    else
  342|      0|        return MEM_swap64(MEM_read64(memPtr));
  343|     41|}
zstd_decompress.c:MEM_read64:
  184|     41|MEM_STATIC U64 MEM_read64(const void* ptr) { return *(const unalign64*)ptr; }
zstd_decompress_block.c:MEM_readLE24:
  311|  5.13k|{
  312|  5.13k|    return (U32)MEM_readLE16(memPtr) + ((U32)(((const BYTE*)memPtr)[2]) << 16);
  313|  5.13k|}
zstd_decompress_block.c:MEM_readLE32:
  322|  2.78k|{
  323|  2.78k|    if (MEM_isLittleEndian())
  ------------------
  |  Branch (323:9): [True: 2.78k, False: 0]
  ------------------
  324|  2.78k|        return MEM_read32(memPtr);
  325|      0|    else
  326|      0|        return MEM_swap32(MEM_read32(memPtr));
  327|  2.78k|}
zstd_decompress_block.c:MEM_isLittleEndian:
  141|  21.2k|{
  142|  21.2k|#if defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
  143|  21.2k|    return 1;
  144|       |#elif defined(__BYTE_ORDER__) && defined(__ORDER_BIG_ENDIAN__) && (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
  145|       |    return 0;
  146|       |#elif defined(__clang__) && __LITTLE_ENDIAN__
  147|       |    return 1;
  148|       |#elif defined(__clang__) && __BIG_ENDIAN__
  149|       |    return 0;
  150|       |#elif defined(_MSC_VER) && (_M_X64 || _M_IX86)
  151|       |    return 1;
  152|       |#elif defined(__DMC__) && defined(_M_IX86)
  153|       |    return 1;
  154|       |#elif defined(__IAR_SYSTEMS_ICC__) && __LITTLE_ENDIAN__
  155|       |    return 1;
  156|       |#else
  157|       |    const union { U32 u; BYTE c[4]; } one = { 1 };   /* don't use static : performance detrimental  */
  158|       |    return one.c[0];
  159|       |#endif
  160|  21.2k|}
zstd_decompress_block.c:MEM_read32:
  183|  2.78k|MEM_STATIC U32 MEM_read32(const void* ptr) { return *(const unalign32*)ptr; }
zstd_decompress_block.c:MEM_write64:
  189|  6.39k|MEM_STATIC void MEM_write64(void* memPtr, U64 value) { *(unalign64*)memPtr = value; }
zstd_decompress_block.c:MEM_readLE16:
  290|  5.71k|{
  291|  5.71k|    if (MEM_isLittleEndian())
  ------------------
  |  Branch (291:9): [True: 5.71k, False: 0]
  ------------------
  292|  5.71k|        return MEM_read16(memPtr);
  293|      0|    else {
  294|      0|        const BYTE* p = (const BYTE*)memPtr;
  295|      0|        return (U16)(p[0] + (p[1]<<8));
  296|      0|    }
  297|  5.71k|}
zstd_decompress_block.c:MEM_read16:
  182|  5.71k|MEM_STATIC U16 MEM_read16(const void* ptr) { return *(const unalign16*)ptr; }
zstd_decompress_block.c:MEM_32bits:
  137|  96.1k|MEM_STATIC unsigned MEM_32bits(void) { return sizeof(size_t)==4; }
zstd_decompress_block.c:MEM_64bits:
  138|  21.7k|MEM_STATIC unsigned MEM_64bits(void) { return sizeof(size_t)==8; }
zstd_decompress_block.c:MEM_readLEST:
  354|  12.7k|{
  355|  12.7k|    if (MEM_32bits())
  ------------------
  |  Branch (355:9): [True: 0, False: 12.7k]
  ------------------
  356|      0|        return (size_t)MEM_readLE32(memPtr);
  357|  12.7k|    else
  358|  12.7k|        return (size_t)MEM_readLE64(memPtr);
  359|  12.7k|}
zstd_decompress_block.c:MEM_readLE64:
  338|  12.7k|{
  339|  12.7k|    if (MEM_isLittleEndian())
  ------------------
  |  Branch (339:9): [True: 12.7k, False: 0]
  ------------------
  340|  12.7k|        return MEM_read64(memPtr);
  341|      0|    else
  342|      0|        return MEM_swap64(MEM_read64(memPtr));
  343|  12.7k|}
zstd_decompress_block.c:MEM_read64:
  184|  12.7k|MEM_STATIC U64 MEM_read64(const void* ptr) { return *(const unalign64*)ptr; }
entropy_common.c:MEM_readLE32:
  322|  14.8k|{
  323|  14.8k|    if (MEM_isLittleEndian())
  ------------------
  |  Branch (323:9): [True: 14.8k, False: 0]
  ------------------
  324|  14.8k|        return MEM_read32(memPtr);
  325|      0|    else
  326|      0|        return MEM_swap32(MEM_read32(memPtr));
  327|  14.8k|}
entropy_common.c:MEM_isLittleEndian:
  141|  14.8k|{
  142|  14.8k|#if defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
  143|  14.8k|    return 1;
  144|       |#elif defined(__BYTE_ORDER__) && defined(__ORDER_BIG_ENDIAN__) && (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
  145|       |    return 0;
  146|       |#elif defined(__clang__) && __LITTLE_ENDIAN__
  147|       |    return 1;
  148|       |#elif defined(__clang__) && __BIG_ENDIAN__
  149|       |    return 0;
  150|       |#elif defined(_MSC_VER) && (_M_X64 || _M_IX86)
  151|       |    return 1;
  152|       |#elif defined(__DMC__) && defined(_M_IX86)
  153|       |    return 1;
  154|       |#elif defined(__IAR_SYSTEMS_ICC__) && __LITTLE_ENDIAN__
  155|       |    return 1;
  156|       |#else
  157|       |    const union { U32 u; BYTE c[4]; } one = { 1 };   /* don't use static : performance detrimental  */
  158|       |    return one.c[0];
  159|       |#endif
  160|  14.8k|}
entropy_common.c:MEM_read32:
  183|  14.8k|MEM_STATIC U32 MEM_read32(const void* ptr) { return *(const unalign32*)ptr; }
fse_decompress.c:MEM_write64:
  189|  17.0k|MEM_STATIC void MEM_write64(void* memPtr, U64 value) { *(unalign64*)memPtr = value; }
fse_decompress.c:MEM_readLEST:
  354|  53.4k|{
  355|  53.4k|    if (MEM_32bits())
  ------------------
  |  Branch (355:9): [True: 0, False: 53.4k]
  ------------------
  356|      0|        return (size_t)MEM_readLE32(memPtr);
  357|  53.4k|    else
  358|  53.4k|        return (size_t)MEM_readLE64(memPtr);
  359|  53.4k|}
fse_decompress.c:MEM_32bits:
  137|  53.4k|MEM_STATIC unsigned MEM_32bits(void) { return sizeof(size_t)==4; }
fse_decompress.c:MEM_isLittleEndian:
  141|  53.4k|{
  142|  53.4k|#if defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
  143|  53.4k|    return 1;
  144|       |#elif defined(__BYTE_ORDER__) && defined(__ORDER_BIG_ENDIAN__) && (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
  145|       |    return 0;
  146|       |#elif defined(__clang__) && __LITTLE_ENDIAN__
  147|       |    return 1;
  148|       |#elif defined(__clang__) && __BIG_ENDIAN__
  149|       |    return 0;
  150|       |#elif defined(_MSC_VER) && (_M_X64 || _M_IX86)
  151|       |    return 1;
  152|       |#elif defined(__DMC__) && defined(_M_IX86)
  153|       |    return 1;
  154|       |#elif defined(__IAR_SYSTEMS_ICC__) && __LITTLE_ENDIAN__
  155|       |    return 1;
  156|       |#else
  157|       |    const union { U32 u; BYTE c[4]; } one = { 1 };   /* don't use static : performance detrimental  */
  158|       |    return one.c[0];
  159|       |#endif
  160|  53.4k|}
fse_decompress.c:MEM_readLE64:
  338|  53.4k|{
  339|  53.4k|    if (MEM_isLittleEndian())
  ------------------
  |  Branch (339:9): [True: 53.4k, False: 0]
  ------------------
  340|  53.4k|        return MEM_read64(memPtr);
  341|      0|    else
  342|      0|        return MEM_swap64(MEM_read64(memPtr));
  343|  53.4k|}
fse_decompress.c:MEM_read64:
  184|  53.4k|MEM_STATIC U64 MEM_read64(const void* ptr) { return *(const unalign64*)ptr; }
fse_compress.c:MEM_write64:
  189|   357k|MEM_STATIC void MEM_write64(void* memPtr, U64 value) { *(unalign64*)memPtr = value; }
fse_compress.c:MEM_read16:
  182|  13.0k|MEM_STATIC U16 MEM_read16(const void* ptr) { return *(const unalign16*)ptr; }
fse_compress.c:MEM_writeLEST:
  362|   300k|{
  363|   300k|    if (MEM_32bits())
  ------------------
  |  Branch (363:9): [True: 0, False: 300k]
  ------------------
  364|      0|        MEM_writeLE32(memPtr, (U32)val);
  365|   300k|    else
  366|   300k|        MEM_writeLE64(memPtr, (U64)val);
  367|   300k|}
fse_compress.c:MEM_32bits:
  137|   300k|MEM_STATIC unsigned MEM_32bits(void) { return sizeof(size_t)==4; }
fse_compress.c:MEM_isLittleEndian:
  141|   300k|{
  142|   300k|#if defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
  143|   300k|    return 1;
  144|       |#elif defined(__BYTE_ORDER__) && defined(__ORDER_BIG_ENDIAN__) && (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
  145|       |    return 0;
  146|       |#elif defined(__clang__) && __LITTLE_ENDIAN__
  147|       |    return 1;
  148|       |#elif defined(__clang__) && __BIG_ENDIAN__
  149|       |    return 0;
  150|       |#elif defined(_MSC_VER) && (_M_X64 || _M_IX86)
  151|       |    return 1;
  152|       |#elif defined(__DMC__) && defined(_M_IX86)
  153|       |    return 1;
  154|       |#elif defined(__IAR_SYSTEMS_ICC__) && __LITTLE_ENDIAN__
  155|       |    return 1;
  156|       |#else
  157|       |    const union { U32 u; BYTE c[4]; } one = { 1 };   /* don't use static : performance detrimental  */
  158|       |    return one.c[0];
  159|       |#endif
  160|   300k|}
fse_compress.c:MEM_writeLE64:
  346|   300k|{
  347|   300k|    if (MEM_isLittleEndian())
  ------------------
  |  Branch (347:9): [True: 300k, False: 0]
  ------------------
  348|   300k|        MEM_write64(memPtr, val64);
  349|      0|    else
  350|      0|        MEM_write64(memPtr, MEM_swap64(val64));
  351|   300k|}
huf_compress.c:MEM_writeLEST:
  362|  74.7k|{
  363|  74.7k|    if (MEM_32bits())
  ------------------
  |  Branch (363:9): [True: 0, False: 74.7k]
  ------------------
  364|      0|        MEM_writeLE32(memPtr, (U32)val);
  365|  74.7k|    else
  366|  74.7k|        MEM_writeLE64(memPtr, (U64)val);
  367|  74.7k|}
huf_compress.c:MEM_isLittleEndian:
  141|  74.7k|{
  142|  74.7k|#if defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
  143|  74.7k|    return 1;
  144|       |#elif defined(__BYTE_ORDER__) && defined(__ORDER_BIG_ENDIAN__) && (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
  145|       |    return 0;
  146|       |#elif defined(__clang__) && __LITTLE_ENDIAN__
  147|       |    return 1;
  148|       |#elif defined(__clang__) && __BIG_ENDIAN__
  149|       |    return 0;
  150|       |#elif defined(_MSC_VER) && (_M_X64 || _M_IX86)
  151|       |    return 1;
  152|       |#elif defined(__DMC__) && defined(_M_IX86)
  153|       |    return 1;
  154|       |#elif defined(__IAR_SYSTEMS_ICC__) && __LITTLE_ENDIAN__
  155|       |    return 1;
  156|       |#else
  157|       |    const union { U32 u; BYTE c[4]; } one = { 1 };   /* don't use static : performance detrimental  */
  158|       |    return one.c[0];
  159|       |#endif
  160|  74.7k|}
huf_compress.c:MEM_writeLE64:
  346|  74.7k|{
  347|  74.7k|    if (MEM_isLittleEndian())
  ------------------
  |  Branch (347:9): [True: 74.7k, False: 0]
  ------------------
  348|  74.7k|        MEM_write64(memPtr, val64);
  349|      0|    else
  350|      0|        MEM_write64(memPtr, MEM_swap64(val64));
  351|  74.7k|}
huf_compress.c:MEM_write64:
  189|  74.7k|MEM_STATIC void MEM_write64(void* memPtr, U64 value) { *(unalign64*)memPtr = value; }
huf_compress.c:MEM_32bits:
  137|  77.7k|MEM_STATIC unsigned MEM_32bits(void) { return sizeof(size_t)==4; }
huf_decompress.c:MEM_isLittleEndian:
  141|   132k|{
  142|   132k|#if defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
  143|   132k|    return 1;
  144|       |#elif defined(__BYTE_ORDER__) && defined(__ORDER_BIG_ENDIAN__) && (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
  145|       |    return 0;
  146|       |#elif defined(__clang__) && __LITTLE_ENDIAN__
  147|       |    return 1;
  148|       |#elif defined(__clang__) && __BIG_ENDIAN__
  149|       |    return 0;
  150|       |#elif defined(_MSC_VER) && (_M_X64 || _M_IX86)
  151|       |    return 1;
  152|       |#elif defined(__DMC__) && defined(_M_IX86)
  153|       |    return 1;
  154|       |#elif defined(__IAR_SYSTEMS_ICC__) && __LITTLE_ENDIAN__
  155|       |    return 1;
  156|       |#else
  157|       |    const union { U32 u; BYTE c[4]; } one = { 1 };   /* don't use static : performance detrimental  */
  158|       |    return one.c[0];
  159|       |#endif
  160|   132k|}
huf_decompress.c:MEM_write64:
  189|  1.40M|MEM_STATIC void MEM_write64(void* memPtr, U64 value) { *(unalign64*)memPtr = value; }
huf_decompress.c:MEM_readLEST:
  354|  73.7k|{
  355|  73.7k|    if (MEM_32bits())
  ------------------
  |  Branch (355:9): [True: 0, False: 73.7k]
  ------------------
  356|      0|        return (size_t)MEM_readLE32(memPtr);
  357|  73.7k|    else
  358|  73.7k|        return (size_t)MEM_readLE64(memPtr);
  359|  73.7k|}
huf_decompress.c:MEM_32bits:
  137|  76.5k|MEM_STATIC unsigned MEM_32bits(void) { return sizeof(size_t)==4; }
huf_decompress.c:MEM_readLE64:
  338|  73.7k|{
  339|  73.7k|    if (MEM_isLittleEndian())
  ------------------
  |  Branch (339:9): [True: 73.7k, False: 0]
  ------------------
  340|  73.7k|        return MEM_read64(memPtr);
  341|      0|    else
  342|      0|        return MEM_swap64(MEM_read64(memPtr));
  343|  73.7k|}
huf_decompress.c:MEM_read64:
  184|  73.7k|MEM_STATIC U64 MEM_read64(const void* ptr) { return *(const unalign64*)ptr; }
huf_decompress.c:MEM_64bits:
  138|   209k|MEM_STATIC unsigned MEM_64bits(void) { return sizeof(size_t)==8; }

ZSTD_XXH64_reset:
 3561|  4.53k|{
 3562|  4.53k|    XXH_ASSERT(statePtr != NULL);
  ------------------
  |  | 2430|  4.53k|#    define XXH_ASSERT(c)   XXH_ASSUME(c)
  |  |  ------------------
  |  |  |  | 2707|  4.53k|#  define XXH_ASSUME(c) __builtin_assume(c)
  |  |  ------------------
  ------------------
 3563|  4.53k|    memset(statePtr, 0, sizeof(*statePtr));
 3564|  4.53k|    statePtr->v[0] = seed + XXH_PRIME64_1 + XXH_PRIME64_2;
  ------------------
  |  | 3361|  4.53k|#define XXH_PRIME64_1  0x9E3779B185EBCA87ULL  /*!< 0b1001111000110111011110011011000110000101111010111100101010000111 */
  ------------------
                  statePtr->v[0] = seed + XXH_PRIME64_1 + XXH_PRIME64_2;
  ------------------
  |  | 3362|  4.53k|#define XXH_PRIME64_2  0xC2B2AE3D27D4EB4FULL  /*!< 0b1100001010110010101011100011110100100111110101001110101101001111 */
  ------------------
 3565|  4.53k|    statePtr->v[1] = seed + XXH_PRIME64_2;
  ------------------
  |  | 3362|  4.53k|#define XXH_PRIME64_2  0xC2B2AE3D27D4EB4FULL  /*!< 0b1100001010110010101011100011110100100111110101001110101101001111 */
  ------------------
 3566|  4.53k|    statePtr->v[2] = seed + 0;
 3567|  4.53k|    statePtr->v[3] = seed - XXH_PRIME64_1;
  ------------------
  |  | 3361|  4.53k|#define XXH_PRIME64_1  0x9E3779B185EBCA87ULL  /*!< 0b1001111000110111011110011011000110000101111010111100101010000111 */
  ------------------
 3568|  4.53k|    return XXH_OK;
 3569|  4.53k|}
ZSTD_XXH64_update:
 3574|     56|{
 3575|     56|    if (input==NULL) {
  ------------------
  |  Branch (3575:9): [True: 0, False: 56]
  ------------------
 3576|      0|        XXH_ASSERT(len == 0);
  ------------------
  |  | 2430|      0|#    define XXH_ASSERT(c)   XXH_ASSUME(c)
  |  |  ------------------
  |  |  |  | 2707|      0|#  define XXH_ASSUME(c) __builtin_assume(c)
  |  |  ------------------
  ------------------
 3577|      0|        return XXH_OK;
 3578|      0|    }
 3579|       |
 3580|     56|    {   const xxh_u8* p = (const xxh_u8*)input;
 3581|     56|        const xxh_u8* const bEnd = p + len;
 3582|       |
 3583|     56|        state->total_len += len;
 3584|       |
 3585|     56|        if (state->memsize + len < 32) {  /* fill in tmp buffer */
  ------------------
  |  Branch (3585:13): [True: 33, False: 23]
  ------------------
 3586|     33|            XXH_memcpy(((xxh_u8*)state->mem64) + state->memsize, input, len);
 3587|     33|            state->memsize += (xxh_u32)len;
 3588|     33|            return XXH_OK;
 3589|     33|        }
 3590|       |
 3591|     23|        if (state->memsize) {   /* tmp buffer is full */
  ------------------
  |  Branch (3591:13): [True: 2, False: 21]
  ------------------
 3592|      2|            XXH_memcpy(((xxh_u8*)state->mem64) + state->memsize, input, 32-state->memsize);
 3593|      2|            state->v[0] = XXH64_round(state->v[0], XXH_readLE64(state->mem64+0));
 3594|      2|            state->v[1] = XXH64_round(state->v[1], XXH_readLE64(state->mem64+1));
 3595|      2|            state->v[2] = XXH64_round(state->v[2], XXH_readLE64(state->mem64+2));
 3596|      2|            state->v[3] = XXH64_round(state->v[3], XXH_readLE64(state->mem64+3));
 3597|      2|            p += 32 - state->memsize;
 3598|      2|            state->memsize = 0;
 3599|      2|        }
 3600|       |
 3601|     23|        if (p+32 <= bEnd) {
  ------------------
  |  Branch (3601:13): [True: 23, False: 0]
  ------------------
 3602|     23|            const xxh_u8* const limit = bEnd - 32;
 3603|       |
 3604|  9.08k|            do {
 3605|  9.08k|                state->v[0] = XXH64_round(state->v[0], XXH_readLE64(p)); p+=8;
 3606|  9.08k|                state->v[1] = XXH64_round(state->v[1], XXH_readLE64(p)); p+=8;
 3607|  9.08k|                state->v[2] = XXH64_round(state->v[2], XXH_readLE64(p)); p+=8;
 3608|  9.08k|                state->v[3] = XXH64_round(state->v[3], XXH_readLE64(p)); p+=8;
 3609|  9.08k|            } while (p<=limit);
  ------------------
  |  Branch (3609:22): [True: 9.06k, False: 23]
  ------------------
 3610|       |
 3611|     23|        }
 3612|       |
 3613|     23|        if (p < bEnd) {
  ------------------
  |  Branch (3613:13): [True: 22, False: 1]
  ------------------
 3614|     22|            XXH_memcpy(state->mem64, p, (size_t)(bEnd-p));
 3615|     22|            state->memsize = (unsigned)(bEnd-p);
 3616|     22|        }
 3617|     23|    }
 3618|       |
 3619|      0|    return XXH_OK;
 3620|     56|}
ZSTD_XXH64_digest:
 3625|     15|{
 3626|     15|    xxh_u64 h64;
 3627|       |
 3628|     15|    if (state->total_len >= 32) {
  ------------------
  |  Branch (3628:9): [True: 8, False: 7]
  ------------------
 3629|      8|        h64 = XXH_rotl64(state->v[0], 1) + XXH_rotl64(state->v[1], 7) + XXH_rotl64(state->v[2], 12) + XXH_rotl64(state->v[3], 18);
  ------------------
  |  | 2728|      8|#  define XXH_rotl64 __builtin_rotateleft64
  ------------------
                      h64 = XXH_rotl64(state->v[0], 1) + XXH_rotl64(state->v[1], 7) + XXH_rotl64(state->v[2], 12) + XXH_rotl64(state->v[3], 18);
  ------------------
  |  | 2728|      8|#  define XXH_rotl64 __builtin_rotateleft64
  ------------------
                      h64 = XXH_rotl64(state->v[0], 1) + XXH_rotl64(state->v[1], 7) + XXH_rotl64(state->v[2], 12) + XXH_rotl64(state->v[3], 18);
  ------------------
  |  | 2728|      8|#  define XXH_rotl64 __builtin_rotateleft64
  ------------------
                      h64 = XXH_rotl64(state->v[0], 1) + XXH_rotl64(state->v[1], 7) + XXH_rotl64(state->v[2], 12) + XXH_rotl64(state->v[3], 18);
  ------------------
  |  | 2728|      8|#  define XXH_rotl64 __builtin_rotateleft64
  ------------------
 3630|      8|        h64 = XXH64_mergeRound(h64, state->v[0]);
 3631|      8|        h64 = XXH64_mergeRound(h64, state->v[1]);
 3632|      8|        h64 = XXH64_mergeRound(h64, state->v[2]);
 3633|      8|        h64 = XXH64_mergeRound(h64, state->v[3]);
 3634|      8|    } else {
 3635|      7|        h64  = state->v[2] /*seed*/ + XXH_PRIME64_5;
  ------------------
  |  | 3365|      7|#define XXH_PRIME64_5  0x27D4EB2F165667C5ULL  /*!< 0b0010011111010100111010110010111100010110010101100110011111000101 */
  ------------------
 3636|      7|    }
 3637|       |
 3638|     15|    h64 += (xxh_u64) state->total_len;
 3639|       |
 3640|     15|    return XXH64_finalize(h64, (const xxh_u8*)state->mem64, (size_t)state->total_len, XXH_aligned);
 3641|     15|}
xxhash.c:XXH_readLE32_align:
 2813|     12|{
 2814|     12|    if (align==XXH_unaligned) {
  ------------------
  |  Branch (2814:9): [True: 0, False: 12]
  ------------------
 2815|      0|        return XXH_readLE32(ptr);
 2816|     12|    } else {
 2817|     12|        return XXH_CPU_LITTLE_ENDIAN ? *(const xxh_u32*)ptr : XXH_swap32(*(const xxh_u32*)ptr);
  ------------------
  |  | 2629|     12|#    define XXH_CPU_LITTLE_ENDIAN 1
  |  |  ------------------
  |  |  |  Branch (2629:35): [True: 12, Folded]
  |  |  ------------------
  ------------------
 2818|     12|    }
 2819|     12|}
xxhash.c:XXH_memcpy:
 2359|     57|{
 2360|     57|    return memcpy(dest,src,size);
 2361|     57|}
xxhash.c:XXH_readLE64_align:
 3343|     20|{
 3344|     20|    if (align==XXH_unaligned)
  ------------------
  |  Branch (3344:9): [True: 0, False: 20]
  ------------------
 3345|      0|        return XXH_readLE64(ptr);
 3346|     20|    else
 3347|     20|        return XXH_CPU_LITTLE_ENDIAN ? *(const xxh_u64*)ptr : XXH_swap64(*(const xxh_u64*)ptr);
  ------------------
  |  | 2629|     20|#    define XXH_CPU_LITTLE_ENDIAN 1
  |  |  ------------------
  |  |  |  Branch (2629:35): [True: 20, Folded]
  |  |  ------------------
  ------------------
 3348|     20|}
xxhash.c:XXH64_round:
 3377|  36.4k|{
 3378|  36.4k|    acc += input * XXH_PRIME64_2;
  ------------------
  |  | 3362|  36.4k|#define XXH_PRIME64_2  0xC2B2AE3D27D4EB4FULL  /*!< 0b1100001010110010101011100011110100100111110101001110101101001111 */
  ------------------
 3379|  36.4k|    acc  = XXH_rotl64(acc, 31);
  ------------------
  |  | 2728|  36.4k|#  define XXH_rotl64 __builtin_rotateleft64
  ------------------
 3380|  36.4k|    acc *= XXH_PRIME64_1;
  ------------------
  |  | 3361|  36.4k|#define XXH_PRIME64_1  0x9E3779B185EBCA87ULL  /*!< 0b1001111000110111011110011011000110000101111010111100101010000111 */
  ------------------
 3381|       |#if (defined(__AVX512F__)) && !defined(XXH_ENABLE_AUTOVECTORIZE)
 3382|       |    /*
 3383|       |     * DISABLE AUTOVECTORIZATION:
 3384|       |     * A compiler fence is used to prevent GCC and Clang from
 3385|       |     * autovectorizing the XXH64 loop (pragmas and attributes don't work for some
 3386|       |     * reason) without globally disabling AVX512.
 3387|       |     *
 3388|       |     * Autovectorization of XXH64 tends to be detrimental,
 3389|       |     * though the exact outcome may change depending on exact cpu and compiler version.
 3390|       |     * For information, it has been reported as detrimental for Skylake-X,
 3391|       |     * but possibly beneficial for Zen4.
 3392|       |     *
 3393|       |     * The default is to disable auto-vectorization,
 3394|       |     * but you can select to enable it instead using `XXH_ENABLE_AUTOVECTORIZE` build variable.
 3395|       |     */
 3396|       |    XXH_COMPILER_GUARD(acc);
 3397|       |#endif
 3398|  36.4k|    return acc;
 3399|  36.4k|}
xxhash.c:XXH_readLE64:
 3331|  36.3k|{
 3332|  36.3k|    return XXH_CPU_LITTLE_ENDIAN ? XXH_read64(ptr) : XXH_swap64(XXH_read64(ptr));
  ------------------
  |  | 2629|  36.3k|#    define XXH_CPU_LITTLE_ENDIAN 1
  |  |  ------------------
  |  |  |  Branch (2629:35): [True: 36.3k, Folded]
  |  |  ------------------
  ------------------
 3333|  36.3k|}
xxhash.c:XXH_read64:
 3261|  36.3k|{
 3262|  36.3k|    typedef __attribute__((aligned(1))) xxh_u64 xxh_unalign64;
 3263|  36.3k|    return *((const xxh_unalign64*)ptr);
 3264|  36.3k|}
xxhash.c:XXH64_mergeRound:
 3402|     32|{
 3403|     32|    val  = XXH64_round(0, val);
 3404|     32|    acc ^= val;
 3405|     32|    acc  = acc * XXH_PRIME64_1 + XXH_PRIME64_4;
  ------------------
  |  | 3361|     32|#define XXH_PRIME64_1  0x9E3779B185EBCA87ULL  /*!< 0b1001111000110111011110011011000110000101111010111100101010000111 */
  ------------------
                  acc  = acc * XXH_PRIME64_1 + XXH_PRIME64_4;
  ------------------
  |  | 3364|     32|#define XXH_PRIME64_4  0x85EBCA77C2B2AE63ULL  /*!< 0b1000010111101011110010100111011111000010101100101010111001100011 */
  ------------------
 3406|     32|    return acc;
 3407|     32|}
xxhash.c:XXH64_finalize:
 3440|     15|{
 3441|     15|    if (ptr==NULL) XXH_ASSERT(len == 0);
  ------------------
  |  | 2430|      0|#    define XXH_ASSERT(c)   XXH_ASSUME(c)
  |  |  ------------------
  |  |  |  | 2707|      0|#  define XXH_ASSUME(c) __builtin_assume(c)
  |  |  ------------------
  ------------------
  |  Branch (3441:9): [True: 0, False: 15]
  ------------------
 3442|     15|    len &= 31;
 3443|     35|    while (len >= 8) {
  ------------------
  |  Branch (3443:12): [True: 20, False: 15]
  ------------------
 3444|     20|        xxh_u64 const k1 = XXH64_round(0, XXH_get64bits(ptr));
  ------------------
  |  | 3421|     20|#define XXH_get64bits(p) XXH_readLE64_align(p, align)
  ------------------
 3445|     20|        ptr += 8;
 3446|     20|        hash ^= k1;
 3447|     20|        hash  = XXH_rotl64(hash,27) * XXH_PRIME64_1 + XXH_PRIME64_4;
  ------------------
  |  | 2728|     20|#  define XXH_rotl64 __builtin_rotateleft64
  ------------------
                      hash  = XXH_rotl64(hash,27) * XXH_PRIME64_1 + XXH_PRIME64_4;
  ------------------
  |  | 3361|     20|#define XXH_PRIME64_1  0x9E3779B185EBCA87ULL  /*!< 0b1001111000110111011110011011000110000101111010111100101010000111 */
  ------------------
                      hash  = XXH_rotl64(hash,27) * XXH_PRIME64_1 + XXH_PRIME64_4;
  ------------------
  |  | 3364|     20|#define XXH_PRIME64_4  0x85EBCA77C2B2AE63ULL  /*!< 0b1000010111101011110010100111011111000010101100101010111001100011 */
  ------------------
 3448|     20|        len -= 8;
 3449|     20|    }
 3450|     15|    if (len >= 4) {
  ------------------
  |  Branch (3450:9): [True: 12, False: 3]
  ------------------
 3451|     12|        hash ^= (xxh_u64)(XXH_get32bits(ptr)) * XXH_PRIME64_1;
  ------------------
  |  | 2933|     12|#define XXH_get32bits(p) XXH_readLE32_align(p, align)
  ------------------
                      hash ^= (xxh_u64)(XXH_get32bits(ptr)) * XXH_PRIME64_1;
  ------------------
  |  | 3361|     12|#define XXH_PRIME64_1  0x9E3779B185EBCA87ULL  /*!< 0b1001111000110111011110011011000110000101111010111100101010000111 */
  ------------------
 3452|     12|        ptr += 4;
 3453|     12|        hash = XXH_rotl64(hash, 23) * XXH_PRIME64_2 + XXH_PRIME64_3;
  ------------------
  |  | 2728|     12|#  define XXH_rotl64 __builtin_rotateleft64
  ------------------
                      hash = XXH_rotl64(hash, 23) * XXH_PRIME64_2 + XXH_PRIME64_3;
  ------------------
  |  | 3362|     12|#define XXH_PRIME64_2  0xC2B2AE3D27D4EB4FULL  /*!< 0b1100001010110010101011100011110100100111110101001110101101001111 */
  ------------------
                      hash = XXH_rotl64(hash, 23) * XXH_PRIME64_2 + XXH_PRIME64_3;
  ------------------
  |  | 3363|     12|#define XXH_PRIME64_3  0x165667B19E3779F9ULL  /*!< 0b0001011001010110011001111011000110011110001101110111100111111001 */
  ------------------
 3454|     12|        len -= 4;
 3455|     12|    }
 3456|     37|    while (len > 0) {
  ------------------
  |  Branch (3456:12): [True: 22, False: 15]
  ------------------
 3457|     22|        hash ^= (*ptr++) * XXH_PRIME64_5;
  ------------------
  |  | 3365|     22|#define XXH_PRIME64_5  0x27D4EB2F165667C5ULL  /*!< 0b0010011111010100111010110010111100010110010101100110011111000101 */
  ------------------
 3458|     22|        hash = XXH_rotl64(hash, 11) * XXH_PRIME64_1;
  ------------------
  |  | 2728|     22|#  define XXH_rotl64 __builtin_rotateleft64
  ------------------
                      hash = XXH_rotl64(hash, 11) * XXH_PRIME64_1;
  ------------------
  |  | 3361|     22|#define XXH_PRIME64_1  0x9E3779B185EBCA87ULL  /*!< 0b1001111000110111011110011011000110000101111010111100101010000111 */
  ------------------
 3459|     22|        --len;
 3460|     22|    }
 3461|     15|    return  XXH64_avalanche(hash);
 3462|     15|}
xxhash.c:XXH64_avalanche:
 3411|     15|{
 3412|     15|    hash ^= hash >> 33;
 3413|     15|    hash *= XXH_PRIME64_2;
  ------------------
  |  | 3362|     15|#define XXH_PRIME64_2  0xC2B2AE3D27D4EB4FULL  /*!< 0b1100001010110010101011100011110100100111110101001110101101001111 */
  ------------------
 3414|     15|    hash ^= hash >> 29;
 3415|     15|    hash *= XXH_PRIME64_3;
  ------------------
  |  | 3363|     15|#define XXH_PRIME64_3  0x165667B19E3779F9ULL  /*!< 0b0001011001010110011001111011000110011110001101110111100111111001 */
  ------------------
 3416|     15|    hash ^= hash >> 32;
 3417|     15|    return hash;
 3418|     15|}

ZSTD_isError:
   36|  9.51k|unsigned ZSTD_isError(size_t code) { return ERR_isError(code); }
ZSTD_getErrorCode:
   44|  5.14k|ZSTD_ErrorCode ZSTD_getErrorCode(size_t code) { return ERR_getErrorCode(code); }

zstd_compress.c:ZSTD_cpuSupportsBmi2:
  321|     28|{
  322|     28|    ZSTD_cpuid_t cpuid = ZSTD_cpuid();
  323|     28|    return ZSTD_cpuid_bmi1(cpuid) && ZSTD_cpuid_bmi2(cpuid);
  ------------------
  |  Branch (323:12): [True: 28, False: 0]
  |  Branch (323:38): [True: 28, False: 0]
  ------------------
  324|     28|}
zstd_double_fast.c:ZSTD_copy16:
  183|    874|static void ZSTD_copy16(void* dst, const void* src) {
  184|       |#if defined(ZSTD_ARCH_ARM_NEON)
  185|       |    vst1q_u8((uint8_t*)dst, vld1q_u8((const uint8_t*)src));
  186|       |#elif defined(ZSTD_ARCH_X86_SSE2)
  187|       |    _mm_storeu_si128((__m128i*)dst, _mm_loadu_si128((const __m128i*)src));
  188|       |#elif defined(ZSTD_ARCH_RISCV_RVV)
  189|       |    __riscv_vse8_v_u8m1((uint8_t*)dst, __riscv_vle8_v_u8m1((const uint8_t*)src, 16), 16);
  190|       |#elif defined(__clang__)
  191|       |    ZSTD_memmove(dst, src, 16);
  192|       |#else
  193|       |    /* ZSTD_memmove is not inlined properly by gcc */
  194|       |    BYTE copy16_buf[16];
  195|       |    ZSTD_memcpy(copy16_buf, src, 16);
  196|       |    ZSTD_memcpy(dst, copy16_buf, 16);
  197|       |#endif
  198|    874|}
zstd_double_fast.c:ZSTD_wildcopy:
  219|    200|{
  220|    200|    ptrdiff_t diff = (BYTE*)dst - (const BYTE*)src;
  221|    200|    const BYTE* ip = (const BYTE*)src;
  222|    200|    BYTE* op = (BYTE*)dst;
  223|    200|    BYTE* const oend = op + length;
  224|       |
  225|    200|    if (ovtype == ZSTD_overlap_src_before_dst && diff < WILDCOPY_VECLEN) {
  ------------------
  |  |  202|      0|#define WILDCOPY_VECLEN 16
  ------------------
  |  Branch (225:9): [True: 0, False: 200]
  |  Branch (225:50): [True: 0, False: 0]
  ------------------
  226|       |        /* Handle short offset copies. */
  227|      0|        do {
  228|      0|            COPY8(op, ip);
  ------------------
  |  |  177|      0|#define COPY8(d,s) do { ZSTD_copy8(d,s); d+=8; s+=8; } while (0)
  |  |  ------------------
  |  |  |  Branch (177:63): [Folded, False: 0]
  |  |  ------------------
  ------------------
  229|      0|        } while (op < oend);
  ------------------
  |  Branch (229:18): [True: 0, False: 0]
  ------------------
  230|    200|    } else {
  231|    200|        assert(diff >= WILDCOPY_VECLEN || diff <= -WILDCOPY_VECLEN);
  ------------------
  |  |   70|    200|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  232|       |        /* Separate out the first COPY16() call because the copy length is
  233|       |         * almost certain to be short, so the branches have different
  234|       |         * probabilities. Since it is almost certain to be short, only do
  235|       |         * one COPY16() in the first call. Then, do two calls per loop since
  236|       |         * at that point it is more likely to have a high trip count.
  237|       |         */
  238|    200|        ZSTD_copy16(op, ip);
  239|    200|        if (16 >= length) return;
  ------------------
  |  Branch (239:13): [True: 69, False: 131]
  ------------------
  240|    131|        op += 16;
  241|    131|        ip += 16;
  242|    219|        do {
  243|    219|            COPY16(op, ip);
  ------------------
  |  |  199|    219|#define COPY16(d,s) do { ZSTD_copy16(d,s); d+=16; s+=16; } while (0)
  |  |  ------------------
  |  |  |  Branch (199:67): [Folded, False: 219]
  |  |  ------------------
  ------------------
  244|    219|            COPY16(op, ip);
  ------------------
  |  |  199|    219|#define COPY16(d,s) do { ZSTD_copy16(d,s); d+=16; s+=16; } while (0)
  |  |  ------------------
  |  |  |  Branch (199:67): [Folded, False: 219]
  |  |  ------------------
  ------------------
  245|    219|        }
  246|    219|        while (op < oend);
  ------------------
  |  Branch (246:16): [True: 88, False: 131]
  ------------------
  247|    131|    }
  248|    200|}
zstd_lazy.c:ZSTD_copy16:
  183|  14.1k|static void ZSTD_copy16(void* dst, const void* src) {
  184|       |#if defined(ZSTD_ARCH_ARM_NEON)
  185|       |    vst1q_u8((uint8_t*)dst, vld1q_u8((const uint8_t*)src));
  186|       |#elif defined(ZSTD_ARCH_X86_SSE2)
  187|       |    _mm_storeu_si128((__m128i*)dst, _mm_loadu_si128((const __m128i*)src));
  188|       |#elif defined(ZSTD_ARCH_RISCV_RVV)
  189|       |    __riscv_vse8_v_u8m1((uint8_t*)dst, __riscv_vle8_v_u8m1((const uint8_t*)src, 16), 16);
  190|       |#elif defined(__clang__)
  191|       |    ZSTD_memmove(dst, src, 16);
  192|       |#else
  193|       |    /* ZSTD_memmove is not inlined properly by gcc */
  194|       |    BYTE copy16_buf[16];
  195|       |    ZSTD_memcpy(copy16_buf, src, 16);
  196|       |    ZSTD_memcpy(dst, copy16_buf, 16);
  197|       |#endif
  198|  14.1k|}
zstd_lazy.c:ZSTD_wildcopy:
  219|  2.79k|{
  220|  2.79k|    ptrdiff_t diff = (BYTE*)dst - (const BYTE*)src;
  221|  2.79k|    const BYTE* ip = (const BYTE*)src;
  222|  2.79k|    BYTE* op = (BYTE*)dst;
  223|  2.79k|    BYTE* const oend = op + length;
  224|       |
  225|  2.79k|    if (ovtype == ZSTD_overlap_src_before_dst && diff < WILDCOPY_VECLEN) {
  ------------------
  |  |  202|      0|#define WILDCOPY_VECLEN 16
  ------------------
  |  Branch (225:9): [True: 0, False: 2.79k]
  |  Branch (225:50): [True: 0, False: 0]
  ------------------
  226|       |        /* Handle short offset copies. */
  227|      0|        do {
  228|      0|            COPY8(op, ip);
  ------------------
  |  |  177|      0|#define COPY8(d,s) do { ZSTD_copy8(d,s); d+=8; s+=8; } while (0)
  |  |  ------------------
  |  |  |  Branch (177:63): [Folded, False: 0]
  |  |  ------------------
  ------------------
  229|      0|        } while (op < oend);
  ------------------
  |  Branch (229:18): [True: 0, False: 0]
  ------------------
  230|  2.79k|    } else {
  231|  2.79k|        assert(diff >= WILDCOPY_VECLEN || diff <= -WILDCOPY_VECLEN);
  ------------------
  |  |   70|  2.79k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  232|       |        /* Separate out the first COPY16() call because the copy length is
  233|       |         * almost certain to be short, so the branches have different
  234|       |         * probabilities. Since it is almost certain to be short, only do
  235|       |         * one COPY16() in the first call. Then, do two calls per loop since
  236|       |         * at that point it is more likely to have a high trip count.
  237|       |         */
  238|  2.79k|        ZSTD_copy16(op, ip);
  239|  2.79k|        if (16 >= length) return;
  ------------------
  |  Branch (239:13): [True: 1.56k, False: 1.22k]
  ------------------
  240|  1.22k|        op += 16;
  241|  1.22k|        ip += 16;
  242|  1.98k|        do {
  243|  1.98k|            COPY16(op, ip);
  ------------------
  |  |  199|  1.98k|#define COPY16(d,s) do { ZSTD_copy16(d,s); d+=16; s+=16; } while (0)
  |  |  ------------------
  |  |  |  Branch (199:67): [Folded, False: 1.98k]
  |  |  ------------------
  ------------------
  244|  1.98k|            COPY16(op, ip);
  ------------------
  |  |  199|  1.98k|#define COPY16(d,s) do { ZSTD_copy16(d,s); d+=16; s+=16; } while (0)
  |  |  ------------------
  |  |  |  Branch (199:67): [Folded, False: 1.98k]
  |  |  ------------------
  ------------------
  245|  1.98k|        }
  246|  1.98k|        while (op < oend);
  ------------------
  |  Branch (246:16): [True: 763, False: 1.22k]
  ------------------
  247|  1.22k|    }
  248|  2.79k|}
zstd_opt.c:ZSTD_copy16:
  183|  7.59k|static void ZSTD_copy16(void* dst, const void* src) {
  184|       |#if defined(ZSTD_ARCH_ARM_NEON)
  185|       |    vst1q_u8((uint8_t*)dst, vld1q_u8((const uint8_t*)src));
  186|       |#elif defined(ZSTD_ARCH_X86_SSE2)
  187|       |    _mm_storeu_si128((__m128i*)dst, _mm_loadu_si128((const __m128i*)src));
  188|       |#elif defined(ZSTD_ARCH_RISCV_RVV)
  189|       |    __riscv_vse8_v_u8m1((uint8_t*)dst, __riscv_vle8_v_u8m1((const uint8_t*)src, 16), 16);
  190|       |#elif defined(__clang__)
  191|       |    ZSTD_memmove(dst, src, 16);
  192|       |#else
  193|       |    /* ZSTD_memmove is not inlined properly by gcc */
  194|       |    BYTE copy16_buf[16];
  195|       |    ZSTD_memcpy(copy16_buf, src, 16);
  196|       |    ZSTD_memcpy(dst, copy16_buf, 16);
  197|       |#endif
  198|  7.59k|}
zstd_opt.c:ZSTD_wildcopy:
  219|  1.49k|{
  220|  1.49k|    ptrdiff_t diff = (BYTE*)dst - (const BYTE*)src;
  221|  1.49k|    const BYTE* ip = (const BYTE*)src;
  222|  1.49k|    BYTE* op = (BYTE*)dst;
  223|  1.49k|    BYTE* const oend = op + length;
  224|       |
  225|  1.49k|    if (ovtype == ZSTD_overlap_src_before_dst && diff < WILDCOPY_VECLEN) {
  ------------------
  |  |  202|      0|#define WILDCOPY_VECLEN 16
  ------------------
  |  Branch (225:9): [True: 0, False: 1.49k]
  |  Branch (225:50): [True: 0, False: 0]
  ------------------
  226|       |        /* Handle short offset copies. */
  227|      0|        do {
  228|      0|            COPY8(op, ip);
  ------------------
  |  |  177|      0|#define COPY8(d,s) do { ZSTD_copy8(d,s); d+=8; s+=8; } while (0)
  |  |  ------------------
  |  |  |  Branch (177:63): [Folded, False: 0]
  |  |  ------------------
  ------------------
  229|      0|        } while (op < oend);
  ------------------
  |  Branch (229:18): [True: 0, False: 0]
  ------------------
  230|  1.49k|    } else {
  231|  1.49k|        assert(diff >= WILDCOPY_VECLEN || diff <= -WILDCOPY_VECLEN);
  ------------------
  |  |   70|  1.49k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  232|       |        /* Separate out the first COPY16() call because the copy length is
  233|       |         * almost certain to be short, so the branches have different
  234|       |         * probabilities. Since it is almost certain to be short, only do
  235|       |         * one COPY16() in the first call. Then, do two calls per loop since
  236|       |         * at that point it is more likely to have a high trip count.
  237|       |         */
  238|  1.49k|        ZSTD_copy16(op, ip);
  239|  1.49k|        if (16 >= length) return;
  ------------------
  |  Branch (239:13): [True: 716, False: 777]
  ------------------
  240|    777|        op += 16;
  241|    777|        ip += 16;
  242|  1.28k|        do {
  243|  1.28k|            COPY16(op, ip);
  ------------------
  |  |  199|  1.28k|#define COPY16(d,s) do { ZSTD_copy16(d,s); d+=16; s+=16; } while (0)
  |  |  ------------------
  |  |  |  Branch (199:67): [Folded, False: 1.28k]
  |  |  ------------------
  ------------------
  244|  1.28k|            COPY16(op, ip);
  ------------------
  |  |  199|  1.28k|#define COPY16(d,s) do { ZSTD_copy16(d,s); d+=16; s+=16; } while (0)
  |  |  ------------------
  |  |  |  Branch (199:67): [Folded, False: 1.28k]
  |  |  ------------------
  ------------------
  245|  1.28k|        }
  246|  1.28k|        while (op < oend);
  ------------------
  |  Branch (246:16): [True: 506, False: 777]
  ------------------
  247|    777|    }
  248|  1.49k|}
zstd_decompress.c:ZSTD_cpuSupportsBmi2:
  321|    404|{
  322|    404|    ZSTD_cpuid_t cpuid = ZSTD_cpuid();
  323|    404|    return ZSTD_cpuid_bmi1(cpuid) && ZSTD_cpuid_bmi2(cpuid);
  ------------------
  |  Branch (323:12): [True: 404, False: 0]
  |  Branch (323:38): [True: 404, False: 0]
  ------------------
  324|    404|}
zstd_decompress_block.c:ZSTD_wildcopy:
  219|  12.8k|{
  220|  12.8k|    ptrdiff_t diff = (BYTE*)dst - (const BYTE*)src;
  221|  12.8k|    const BYTE* ip = (const BYTE*)src;
  222|  12.8k|    BYTE* op = (BYTE*)dst;
  223|  12.8k|    BYTE* const oend = op + length;
  224|       |
  225|  12.8k|    if (ovtype == ZSTD_overlap_src_before_dst && diff < WILDCOPY_VECLEN) {
  ------------------
  |  |  202|  3.76k|#define WILDCOPY_VECLEN 16
  ------------------
  |  Branch (225:9): [True: 3.76k, False: 9.07k]
  |  Branch (225:50): [True: 3.26k, False: 494]
  ------------------
  226|       |        /* Handle short offset copies. */
  227|  8.13k|        do {
  228|  8.13k|            COPY8(op, ip);
  ------------------
  |  |  177|  8.13k|#define COPY8(d,s) do { ZSTD_copy8(d,s); d+=8; s+=8; } while (0)
  |  |  ------------------
  |  |  |  Branch (177:63): [Folded, False: 8.13k]
  |  |  ------------------
  ------------------
  229|  8.13k|        } while (op < oend);
  ------------------
  |  Branch (229:18): [True: 4.87k, False: 3.26k]
  ------------------
  230|  9.56k|    } else {
  231|  9.56k|        assert(diff >= WILDCOPY_VECLEN || diff <= -WILDCOPY_VECLEN);
  ------------------
  |  |   70|  9.56k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  232|       |        /* Separate out the first COPY16() call because the copy length is
  233|       |         * almost certain to be short, so the branches have different
  234|       |         * probabilities. Since it is almost certain to be short, only do
  235|       |         * one COPY16() in the first call. Then, do two calls per loop since
  236|       |         * at that point it is more likely to have a high trip count.
  237|       |         */
  238|  9.56k|        ZSTD_copy16(op, ip);
  239|  9.56k|        if (16 >= length) return;
  ------------------
  |  Branch (239:13): [True: 6.94k, False: 2.62k]
  ------------------
  240|  2.62k|        op += 16;
  241|  2.62k|        ip += 16;
  242|  3.54k|        do {
  243|  3.54k|            COPY16(op, ip);
  ------------------
  |  |  199|  3.54k|#define COPY16(d,s) do { ZSTD_copy16(d,s); d+=16; s+=16; } while (0)
  |  |  ------------------
  |  |  |  Branch (199:67): [Folded, False: 3.54k]
  |  |  ------------------
  ------------------
  244|  3.54k|            COPY16(op, ip);
  ------------------
  |  |  199|  3.54k|#define COPY16(d,s) do { ZSTD_copy16(d,s); d+=16; s+=16; } while (0)
  |  |  ------------------
  |  |  |  Branch (199:67): [Folded, False: 3.54k]
  |  |  ------------------
  ------------------
  245|  3.54k|        }
  246|  3.54k|        while (op < oend);
  ------------------
  |  Branch (246:16): [True: 922, False: 2.62k]
  ------------------
  247|  2.62k|    }
  248|  12.8k|}
zstd_decompress_block.c:ZSTD_copy8:
  170|  12.2k|static void ZSTD_copy8(void* dst, const void* src) {
  171|       |#if defined(ZSTD_ARCH_ARM_NEON) && !defined(__aarch64__)
  172|       |    vst1_u8((uint8_t*)dst, vld1_u8((const uint8_t*)src));
  173|       |#else
  174|  12.2k|    ZSTD_memcpy(dst, src, 8);
  ------------------
  |  |   44|  12.2k|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  ------------------
  175|  12.2k|#endif
  176|  12.2k|}
zstd_decompress_block.c:ZSTD_copy16:
  183|  28.2k|static void ZSTD_copy16(void* dst, const void* src) {
  184|       |#if defined(ZSTD_ARCH_ARM_NEON)
  185|       |    vst1q_u8((uint8_t*)dst, vld1q_u8((const uint8_t*)src));
  186|       |#elif defined(ZSTD_ARCH_X86_SSE2)
  187|       |    _mm_storeu_si128((__m128i*)dst, _mm_loadu_si128((const __m128i*)src));
  188|       |#elif defined(ZSTD_ARCH_RISCV_RVV)
  189|       |    __riscv_vse8_v_u8m1((uint8_t*)dst, __riscv_vle8_v_u8m1((const uint8_t*)src, 16), 16);
  190|       |#elif defined(__clang__)
  191|       |    ZSTD_memmove(dst, src, 16);
  192|       |#else
  193|       |    /* ZSTD_memmove is not inlined properly by gcc */
  194|       |    BYTE copy16_buf[16];
  195|       |    ZSTD_memcpy(copy16_buf, src, 16);
  196|       |    ZSTD_memcpy(dst, copy16_buf, 16);
  197|       |#endif
  198|  28.2k|}

FSE_buildCTable_wksp:
   71|  14.7k|{
   72|  14.7k|    U32 const tableSize = 1 << tableLog;
   73|  14.7k|    U32 const tableMask = tableSize - 1;
   74|  14.7k|    void* const ptr = ct;
   75|  14.7k|    U16* const tableU16 = ( (U16*) ptr) + 2;
   76|  14.7k|    void* const FSCT = ((U32*)ptr) + 1 /* header */ + (tableLog ? tableSize>>1 : 1) ;
  ------------------
  |  Branch (76:56): [True: 14.7k, False: 0]
  ------------------
   77|  14.7k|    FSE_symbolCompressionTransform* const symbolTT = (FSE_symbolCompressionTransform*) (FSCT);
   78|  14.7k|    U32 const step = FSE_TABLESTEP(tableSize);
  ------------------
  |  |  623|  14.7k|#define FSE_TABLESTEP(tableSize) (((tableSize)>>1) + ((tableSize)>>3) + 3)
  ------------------
   79|  14.7k|    U32 const maxSV1 = maxSymbolValue+1;
   80|       |
   81|  14.7k|    U16* cumul = (U16*)workSpace;   /* size = maxSV1 */
   82|  14.7k|    FSE_FUNCTION_TYPE* const tableSymbol = (FSE_FUNCTION_TYPE*)(cumul + (maxSV1+1));  /* size = tableSize */
  ------------------
  |  |  601|  14.7k|#define FSE_FUNCTION_TYPE BYTE
  ------------------
   83|       |
   84|  14.7k|    U32 highThreshold = tableSize-1;
   85|       |
   86|  14.7k|    assert(((size_t)workSpace & 1) == 0);  /* Must be 2 bytes-aligned */
  ------------------
  |  |   70|  14.7k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
   87|  14.7k|    if (FSE_BUILD_CTABLE_WORKSPACE_SIZE(maxSymbolValue, tableLog) > wkspSize) return ERROR(tableLog_tooLarge);
  ------------------
  |  |  264|  14.7k|#define FSE_BUILD_CTABLE_WORKSPACE_SIZE(maxSymbolValue, tableLog) (sizeof(unsigned) * FSE_BUILD_CTABLE_WORKSPACE_SIZE_U32(maxSymbolValue, tableLog))
  |  |  ------------------
  |  |  |  |  263|  14.7k|#define FSE_BUILD_CTABLE_WORKSPACE_SIZE_U32(maxSymbolValue, tableLog) (((maxSymbolValue + 2) + (1ull << (tableLog)))/2 + sizeof(U64)/sizeof(U32) /* additional 8 bytes for potential table overwrite */)
  |  |  ------------------
  ------------------
                  if (FSE_BUILD_CTABLE_WORKSPACE_SIZE(maxSymbolValue, tableLog) > wkspSize) return ERROR(tableLog_tooLarge);
  ------------------
  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (87:9): [True: 0, False: 14.7k]
  ------------------
   88|       |    /* CTable header */
   89|  14.7k|    tableU16[-2] = (U16) tableLog;
   90|  14.7k|    tableU16[-1] = (U16) maxSymbolValue;
   91|  14.7k|    assert(tableLog < 16);   /* required for threshold strategy to work */
  ------------------
  |  |   70|  14.7k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
   92|       |
   93|       |    /* For explanations on how to distribute symbol values over the table :
   94|       |     * https://fastcompression.blogspot.fr/2014/02/fse-distributing-symbol-values.html */
   95|       |
   96|       |     #ifdef __clang_analyzer__
   97|       |     ZSTD_memset(tableSymbol, 0, sizeof(*tableSymbol) * tableSize);   /* useless initialization, just to keep scan-build happy */
   98|       |     #endif
   99|       |
  100|       |    /* symbol start positions */
  101|  14.7k|    {   U32 u;
  102|  14.7k|        cumul[0] = 0;
  103|   353k|        for (u=1; u <= maxSV1; u++) {
  ------------------
  |  Branch (103:19): [True: 338k, False: 14.7k]
  ------------------
  104|   338k|            if (normalizedCounter[u-1]==-1) {  /* Low proba symbol */
  ------------------
  |  Branch (104:17): [True: 40.2k, False: 298k]
  ------------------
  105|  40.2k|                cumul[u] = cumul[u-1] + 1;
  106|  40.2k|                tableSymbol[highThreshold--] = (FSE_FUNCTION_TYPE)(u-1);
  107|   298k|            } else {
  108|   298k|                assert(normalizedCounter[u-1] >= 0);
  ------------------
  |  |   70|   298k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  109|   298k|                cumul[u] = cumul[u-1] + (U16)normalizedCounter[u-1];
  110|   298k|                assert(cumul[u] >= cumul[u-1]);  /* no overflow */
  ------------------
  |  |   70|   298k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  111|   298k|        }   }
  112|  14.7k|        cumul[maxSV1] = (U16)(tableSize+1);
  113|  14.7k|    }
  114|       |
  115|       |    /* Spread symbols */
  116|  14.7k|    if (highThreshold == tableSize - 1) {
  ------------------
  |  Branch (116:9): [True: 7.10k, False: 7.59k]
  ------------------
  117|       |        /* Case for no low prob count symbols. Lay down 8 bytes at a time
  118|       |         * to reduce branch misses since we are operating on a small block
  119|       |         */
  120|  7.10k|        BYTE* const spread = tableSymbol + tableSize; /* size = tableSize + 8 (may write beyond tableSize) */
  121|  7.10k|        {   U64 const add = 0x0101010101010101ull;
  122|  7.10k|            size_t pos = 0;
  123|  7.10k|            U64 sv = 0;
  124|  7.10k|            U32 s;
  125|  46.3k|            for (s=0; s<maxSV1; ++s, sv += add) {
  ------------------
  |  Branch (125:23): [True: 39.2k, False: 7.10k]
  ------------------
  126|  39.2k|                int i;
  127|  39.2k|                int const n = normalizedCounter[s];
  128|  39.2k|                MEM_write64(spread + pos, sv);
  129|  57.1k|                for (i = 8; i < n; i += 8) {
  ------------------
  |  Branch (129:29): [True: 17.8k, False: 39.2k]
  ------------------
  130|  17.8k|                    MEM_write64(spread + pos + i, sv);
  131|  17.8k|                }
  132|  39.2k|                assert(n>=0);
  ------------------
  |  |   70|  39.2k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  133|  39.2k|                pos += (size_t)n;
  134|  39.2k|            }
  135|  7.10k|        }
  136|       |        /* Spread symbols across the table. Lack of lowprob symbols means that
  137|       |         * we don't need variable sized inner loop, so we can unroll the loop and
  138|       |         * reduce branch misses.
  139|       |         */
  140|  7.10k|        {   size_t position = 0;
  141|  7.10k|            size_t s;
  142|  7.10k|            size_t const unroll = 2; /* Experimentally determined optimal unroll */
  143|  7.10k|            assert(tableSize % unroll == 0); /* FSE_MIN_TABLELOG is 5 */
  ------------------
  |  |   70|  7.10k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  144|   120k|            for (s = 0; s < (size_t)tableSize; s += unroll) {
  ------------------
  |  Branch (144:25): [True: 113k, False: 7.10k]
  ------------------
  145|   113k|                size_t u;
  146|   341k|                for (u = 0; u < unroll; ++u) {
  ------------------
  |  Branch (146:29): [True: 227k, False: 113k]
  ------------------
  147|   227k|                    size_t const uPosition = (position + (u * step)) & tableMask;
  148|   227k|                    tableSymbol[uPosition] = spread[s + u];
  149|   227k|                }
  150|   113k|                position = (position + (unroll * step)) & tableMask;
  151|   113k|            }
  152|  7.10k|            assert(position == 0);   /* Must have initialized all positions */
  ------------------
  |  |   70|  7.10k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  153|  7.10k|        }
  154|  7.59k|    } else {
  155|  7.59k|        U32 position = 0;
  156|  7.59k|        U32 symbol;
  157|   306k|        for (symbol=0; symbol<maxSV1; symbol++) {
  ------------------
  |  Branch (157:24): [True: 299k, False: 7.59k]
  ------------------
  158|   299k|            int nbOccurrences;
  159|   299k|            int const freq = normalizedCounter[symbol];
  160|   668k|            for (nbOccurrences=0; nbOccurrences<freq; nbOccurrences++) {
  ------------------
  |  Branch (160:35): [True: 369k, False: 299k]
  ------------------
  161|   369k|                tableSymbol[position] = (FSE_FUNCTION_TYPE)symbol;
  162|   369k|                position = (position + step) & tableMask;
  163|   409k|                while (position > highThreshold)
  ------------------
  |  Branch (163:24): [True: 40.2k, False: 369k]
  ------------------
  164|  40.2k|                    position = (position + step) & tableMask;   /* Low proba area */
  165|   369k|        }   }
  166|  7.59k|        assert(position==0);  /* Must have initialized all positions */
  ------------------
  |  |   70|  7.59k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  167|  7.59k|    }
  168|       |
  169|       |    /* Build table */
  170|   651k|    {   U32 u; for (u=0; u<tableSize; u++) {
  ------------------
  |  Branch (170:26): [True: 637k, False: 14.7k]
  ------------------
  171|   637k|        FSE_FUNCTION_TYPE s = tableSymbol[u];   /* note : static analyzer may not understand tableSymbol is properly initialized */
  ------------------
  |  |  601|   637k|#define FSE_FUNCTION_TYPE BYTE
  ------------------
  172|   637k|        tableU16[cumul[s]++] = (U16) (tableSize+u);   /* TableU16 : sorted by symbol order; gives next state value */
  173|   637k|    }   }
  174|       |
  175|       |    /* Build Symbol Transformation Table */
  176|  14.7k|    {   unsigned total = 0;
  177|  14.7k|        unsigned s;
  178|   353k|        for (s=0; s<=maxSymbolValue; s++) {
  ------------------
  |  Branch (178:19): [True: 338k, False: 14.7k]
  ------------------
  179|   338k|            switch (normalizedCounter[s])
  180|   338k|            {
  181|  4.98k|            case  0:
  ------------------
  |  Branch (181:13): [True: 4.98k, False: 333k]
  ------------------
  182|       |                /* filling nonetheless, for compatibility with FSE_getMaxNbBits() */
  183|  4.98k|                symbolTT[s].deltaNbBits = ((tableLog+1) << 16) - (1<<tableLog);
  184|  4.98k|                break;
  185|       |
  186|  40.2k|            case -1:
  ------------------
  |  Branch (186:13): [True: 40.2k, False: 298k]
  ------------------
  187|   221k|            case  1:
  ------------------
  |  Branch (187:13): [True: 181k, False: 156k]
  ------------------
  188|   221k|                symbolTT[s].deltaNbBits = (tableLog << 16) - (1<<tableLog);
  189|   221k|                assert(total <= INT_MAX);
  ------------------
  |  |   70|   221k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  190|   221k|                symbolTT[s].deltaFindState = (int)(total - 1);
  191|   221k|                total ++;
  192|   221k|                break;
  193|   111k|            default :
  ------------------
  |  Branch (193:13): [True: 111k, False: 226k]
  ------------------
  194|   111k|                assert(normalizedCounter[s] > 1);
  ------------------
  |  |   70|   111k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  195|   111k|                {   U32 const maxBitsOut = tableLog - ZSTD_highbit32 ((U32)normalizedCounter[s]-1);
  196|   111k|                    U32 const minStatePlus = (U32)normalizedCounter[s] << maxBitsOut;
  197|   111k|                    symbolTT[s].deltaNbBits = (maxBitsOut << 16) - minStatePlus;
  198|   111k|                    symbolTT[s].deltaFindState = (int)(total - (unsigned)normalizedCounter[s]);
  199|   111k|                    total +=  (unsigned)normalizedCounter[s];
  200|   111k|    }   }   }   }
  201|       |
  202|       |#if 0  /* debug : symbol costs */
  203|       |    DEBUGLOG(5, "\n --- table statistics : ");
  204|       |    {   U32 symbol;
  205|       |        for (symbol=0; symbol<=maxSymbolValue; symbol++) {
  206|       |            DEBUGLOG(5, "%3u: w=%3i,   maxBits=%u, fracBits=%.2f",
  207|       |                symbol, normalizedCounter[symbol],
  208|       |                FSE_getMaxNbBits(symbolTT, symbol),
  209|       |                (double)FSE_bitCost(symbolTT, tableLog, symbol, 8) / 256);
  210|       |    }   }
  211|       |#endif
  212|       |
  213|  14.7k|    return 0;
  214|  14.7k|}
FSE_NCountWriteBound:
  224|  13.7k|{
  225|  13.7k|    size_t const maxHeaderSize = (((maxSymbolValue+1) * tableLog
  226|  13.7k|                                   + 4 /* bitCount initialized at 4 */
  227|  13.7k|                                   + 2 /* first two symbols may use one additional bit each */) / 8)
  228|  13.7k|                                   + 1 /* round up to whole nb bytes */
  229|  13.7k|                                   + 2 /* additional two bytes for bitstream flush */;
  230|  13.7k|    return maxSymbolValue ? maxHeaderSize : FSE_NCOUNTBOUND;  /* maxSymbolValue==0 ? use default */
  ------------------
  |  |  235|      0|#define FSE_NCOUNTBOUND 512
  ------------------
  |  Branch (230:12): [True: 13.7k, False: 0]
  ------------------
  231|  13.7k|}
FSE_writeNCount:
  332|  13.7k|{
  333|  13.7k|    if (tableLog > FSE_MAX_TABLELOG) return ERROR(tableLog_tooLarge);   /* Unsupported */
  ------------------
  |  |  612|  13.7k|#define FSE_MAX_TABLELOG  (FSE_MAX_MEMORY_USAGE-2)
  |  |  ------------------
  |  |  |  |  582|  13.7k|#  define FSE_MAX_MEMORY_USAGE 14
  |  |  ------------------
  ------------------
                  if (tableLog > FSE_MAX_TABLELOG) return ERROR(tableLog_tooLarge);   /* Unsupported */
  ------------------
  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (333:9): [True: 0, False: 13.7k]
  ------------------
  334|  13.7k|    if (tableLog < FSE_MIN_TABLELOG) return ERROR(GENERIC);   /* Unsupported */
  ------------------
  |  |  616|  13.7k|#define FSE_MIN_TABLELOG 5
  ------------------
                  if (tableLog < FSE_MIN_TABLELOG) return ERROR(GENERIC);   /* Unsupported */
  ------------------
  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (334:9): [True: 0, False: 13.7k]
  ------------------
  335|       |
  336|  13.7k|    if (bufferSize < FSE_NCountWriteBound(maxSymbolValue, tableLog))
  ------------------
  |  Branch (336:9): [True: 27, False: 13.7k]
  ------------------
  337|     27|        return FSE_writeNCount_generic(buffer, bufferSize, normalizedCounter, maxSymbolValue, tableLog, 0);
  338|       |
  339|  13.7k|    return FSE_writeNCount_generic(buffer, bufferSize, normalizedCounter, maxSymbolValue, tableLog, 1 /* write in buffer is safe */);
  340|  13.7k|}
FSE_optimalTableLog_internal:
  358|  15.5k|{
  359|  15.5k|    U32 maxBitsSrc = ZSTD_highbit32((U32)(srcSize - 1)) - minus;
  360|  15.5k|    U32 tableLog = maxTableLog;
  361|  15.5k|    U32 minBits = FSE_minTableLog(srcSize, maxSymbolValue);
  362|  15.5k|    assert(srcSize > 1); /* Not supported, RLE should be used instead */
  ------------------
  |  |   70|  15.5k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  363|  15.5k|    if (tableLog==0) tableLog = FSE_DEFAULT_TABLELOG;
  ------------------
  |  |  615|      0|#define FSE_DEFAULT_TABLELOG (FSE_DEFAULT_MEMORY_USAGE-2)
  |  |  ------------------
  |  |  |  |  585|      0|#  define FSE_DEFAULT_MEMORY_USAGE 13
  |  |  ------------------
  ------------------
  |  Branch (363:9): [True: 0, False: 15.5k]
  ------------------
  364|  15.5k|    if (maxBitsSrc < tableLog) tableLog = maxBitsSrc;   /* Accuracy can be reduced */
  ------------------
  |  Branch (364:9): [True: 12.3k, False: 3.17k]
  ------------------
  365|  15.5k|    if (minBits > tableLog) tableLog = minBits;   /* Need a minimum to safely represent all symbol values */
  ------------------
  |  Branch (365:9): [True: 7.27k, False: 8.28k]
  ------------------
  366|  15.5k|    if (tableLog < FSE_MIN_TABLELOG) tableLog = FSE_MIN_TABLELOG;
  ------------------
  |  |  616|  15.5k|#define FSE_MIN_TABLELOG 5
  ------------------
                  if (tableLog < FSE_MIN_TABLELOG) tableLog = FSE_MIN_TABLELOG;
  ------------------
  |  |  616|  5.96k|#define FSE_MIN_TABLELOG 5
  ------------------
  |  Branch (366:9): [True: 5.96k, False: 9.58k]
  ------------------
  367|  15.5k|    if (tableLog > FSE_MAX_TABLELOG) tableLog = FSE_MAX_TABLELOG;
  ------------------
  |  |  612|  15.5k|#define FSE_MAX_TABLELOG  (FSE_MAX_MEMORY_USAGE-2)
  |  |  ------------------
  |  |  |  |  582|  15.5k|#  define FSE_MAX_MEMORY_USAGE 14
  |  |  ------------------
  ------------------
                  if (tableLog > FSE_MAX_TABLELOG) tableLog = FSE_MAX_TABLELOG;
  ------------------
  |  |  612|      0|#define FSE_MAX_TABLELOG  (FSE_MAX_MEMORY_USAGE-2)
  |  |  ------------------
  |  |  |  |  582|      0|#  define FSE_MAX_MEMORY_USAGE 14
  |  |  ------------------
  ------------------
  |  Branch (367:9): [True: 0, False: 15.5k]
  ------------------
  368|  15.5k|    return tableLog;
  369|  15.5k|}
FSE_optimalTableLog:
  372|  13.7k|{
  373|  13.7k|    return FSE_optimalTableLog_internal(maxTableLog, srcSize, maxSymbolValue, 2);
  374|  13.7k|}
FSE_normalizeCount:
  468|  13.7k|{
  469|       |    /* Sanity checks */
  470|  13.7k|    if (tableLog==0) tableLog = FSE_DEFAULT_TABLELOG;
  ------------------
  |  |  615|      0|#define FSE_DEFAULT_TABLELOG (FSE_DEFAULT_MEMORY_USAGE-2)
  |  |  ------------------
  |  |  |  |  585|      0|#  define FSE_DEFAULT_MEMORY_USAGE 13
  |  |  ------------------
  ------------------
  |  Branch (470:9): [True: 0, False: 13.7k]
  ------------------
  471|  13.7k|    if (tableLog < FSE_MIN_TABLELOG) return ERROR(GENERIC);   /* Unsupported size */
  ------------------
  |  |  616|  13.7k|#define FSE_MIN_TABLELOG 5
  ------------------
                  if (tableLog < FSE_MIN_TABLELOG) return ERROR(GENERIC);   /* Unsupported size */
  ------------------
  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (471:9): [True: 0, False: 13.7k]
  ------------------
  472|  13.7k|    if (tableLog > FSE_MAX_TABLELOG) return ERROR(tableLog_tooLarge);   /* Unsupported size */
  ------------------
  |  |  612|  13.7k|#define FSE_MAX_TABLELOG  (FSE_MAX_MEMORY_USAGE-2)
  |  |  ------------------
  |  |  |  |  582|  13.7k|#  define FSE_MAX_MEMORY_USAGE 14
  |  |  ------------------
  ------------------
                  if (tableLog > FSE_MAX_TABLELOG) return ERROR(tableLog_tooLarge);   /* Unsupported size */
  ------------------
  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (472:9): [True: 0, False: 13.7k]
  ------------------
  473|  13.7k|    if (tableLog < FSE_minTableLog(total, maxSymbolValue)) return ERROR(GENERIC);   /* Too small tableLog, compression potentially impossible */
  ------------------
  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (473:9): [True: 0, False: 13.7k]
  ------------------
  474|       |
  475|  13.7k|    {   static U32 const rtbTable[] = {     0, 473195, 504333, 520860, 550000, 700000, 750000, 830000 };
  476|  13.7k|        short const lowProbCount = useLowProbCount ? -1 : 1;
  ------------------
  |  Branch (476:36): [True: 0, False: 13.7k]
  ------------------
  477|  13.7k|        U64 const scale = 62 - tableLog;
  478|  13.7k|        U64 const step = ZSTD_div64((U64)1<<62, (U32)total);   /* <== here, one division ! */
  ------------------
  |  |   82|  13.7k|#define ZSTD_div64(dividend, divisor) ((dividend) / (divisor))
  ------------------
  479|  13.7k|        U64 const vStep = 1ULL<<(scale-20);
  480|  13.7k|        int stillToDistribute = 1<<tableLog;
  481|  13.7k|        unsigned s;
  482|  13.7k|        unsigned largest=0;
  483|  13.7k|        short largestP=0;
  484|  13.7k|        U32 lowThreshold = (U32)(total >> tableLog);
  485|       |
  486|   145k|        for (s=0; s<=maxSymbolValue; s++) {
  ------------------
  |  Branch (486:19): [True: 131k, False: 13.7k]
  ------------------
  487|   131k|            if (count[s] == total) return 0;   /* rle special case */
  ------------------
  |  Branch (487:17): [True: 0, False: 131k]
  ------------------
  488|   131k|            if (count[s] == 0) { normalizedCounter[s]=0; continue; }
  ------------------
  |  Branch (488:17): [True: 74.6k, False: 57.2k]
  ------------------
  489|  57.2k|            if (count[s] <= lowThreshold) {
  ------------------
  |  Branch (489:17): [True: 12.0k, False: 45.1k]
  ------------------
  490|  12.0k|                normalizedCounter[s] = lowProbCount;
  491|  12.0k|                stillToDistribute--;
  492|  45.1k|            } else {
  493|  45.1k|                short proba = (short)((count[s]*step) >> scale);
  494|  45.1k|                if (proba<8) {
  ------------------
  |  Branch (494:21): [True: 24.6k, False: 20.5k]
  ------------------
  495|  24.6k|                    U64 restToBeat = vStep * rtbTable[proba];
  496|  24.6k|                    proba += (count[s]*step) - ((U64)proba<<scale) > restToBeat;
  497|  24.6k|                }
  498|  45.1k|                if (proba > largestP) { largestP=proba; largest=s; }
  ------------------
  |  Branch (498:21): [True: 17.0k, False: 28.0k]
  ------------------
  499|  45.1k|                normalizedCounter[s] = proba;
  500|  45.1k|                stillToDistribute -= proba;
  501|  45.1k|        }   }
  502|  13.7k|        if (-stillToDistribute >= (normalizedCounter[largest] >> 1)) {
  ------------------
  |  Branch (502:13): [True: 76, False: 13.7k]
  ------------------
  503|       |            /* corner case, need another normalization method */
  504|     76|            size_t const errorCode = FSE_normalizeM2(normalizedCounter, tableLog, count, total, maxSymbolValue, lowProbCount);
  505|     76|            if (FSE_isError(errorCode)) return errorCode;
  ------------------
  |  |   35|     76|#define FSE_isError ERR_isError
  ------------------
  |  Branch (505:17): [True: 0, False: 76]
  ------------------
  506|     76|        }
  507|  13.7k|        else normalizedCounter[largest] += (short)stillToDistribute;
  508|  13.7k|    }
  509|       |
  510|       |#if 0
  511|       |    {   /* Print Table (debug) */
  512|       |        U32 s;
  513|       |        U32 nTotal = 0;
  514|       |        for (s=0; s<=maxSymbolValue; s++)
  515|       |            RAWLOG(2, "%3i: %4i \n", s, normalizedCounter[s]);
  516|       |        for (s=0; s<=maxSymbolValue; s++)
  517|       |            nTotal += abs(normalizedCounter[s]);
  518|       |        if (nTotal != (1U<<tableLog))
  519|       |            RAWLOG(2, "Warning !!! Total == %u != %u !!!", nTotal, 1U<<tableLog);
  520|       |        getchar();
  521|       |    }
  522|       |#endif
  523|       |
  524|  13.7k|    return tableLog;
  525|  13.7k|}
FSE_buildCTable_rle:
  529|    257|{
  530|    257|    void* ptr = ct;
  531|    257|    U16* tableU16 = ( (U16*) ptr) + 2;
  532|    257|    void* FSCTptr = (U32*)ptr + 2;
  533|    257|    FSE_symbolCompressionTransform* symbolTT = (FSE_symbolCompressionTransform*) FSCTptr;
  534|       |
  535|       |    /* header */
  536|    257|    tableU16[-2] = (U16) 0;
  537|    257|    tableU16[-1] = (U16) symbolValue;
  538|       |
  539|       |    /* Build table */
  540|    257|    tableU16[0] = 0;
  541|    257|    tableU16[1] = 0;   /* just in case */
  542|       |
  543|       |    /* Build Symbol Transformation Table */
  544|    257|    symbolTT[symbolValue].deltaNbBits = 0;
  545|    257|    symbolTT[symbolValue].deltaFindState = 0;
  546|       |
  547|    257|    return 0;
  548|    257|}
FSE_compress_usingCTable:
  613|  6.52k|{
  614|  6.52k|    unsigned const fast = (dstSize >= FSE_BLOCKBOUND(srcSize));
  ------------------
  |  |  236|  6.52k|#define FSE_BLOCKBOUND(size) ((size) + ((size)>>7) + 4 /* fse states */ + sizeof(size_t) /* bitContainer */)
  ------------------
  615|       |
  616|  6.52k|    if (fast)
  ------------------
  |  Branch (616:9): [True: 3.85k, False: 2.67k]
  ------------------
  617|  3.85k|        return FSE_compress_usingCTable_generic(dst, dstSize, src, srcSize, ct, 1);
  618|  2.67k|    else
  619|  2.67k|        return FSE_compress_usingCTable_generic(dst, dstSize, src, srcSize, ct, 0);
  620|  6.52k|}
fse_compress.c:FSE_writeNCount_generic:
  237|  13.7k|{
  238|  13.7k|    BYTE* const ostart = (BYTE*) header;
  239|  13.7k|    BYTE* out = ostart;
  240|  13.7k|    BYTE* const oend = ostart + headerBufferSize;
  241|  13.7k|    int nbBits;
  242|  13.7k|    const int tableSize = 1 << tableLog;
  243|  13.7k|    int remaining;
  244|  13.7k|    int threshold;
  245|  13.7k|    U32 bitStream = 0;
  246|  13.7k|    int bitCount = 0;
  247|  13.7k|    unsigned symbol = 0;
  248|  13.7k|    unsigned const alphabetSize = maxSymbolValue + 1;
  249|  13.7k|    int previousIs0 = 0;
  250|       |
  251|       |    /* Table Size */
  252|  13.7k|    bitStream += (tableLog-FSE_MIN_TABLELOG) << bitCount;
  ------------------
  |  |  616|  13.7k|#define FSE_MIN_TABLELOG 5
  ------------------
  253|  13.7k|    bitCount  += 4;
  254|       |
  255|       |    /* Init */
  256|  13.7k|    remaining = tableSize+1;   /* +1 for extra accuracy */
  257|  13.7k|    threshold = tableSize;
  258|  13.7k|    nbBits = (int)tableLog+1;
  259|       |
  260|  87.2k|    while ((symbol < alphabetSize) && (remaining>1)) {  /* stops at 1 */
  ------------------
  |  Branch (260:12): [True: 73.4k, False: 13.7k]
  |  Branch (260:39): [True: 73.4k, False: 0]
  ------------------
  261|  73.4k|        if (previousIs0) {
  ------------------
  |  Branch (261:13): [True: 16.2k, False: 57.2k]
  ------------------
  262|  16.2k|            unsigned start = symbol;
  263|  74.6k|            while ((symbol < alphabetSize) && !normalizedCounter[symbol]) symbol++;
  ------------------
  |  Branch (263:20): [True: 74.6k, False: 0]
  |  Branch (263:47): [True: 58.3k, False: 16.2k]
  ------------------
  264|  16.2k|            if (symbol == alphabetSize) break;   /* incorrect distribution */
  ------------------
  |  Branch (264:17): [True: 0, False: 16.2k]
  ------------------
  265|  16.6k|            while (symbol >= start+24) {
  ------------------
  |  Branch (265:20): [True: 365, False: 16.2k]
  ------------------
  266|    365|                start+=24;
  267|    365|                bitStream += 0xFFFFU << bitCount;
  268|    365|                if ((!writeIsSafe) && (out > oend-2))
  ------------------
  |  Branch (268:21): [True: 18, False: 347]
  |  Branch (268:39): [True: 9, False: 9]
  ------------------
  269|      9|                    return ERROR(dstSize_tooSmall);   /* Buffer overflow */
  ------------------
  |  |   49|      9|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      9|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      9|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  270|    356|                out[0] = (BYTE) bitStream;
  271|    356|                out[1] = (BYTE)(bitStream>>8);
  272|    356|                out+=2;
  273|    356|                bitStream>>=16;
  274|    356|            }
  275|  28.8k|            while (symbol >= start+3) {
  ------------------
  |  Branch (275:20): [True: 12.6k, False: 16.2k]
  ------------------
  276|  12.6k|                start+=3;
  277|  12.6k|                bitStream += 3U << bitCount;
  278|  12.6k|                bitCount += 2;
  279|  12.6k|            }
  280|  16.2k|            bitStream += (symbol-start) << bitCount;
  281|  16.2k|            bitCount += 2;
  282|  16.2k|            if (bitCount>16) {
  ------------------
  |  Branch (282:17): [True: 3.64k, False: 12.6k]
  ------------------
  283|  3.64k|                if ((!writeIsSafe) && (out > oend - 2))
  ------------------
  |  Branch (283:21): [True: 0, False: 3.64k]
  |  Branch (283:39): [True: 0, False: 0]
  ------------------
  284|      0|                    return ERROR(dstSize_tooSmall);   /* Buffer overflow */
  ------------------
  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  285|  3.64k|                out[0] = (BYTE)bitStream;
  286|  3.64k|                out[1] = (BYTE)(bitStream>>8);
  287|  3.64k|                out += 2;
  288|  3.64k|                bitStream >>= 16;
  289|  3.64k|                bitCount -= 16;
  290|  3.64k|        }   }
  291|  73.4k|        {   int count = normalizedCounter[symbol++];
  292|  73.4k|            int const max = (2*threshold-1) - remaining;
  293|  73.4k|            remaining -= count < 0 ? -count : count;
  ------------------
  |  Branch (293:26): [True: 0, False: 73.4k]
  ------------------
  294|  73.4k|            count++;   /* +1 for extra accuracy */
  295|  73.4k|            if (count>=threshold)
  ------------------
  |  Branch (295:17): [True: 21.4k, False: 51.9k]
  ------------------
  296|  21.4k|                count += max;   /* [0..max[ [max..threshold[ (...) [threshold+max 2*threshold[ */
  297|  73.4k|            bitStream += (U32)count << bitCount;
  298|  73.4k|            bitCount  += nbBits;
  299|  73.4k|            bitCount  -= (count<max);
  300|  73.4k|            previousIs0  = (count==1);
  301|  73.4k|            if (remaining<1) return ERROR(GENERIC);
  ------------------
  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (301:17): [True: 0, False: 73.4k]
  ------------------
  302|   154k|            while (remaining<threshold) { nbBits--; threshold>>=1; }
  ------------------
  |  Branch (302:20): [True: 80.6k, False: 73.4k]
  ------------------
  303|  73.4k|        }
  304|  73.4k|        if (bitCount>16) {
  ------------------
  |  Branch (304:13): [True: 16.9k, False: 56.5k]
  ------------------
  305|  16.9k|            if ((!writeIsSafe) && (out > oend - 2))
  ------------------
  |  Branch (305:17): [True: 27, False: 16.8k]
  |  Branch (305:35): [True: 0, False: 27]
  ------------------
  306|      0|                return ERROR(dstSize_tooSmall);   /* Buffer overflow */
  ------------------
  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  307|  16.9k|            out[0] = (BYTE)bitStream;
  308|  16.9k|            out[1] = (BYTE)(bitStream>>8);
  309|  16.9k|            out += 2;
  310|  16.9k|            bitStream >>= 16;
  311|  16.9k|            bitCount -= 16;
  312|  16.9k|    }   }
  313|       |
  314|  13.7k|    if (remaining != 1)
  ------------------
  |  Branch (314:9): [True: 0, False: 13.7k]
  ------------------
  315|      0|        return ERROR(GENERIC);  /* incorrect normalized distribution */
  ------------------
  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  316|  13.7k|    assert(symbol <= alphabetSize);
  ------------------
  |  |   70|  13.7k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  317|       |
  318|       |    /* flush remaining bitStream */
  319|  13.7k|    if ((!writeIsSafe) && (out > oend - 2))
  ------------------
  |  Branch (319:9): [True: 18, False: 13.7k]
  |  Branch (319:27): [True: 0, False: 18]
  ------------------
  320|      0|        return ERROR(dstSize_tooSmall);   /* Buffer overflow */
  ------------------
  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  321|  13.7k|    out[0] = (BYTE)bitStream;
  322|  13.7k|    out[1] = (BYTE)(bitStream>>8);
  323|  13.7k|    out+= (bitCount+7) /8;
  324|       |
  325|  13.7k|    assert(out >= ostart);
  ------------------
  |  |   70|  13.7k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  326|  13.7k|    return (size_t)(out-ostart);
  327|  13.7k|}
fse_compress.c:FSE_minTableLog:
  349|  29.3k|{
  350|  29.3k|    U32 minBitsSrc = ZSTD_highbit32((U32)(srcSize)) + 1;
  351|  29.3k|    U32 minBitsSymbols = ZSTD_highbit32(maxSymbolValue) + 2;
  352|  29.3k|    U32 minBits = minBitsSrc < minBitsSymbols ? minBitsSrc : minBitsSymbols;
  ------------------
  |  Branch (352:19): [True: 13.3k, False: 16.0k]
  ------------------
  353|  29.3k|    assert(srcSize > 1); /* Not supported, RLE should be used instead */
  ------------------
  |  |   70|  29.3k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  354|  29.3k|    return minBits;
  355|  29.3k|}
fse_compress.c:FSE_normalizeM2:
  380|     76|{
  381|     76|    short const NOT_YET_ASSIGNED = -2;
  382|     76|    U32 s;
  383|     76|    U32 distributed = 0;
  384|     76|    U32 ToDistribute;
  385|       |
  386|       |    /* Init */
  387|     76|    U32 const lowThreshold = (U32)(total >> tableLog);
  388|     76|    U32 lowOne = (U32)((total * 3) >> (tableLog + 1));
  389|       |
  390|  1.90k|    for (s=0; s<=maxSymbolValue; s++) {
  ------------------
  |  Branch (390:15): [True: 1.82k, False: 76]
  ------------------
  391|  1.82k|        if (count[s] == 0) {
  ------------------
  |  Branch (391:13): [True: 1.28k, False: 538]
  ------------------
  392|  1.28k|            norm[s]=0;
  393|  1.28k|            continue;
  394|  1.28k|        }
  395|    538|        if (count[s] <= lowThreshold) {
  ------------------
  |  Branch (395:13): [True: 0, False: 538]
  ------------------
  396|      0|            norm[s] = lowProbCount;
  397|      0|            distributed++;
  398|      0|            total -= count[s];
  399|      0|            continue;
  400|      0|        }
  401|    538|        if (count[s] <= lowOne) {
  ------------------
  |  Branch (401:13): [True: 0, False: 538]
  ------------------
  402|      0|            norm[s] = 1;
  403|      0|            distributed++;
  404|      0|            total -= count[s];
  405|      0|            continue;
  406|      0|        }
  407|       |
  408|    538|        norm[s]=NOT_YET_ASSIGNED;
  409|    538|    }
  410|     76|    ToDistribute = (1 << tableLog) - distributed;
  411|       |
  412|     76|    if (ToDistribute == 0)
  ------------------
  |  Branch (412:9): [True: 0, False: 76]
  ------------------
  413|      0|        return 0;
  414|       |
  415|     76|    if ((total / ToDistribute) > lowOne) {
  ------------------
  |  Branch (415:9): [True: 0, False: 76]
  ------------------
  416|       |        /* risk of rounding to zero */
  417|      0|        lowOne = (U32)((total * 3) / (ToDistribute * 2));
  418|      0|        for (s=0; s<=maxSymbolValue; s++) {
  ------------------
  |  Branch (418:19): [True: 0, False: 0]
  ------------------
  419|      0|            if ((norm[s] == NOT_YET_ASSIGNED) && (count[s] <= lowOne)) {
  ------------------
  |  Branch (419:17): [True: 0, False: 0]
  |  Branch (419:50): [True: 0, False: 0]
  ------------------
  420|      0|                norm[s] = 1;
  421|      0|                distributed++;
  422|      0|                total -= count[s];
  423|      0|                continue;
  424|      0|        }   }
  425|      0|        ToDistribute = (1 << tableLog) - distributed;
  426|      0|    }
  427|       |
  428|     76|    if (distributed == maxSymbolValue+1) {
  ------------------
  |  Branch (428:9): [True: 0, False: 76]
  ------------------
  429|       |        /* all values are pretty poor;
  430|       |           probably incompressible data (should have already been detected);
  431|       |           find max, then give all remaining points to max */
  432|      0|        U32 maxV = 0, maxC = 0;
  433|      0|        for (s=0; s<=maxSymbolValue; s++)
  ------------------
  |  Branch (433:19): [True: 0, False: 0]
  ------------------
  434|      0|            if (count[s] > maxC) { maxV=s; maxC=count[s]; }
  ------------------
  |  Branch (434:17): [True: 0, False: 0]
  ------------------
  435|      0|        norm[maxV] += (short)ToDistribute;
  436|      0|        return 0;
  437|      0|    }
  438|       |
  439|     76|    if (total == 0) {
  ------------------
  |  Branch (439:9): [True: 0, False: 76]
  ------------------
  440|       |        /* all of the symbols were low enough for the lowOne or lowThreshold */
  441|      0|        for (s=0; ToDistribute > 0; s = (s+1)%(maxSymbolValue+1))
  ------------------
  |  Branch (441:19): [True: 0, False: 0]
  ------------------
  442|      0|            if (norm[s] > 0) { ToDistribute--; norm[s]++; }
  ------------------
  |  Branch (442:17): [True: 0, False: 0]
  ------------------
  443|      0|        return 0;
  444|      0|    }
  445|       |
  446|     76|    {   U64 const vStepLog = 62 - tableLog;
  447|     76|        U64 const mid = (1ULL << (vStepLog-1)) - 1;
  448|     76|        U64 const rStep = ZSTD_div64((((U64)1<<vStepLog) * ToDistribute) + mid, (U32)total);   /* scale on remaining */
  ------------------
  |  |   82|     76|#define ZSTD_div64(dividend, divisor) ((dividend) / (divisor))
  ------------------
  449|     76|        U64 tmpTotal = mid;
  450|  1.90k|        for (s=0; s<=maxSymbolValue; s++) {
  ------------------
  |  Branch (450:19): [True: 1.82k, False: 76]
  ------------------
  451|  1.82k|            if (norm[s]==NOT_YET_ASSIGNED) {
  ------------------
  |  Branch (451:17): [True: 538, False: 1.28k]
  ------------------
  452|    538|                U64 const end = tmpTotal + (count[s] * rStep);
  453|    538|                U32 const sStart = (U32)(tmpTotal >> vStepLog);
  454|    538|                U32 const sEnd = (U32)(end >> vStepLog);
  455|    538|                U32 const weight = sEnd - sStart;
  456|    538|                if (weight < 1)
  ------------------
  |  Branch (456:21): [True: 0, False: 538]
  ------------------
  457|      0|                    return ERROR(GENERIC);
  ------------------
  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  458|    538|                norm[s] = (short)weight;
  459|    538|                tmpTotal = end;
  460|    538|    }   }   }
  461|       |
  462|     76|    return 0;
  463|     76|}
fse_compress.c:FSE_compress_usingCTable_generic:
  554|  6.52k|{
  555|  6.52k|    const BYTE* const istart = (const BYTE*) src;
  556|  6.52k|    const BYTE* const iend = istart + srcSize;
  557|  6.52k|    const BYTE* ip=iend;
  558|       |
  559|  6.52k|    BIT_CStream_t bitC;
  560|  6.52k|    FSE_CState_t CState1, CState2;
  561|       |
  562|       |    /* init */
  563|  6.52k|    if (srcSize <= 2) return 0;
  ------------------
  |  Branch (563:9): [True: 0, False: 6.52k]
  ------------------
  564|  6.52k|    { size_t const initError = BIT_initCStream(&bitC, dst, dstSize);
  565|  6.52k|      if (FSE_isError(initError)) return 0; /* not enough space available to write a bitstream */ }
  ------------------
  |  |   35|  6.52k|#define FSE_isError ERR_isError
  ------------------
  |  Branch (565:11): [True: 2, False: 6.52k]
  ------------------
  566|       |
  567|  6.52k|#define FSE_FLUSHBITS(s)  (fast ? BIT_flushBitsFast(s) : BIT_flushBits(s))
  568|       |
  569|  6.52k|    if (srcSize & 1) {
  ------------------
  |  Branch (569:9): [True: 3.51k, False: 3.01k]
  ------------------
  570|  3.51k|        FSE_initCState2(&CState1, ct, *--ip);
  571|  3.51k|        FSE_initCState2(&CState2, ct, *--ip);
  572|  3.51k|        FSE_encodeSymbol(&bitC, &CState1, *--ip);
  573|  3.51k|        FSE_FLUSHBITS(&bitC);
  ------------------
  |  |  567|  3.51k|#define FSE_FLUSHBITS(s)  (fast ? BIT_flushBitsFast(s) : BIT_flushBits(s))
  |  |  ------------------
  |  |  |  Branch (567:28): [True: 1.67k, False: 1.83k]
  |  |  ------------------
  ------------------
  574|  3.51k|    } else {
  575|  3.01k|        FSE_initCState2(&CState2, ct, *--ip);
  576|  3.01k|        FSE_initCState2(&CState1, ct, *--ip);
  577|  3.01k|    }
  578|       |
  579|       |    /* join to mod 4 */
  580|  6.52k|    srcSize -= 2;
  581|  6.52k|    if ((sizeof(bitC.bitContainer)*8 > FSE_MAX_TABLELOG*4+7 ) && (srcSize & 2)) {  /* test bit 2 */
  ------------------
  |  |  612|  6.52k|#define FSE_MAX_TABLELOG  (FSE_MAX_MEMORY_USAGE-2)
  |  |  ------------------
  |  |  |  |  582|  6.52k|#  define FSE_MAX_MEMORY_USAGE 14
  |  |  ------------------
  ------------------
  |  Branch (581:9): [True: 6.52k, Folded]
  |  Branch (581:66): [True: 2.72k, False: 3.79k]
  ------------------
  582|  2.72k|        FSE_encodeSymbol(&bitC, &CState2, *--ip);
  583|  2.72k|        FSE_encodeSymbol(&bitC, &CState1, *--ip);
  584|  2.72k|        FSE_FLUSHBITS(&bitC);
  ------------------
  |  |  567|  2.72k|#define FSE_FLUSHBITS(s)  (fast ? BIT_flushBitsFast(s) : BIT_flushBits(s))
  |  |  ------------------
  |  |  |  Branch (567:28): [True: 2.08k, False: 639]
  |  |  ------------------
  ------------------
  585|  2.72k|    }
  586|       |
  587|       |    /* 2 or 4 encoding per loop */
  588|   280k|    while ( ip>istart ) {
  ------------------
  |  Branch (588:13): [True: 274k, False: 6.52k]
  ------------------
  589|       |
  590|   274k|        FSE_encodeSymbol(&bitC, &CState2, *--ip);
  591|       |
  592|   274k|        if (sizeof(bitC.bitContainer)*8 < FSE_MAX_TABLELOG*2+7 )   /* this test must be static */
  ------------------
  |  |  612|   274k|#define FSE_MAX_TABLELOG  (FSE_MAX_MEMORY_USAGE-2)
  |  |  ------------------
  |  |  |  |  582|   274k|#  define FSE_MAX_MEMORY_USAGE 14
  |  |  ------------------
  ------------------
  |  Branch (592:13): [Folded, False: 274k]
  ------------------
  593|      0|            FSE_FLUSHBITS(&bitC);
  ------------------
  |  |  567|      0|#define FSE_FLUSHBITS(s)  (fast ? BIT_flushBitsFast(s) : BIT_flushBits(s))
  |  |  ------------------
  |  |  |  Branch (567:28): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  594|       |
  595|   274k|        FSE_encodeSymbol(&bitC, &CState1, *--ip);
  596|       |
  597|   274k|        if (sizeof(bitC.bitContainer)*8 > FSE_MAX_TABLELOG*4+7 ) {  /* this test must be static */
  ------------------
  |  |  612|   274k|#define FSE_MAX_TABLELOG  (FSE_MAX_MEMORY_USAGE-2)
  |  |  ------------------
  |  |  |  |  582|   274k|#  define FSE_MAX_MEMORY_USAGE 14
  |  |  ------------------
  ------------------
  |  Branch (597:13): [True: 274k, Folded]
  ------------------
  598|   274k|            FSE_encodeSymbol(&bitC, &CState2, *--ip);
  599|   274k|            FSE_encodeSymbol(&bitC, &CState1, *--ip);
  600|   274k|        }
  601|       |
  602|   274k|        FSE_FLUSHBITS(&bitC);
  ------------------
  |  |  567|   274k|#define FSE_FLUSHBITS(s)  (fast ? BIT_flushBitsFast(s) : BIT_flushBits(s))
  |  |  ------------------
  |  |  |  Branch (567:28): [True: 122k, False: 151k]
  |  |  ------------------
  ------------------
  603|   274k|    }
  604|       |
  605|  6.52k|    FSE_flushCState(&bitC, &CState2);
  606|  6.52k|    FSE_flushCState(&bitC, &CState1);
  607|  6.52k|    return BIT_closeCStream(&bitC);
  608|  6.52k|}

HIST_count_simple:
   47|  19.9k|{
   48|  19.9k|    const BYTE* ip = (const BYTE*)src;
   49|  19.9k|    const BYTE* const end = ip + srcSize;
   50|  19.9k|    unsigned maxSymbolValue = *maxSymbolValuePtr;
   51|  19.9k|    unsigned largestCount=0;
   52|       |
   53|  19.9k|    ZSTD_memset(count, 0, (maxSymbolValue+1) * sizeof(*count));
  ------------------
  |  |   46|  19.9k|# define ZSTD_memset(p,v,l) __builtin_memset((p),(v),(l))
  ------------------
   54|  19.9k|    if (srcSize==0) { *maxSymbolValuePtr = 0; return 0; }
  ------------------
  |  Branch (54:9): [True: 0, False: 19.9k]
  ------------------
   55|       |
   56|  1.75M|    while (ip<end) {
  ------------------
  |  Branch (56:12): [True: 1.73M, False: 19.9k]
  ------------------
   57|  1.73M|        assert(*ip <= maxSymbolValue);
  ------------------
  |  |   70|  1.73M|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
   58|  1.73M|        count[*ip++]++;
   59|  1.73M|    }
   60|       |
   61|   597k|    while (!count[maxSymbolValue]) maxSymbolValue--;
  ------------------
  |  Branch (61:12): [True: 577k, False: 19.9k]
  ------------------
   62|  19.9k|    *maxSymbolValuePtr = maxSymbolValue;
   63|       |
   64|  19.9k|    {   U32 s;
   65|  1.13M|        for (s=0; s<=maxSymbolValue; s++)
  ------------------
  |  Branch (65:19): [True: 1.11M, False: 19.9k]
  ------------------
   66|  1.11M|            if (count[s] > largestCount) largestCount = count[s];
  ------------------
  |  Branch (66:17): [True: 29.2k, False: 1.08M]
  ------------------
   67|  19.9k|    }
   68|       |
   69|  19.9k|    return largestCount;
   70|  19.9k|}
HIST_countFast_wksp:
  439|  11.5k|{
  440|  11.5k|    if (sourceSize < HIST_FAST_THRESHOLD) /* heuristic threshold */
  ------------------
  |  |   25|  11.5k|#define HIST_FAST_THRESHOLD 1500
  ------------------
  |  Branch (440:9): [True: 11.5k, False: 0]
  ------------------
  441|  11.5k|        return HIST_count_simple(count, maxSymbolValuePtr, source, sourceSize);
  442|       |#if defined(ZSTD_ARCH_ARM_SVE2)
  443|       |    (void)workSpace;
  444|       |    (void)workSpaceSize;
  445|       |    return HIST_count_sve2(count, maxSymbolValuePtr, source, sourceSize, trustInput);
  446|       |#else
  447|      0|    if ((size_t)workSpace & 3) return ERROR(GENERIC);  /* must be aligned on 4-bytes boundaries */
  ------------------
  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (447:9): [True: 0, False: 0]
  ------------------
  448|      0|    if (workSpaceSize < HIST_WKSP_SIZE) return ERROR(workSpace_tooSmall);
  ------------------
  |  |   43|      0|#define HIST_WKSP_SIZE    (HIST_WKSP_SIZE_U32 * sizeof(unsigned))
  |  |  ------------------
  |  |  |  |   41|      0|#define HIST_WKSP_SIZE_U32 1024
  |  |  ------------------
  ------------------
                  if (workSpaceSize < HIST_WKSP_SIZE) return ERROR(workSpace_tooSmall);
  ------------------
  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (448:9): [True: 0, False: 0]
  ------------------
  449|      0|    return HIST_count_parallel_wksp(count, maxSymbolValuePtr, source, sourceSize, trustInput, (U32*)workSpace);
  450|      0|#endif
  451|      0|}
HIST_count_wksp:
  459|  3.13k|{
  460|       |#if defined(ZSTD_ARCH_ARM_SVE2)
  461|       |    if (*maxSymbolValuePtr < 255)
  462|       |        return HIST_count_sve2(count, maxSymbolValuePtr, source, sourceSize, checkMaxSymbolValue);
  463|       |#else
  464|  3.13k|    if ((size_t)workSpace & 3) return ERROR(GENERIC);  /* must be aligned on 4-bytes boundaries */
  ------------------
  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (464:9): [True: 0, False: 3.13k]
  ------------------
  465|  3.13k|    if (workSpaceSize < HIST_WKSP_SIZE) return ERROR(workSpace_tooSmall);
  ------------------
  |  |   43|  3.13k|#define HIST_WKSP_SIZE    (HIST_WKSP_SIZE_U32 * sizeof(unsigned))
  |  |  ------------------
  |  |  |  |   41|  3.13k|#define HIST_WKSP_SIZE_U32 1024
  |  |  ------------------
  ------------------
                  if (workSpaceSize < HIST_WKSP_SIZE) return ERROR(workSpace_tooSmall);
  ------------------
  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (465:9): [True: 0, False: 3.13k]
  ------------------
  466|  3.13k|    if (*maxSymbolValuePtr < 255)
  ------------------
  |  Branch (466:9): [True: 0, False: 3.13k]
  ------------------
  467|      0|        return HIST_count_parallel_wksp(count, maxSymbolValuePtr, source, sourceSize, checkMaxSymbolValue, (U32*)workSpace);
  468|  3.13k|#endif
  469|  3.13k|    *maxSymbolValuePtr = 255;
  470|  3.13k|    return HIST_countFast_wksp(count, maxSymbolValuePtr, source, sourceSize, workSpace, workSpaceSize);
  471|  3.13k|}

HUF_readCTableHeader:
  225|  3.03k|{
  226|  3.03k|    HUF_CTableHeader header;
  227|  3.03k|    ZSTD_memcpy(&header, ctable, sizeof(header));
  ------------------
  |  |   44|  3.03k|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  ------------------
  228|  3.03k|    return header;
  229|  3.03k|}
HUF_writeCTable_wksp:
  252|  6.55k|{
  253|  6.55k|    HUF_CElt const* const ct = CTable + 1;
  254|  6.55k|    BYTE* op = (BYTE*)dst;
  255|  6.55k|    U32 n;
  256|  6.55k|    HUF_WriteCTableWksp* wksp = (HUF_WriteCTableWksp*)HUF_alignUpWorkspace(workspace, &workspaceSize, ZSTD_ALIGNOF(U32));
  ------------------
  |  |  315|  6.55k|#  define ZSTD_ALIGNOF(T) __alignof(T)
  ------------------
  257|       |
  258|  6.55k|    HUF_STATIC_ASSERT(HUF_CTABLE_WORKSPACE_SIZE >= sizeof(HUF_WriteCTableWksp));
  ------------------
  |  |   42|  6.55k|#define HUF_STATIC_ASSERT(c) DEBUG_STATIC_ASSERT(c)   /* use only *after* variable declarations */
  |  |  ------------------
  |  |  |  |   39|  6.55k|#define DEBUG_STATIC_ASSERT(c) (void)sizeof(char[(c) ? 1 : -1])
  |  |  ------------------
  ------------------
  259|       |
  260|  6.55k|    assert(HUF_readCTableHeader(CTable).maxSymbolValue == maxSymbolValue);
  ------------------
  |  |   70|  6.55k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  261|  6.55k|    assert(HUF_readCTableHeader(CTable).tableLog == huffLog);
  ------------------
  |  |   70|  6.55k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  262|       |
  263|       |    /* check conditions */
  264|  6.55k|    if (workspaceSize < sizeof(HUF_WriteCTableWksp)) return ERROR(GENERIC);
  ------------------
  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (264:9): [True: 0, False: 6.55k]
  ------------------
  265|  6.55k|    if (maxSymbolValue > HUF_SYMBOLVALUE_MAX) return ERROR(maxSymbolValue_tooLarge);
  ------------------
  |  |   39|  6.55k|#define HUF_SYMBOLVALUE_MAX  255
  ------------------
                  if (maxSymbolValue > HUF_SYMBOLVALUE_MAX) return ERROR(maxSymbolValue_tooLarge);
  ------------------
  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (265:9): [True: 0, False: 6.55k]
  ------------------
  266|       |
  267|       |    /* convert to weight */
  268|  6.55k|    wksp->bitsToWeight[0] = 0;
  269|  46.1k|    for (n=1; n<huffLog+1; n++)
  ------------------
  |  Branch (269:15): [True: 39.6k, False: 6.55k]
  ------------------
  270|  39.6k|        wksp->bitsToWeight[n] = (BYTE)(huffLog + 1 - n);
  271|  1.12M|    for (n=0; n<maxSymbolValue; n++)
  ------------------
  |  Branch (271:15): [True: 1.12M, False: 6.55k]
  ------------------
  272|  1.12M|        wksp->huffWeight[n] = wksp->bitsToWeight[HUF_getNbBits(ct[n])];
  273|       |
  274|       |    /* attempt weights compression by FSE */
  275|  6.55k|    if (maxDstSize < 1) return ERROR(dstSize_tooSmall);
  ------------------
  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (275:9): [True: 0, False: 6.55k]
  ------------------
  276|  6.55k|    {   CHECK_V_F(hSize, HUF_compressWeights(op+1, maxDstSize-1, wksp->huffWeight, maxSymbolValue, &wksp->wksp, sizeof(wksp->wksp)) );
  ------------------
  |  |   58|  6.55k|    size_t const e = f;     \
  |  |   59|  6.55k|    do {                    \
  |  |   60|  6.55k|        if (ERR_isError(e)) \
  |  |  ------------------
  |  |  |  Branch (60:13): [True: 0, False: 6.55k]
  |  |  ------------------
  |  |   61|  6.55k|            return e;       \
  |  |   62|  6.55k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (62:14): [Folded, False: 6.55k]
  |  |  ------------------
  ------------------
  277|  6.55k|        if ((hSize>1) & (hSize < maxSymbolValue/2)) {   /* FSE compressed */
  ------------------
  |  Branch (277:13): [True: 5.30k, False: 1.25k]
  ------------------
  278|  5.30k|            op[0] = (BYTE)hSize;
  279|  5.30k|            return hSize+1;
  280|  5.30k|    }   }
  281|       |
  282|       |    /* write raw values as 4-bits (max : 15) */
  283|  1.25k|    if (maxSymbolValue > (256-128)) return ERROR(GENERIC);   /* should not happen : likely means source cannot be compressed */
  ------------------
  |  |   49|      9|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      9|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      9|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (283:9): [True: 9, False: 1.24k]
  ------------------
  284|  1.24k|    if (((maxSymbolValue+1)/2) + 1 > maxDstSize) return ERROR(dstSize_tooSmall);   /* not enough space within dst buffer */
  ------------------
  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (284:9): [True: 0, False: 1.24k]
  ------------------
  285|  1.24k|    op[0] = (BYTE)(128 /*special case*/ + (maxSymbolValue-1));
  286|  1.24k|    wksp->huffWeight[maxSymbolValue] = 0;   /* to be sure it doesn't cause msan issue in final combination */
  287|  9.69k|    for (n=0; n<maxSymbolValue; n+=2)
  ------------------
  |  Branch (287:15): [True: 8.44k, False: 1.24k]
  ------------------
  288|  8.44k|        op[(n/2)+1] = (BYTE)((wksp->huffWeight[n] << 4) + wksp->huffWeight[n+1]);
  289|  1.24k|    return ((maxSymbolValue+1)/2) + 1;
  290|  1.24k|}
HUF_buildCTable_wksp:
  760|  7.04k|{
  761|  7.04k|    HUF_buildCTable_wksp_tables* const wksp_tables =
  762|  7.04k|        (HUF_buildCTable_wksp_tables*)HUF_alignUpWorkspace(workSpace, &wkspSize, ZSTD_ALIGNOF(U32));
  ------------------
  |  |  315|  7.04k|#  define ZSTD_ALIGNOF(T) __alignof(T)
  ------------------
  763|  7.04k|    nodeElt* const huffNode0 = wksp_tables->huffNodeTbl;
  764|  7.04k|    nodeElt* const huffNode = huffNode0+1;
  765|  7.04k|    int nonNullRank;
  766|       |
  767|  7.04k|    HUF_STATIC_ASSERT(HUF_CTABLE_WORKSPACE_SIZE == sizeof(HUF_buildCTable_wksp_tables));
  ------------------
  |  |   42|  7.04k|#define HUF_STATIC_ASSERT(c) DEBUG_STATIC_ASSERT(c)   /* use only *after* variable declarations */
  |  |  ------------------
  |  |  |  |   39|  7.04k|#define DEBUG_STATIC_ASSERT(c) (void)sizeof(char[(c) ? 1 : -1])
  |  |  ------------------
  ------------------
  768|       |
  769|  7.04k|    DEBUGLOG(5, "HUF_buildCTable_wksp (alphabet size = %u)", maxSymbolValue+1);
  ------------------
  |  |  104|  7.04k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 7.04k]
  |  |  ------------------
  ------------------
  770|       |
  771|       |    /* safety checks */
  772|  7.04k|    if (wkspSize < sizeof(HUF_buildCTable_wksp_tables))
  ------------------
  |  Branch (772:9): [True: 0, False: 7.04k]
  ------------------
  773|      0|        return ERROR(workSpace_tooSmall);
  ------------------
  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  774|  7.04k|    if (maxNbBits == 0) maxNbBits = HUF_TABLELOG_DEFAULT;
  ------------------
  |  |   38|      0|#define HUF_TABLELOG_DEFAULT  11      /* default tableLog value when none specified */
  ------------------
  |  Branch (774:9): [True: 0, False: 7.04k]
  ------------------
  775|  7.04k|    if (maxSymbolValue > HUF_SYMBOLVALUE_MAX)
  ------------------
  |  |   39|  7.04k|#define HUF_SYMBOLVALUE_MAX  255
  ------------------
  |  Branch (775:9): [True: 0, False: 7.04k]
  ------------------
  776|      0|        return ERROR(maxSymbolValue_tooLarge);
  ------------------
  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  777|  7.04k|    ZSTD_memset(huffNode0, 0, sizeof(huffNodeTable));
  ------------------
  |  |   46|  7.04k|# define ZSTD_memset(p,v,l) __builtin_memset((p),(v),(l))
  ------------------
  778|       |
  779|       |    /* sort, decreasing order */
  780|  7.04k|    HUF_sort(huffNode, count, maxSymbolValue, wksp_tables->rankPosition);
  781|  7.04k|    DEBUGLOG(6, "sorted symbols completed (%zu symbols)", showHNodeSymbols(huffNode, maxSymbolValue+1));
  ------------------
  |  |  104|  7.04k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 7.04k]
  |  |  ------------------
  ------------------
  782|       |
  783|       |    /* build tree */
  784|  7.04k|    nonNullRank = HUF_buildTree(huffNode, maxSymbolValue);
  785|       |
  786|       |    /* determine and enforce maxTableLog */
  787|  7.04k|    maxNbBits = HUF_setMaxHeight(huffNode, (U32)nonNullRank, maxNbBits);
  788|  7.04k|    if (maxNbBits > HUF_TABLELOG_MAX) return ERROR(GENERIC);   /* check fit into table */
  ------------------
  |  |   37|  7.04k|#define HUF_TABLELOG_MAX      12      /* max runtime value of tableLog (due to static allocation); can be modified up to HUF_TABLELOG_ABSOLUTEMAX */
  ------------------
                  if (maxNbBits > HUF_TABLELOG_MAX) return ERROR(GENERIC);   /* check fit into table */
  ------------------
  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (788:9): [True: 0, False: 7.04k]
  ------------------
  789|       |
  790|  7.04k|    HUF_buildCTableFromTree(CTable, huffNode, nonNullRank, maxSymbolValue, maxNbBits);
  791|       |
  792|  7.04k|    return maxNbBits;
  793|  7.04k|}
HUF_estimateCompressedSize:
  796|  3.48k|{
  797|  3.48k|    HUF_CElt const* ct = CTable + 1;
  798|  3.48k|    size_t nbBits = 0;
  799|  3.48k|    int s;
  800|   502k|    for (s = 0; s <= (int)maxSymbolValue; ++s) {
  ------------------
  |  Branch (800:17): [True: 499k, False: 3.48k]
  ------------------
  801|   499k|        nbBits += HUF_getNbBits(ct[s]) * count[s];
  802|   499k|    }
  803|  3.48k|    return nbBits >> 3;
  804|  3.48k|}
HUF_cardinality:
 1258|  1.31k|{
 1259|  1.31k|    unsigned cardinality = 0;
 1260|  1.31k|    unsigned i;
 1261|       |
 1262|   210k|    for (i = 0; i < maxSymbolValue + 1; i++) {
  ------------------
  |  Branch (1262:17): [True: 209k, False: 1.31k]
  ------------------
 1263|   209k|        if (count[i] != 0) cardinality += 1;
  ------------------
  |  Branch (1263:13): [True: 33.9k, False: 175k]
  ------------------
 1264|   209k|    }
 1265|       |
 1266|  1.31k|    return cardinality;
 1267|  1.31k|}
HUF_minTableLog:
 1270|  1.31k|{
 1271|  1.31k|    U32 minBitsSymbols = ZSTD_highbit32(symbolCardinality) + 1;
 1272|  1.31k|    return minBitsSymbols;
 1273|  1.31k|}
HUF_optimalTableLog:
 1283|  3.07k|{
 1284|  3.07k|    assert(srcSize > 1); /* Not supported, RLE should be used instead */
  ------------------
  |  |   70|  3.07k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1285|  3.07k|    assert(wkspSize >= sizeof(HUF_buildCTable_wksp_tables));
  ------------------
  |  |   70|  3.07k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1286|       |
 1287|  3.07k|    if (!(flags & HUF_flags_optimalDepth)) {
  ------------------
  |  Branch (1287:9): [True: 1.75k, False: 1.31k]
  ------------------
 1288|       |        /* cheap evaluation, based on FSE */
 1289|  1.75k|        return FSE_optimalTableLog_internal(maxTableLog, srcSize, maxSymbolValue, 1);
 1290|  1.75k|    }
 1291|       |
 1292|  1.31k|    {   BYTE* dst = (BYTE*)workSpace + sizeof(HUF_WriteCTableWksp);
 1293|  1.31k|        size_t dstSize = wkspSize - sizeof(HUF_WriteCTableWksp);
 1294|  1.31k|        size_t hSize, newSize;
 1295|  1.31k|        const unsigned symbolCardinality = HUF_cardinality(count, maxSymbolValue);
 1296|  1.31k|        const unsigned minTableLog = HUF_minTableLog(symbolCardinality);
 1297|  1.31k|        size_t optSize = ((size_t) ~0) - 1;
 1298|  1.31k|        unsigned optLog = maxTableLog, optLogGuess;
 1299|       |
 1300|  1.31k|        DEBUGLOG(6, "HUF_optimalTableLog: probing huf depth (srcSize=%zu)", srcSize);
  ------------------
  |  |  104|  1.31k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 1.31k]
  |  |  ------------------
  ------------------
 1301|       |
 1302|       |        /* Search until size increases */
 1303|  3.97k|        for (optLogGuess = minTableLog; optLogGuess <= maxTableLog; optLogGuess++) {
  ------------------
  |  Branch (1303:41): [True: 3.97k, False: 0]
  ------------------
 1304|  3.97k|            DEBUGLOG(7, "checking for huffLog=%u", optLogGuess);
  ------------------
  |  |  104|  3.97k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 3.97k]
  |  |  ------------------
  ------------------
 1305|       |
 1306|  3.97k|            {   size_t maxBits = HUF_buildCTable_wksp(table, count, maxSymbolValue, optLogGuess, workSpace, wkspSize);
 1307|  3.97k|                if (ERR_isError(maxBits)) continue;
  ------------------
  |  Branch (1307:21): [True: 0, False: 3.97k]
  ------------------
 1308|       |
 1309|  3.97k|                if (maxBits < optLogGuess && optLogGuess > minTableLog) break;
  ------------------
  |  Branch (1309:21): [True: 501, False: 3.47k]
  |  Branch (1309:46): [True: 492, False: 9]
  ------------------
 1310|       |
 1311|  3.48k|                hSize = HUF_writeCTable_wksp(dst, dstSize, table, maxSymbolValue, (U32)maxBits, workSpace, wkspSize);
 1312|  3.48k|            }
 1313|       |
 1314|  3.48k|            if (ERR_isError(hSize)) continue;
  ------------------
  |  Branch (1314:17): [True: 0, False: 3.48k]
  ------------------
 1315|       |
 1316|  3.48k|            newSize = HUF_estimateCompressedSize(table, count, maxSymbolValue) + hSize;
 1317|       |
 1318|  3.48k|            if (newSize > optSize + 1) {
  ------------------
  |  Branch (1318:17): [True: 819, False: 2.66k]
  ------------------
 1319|    819|                break;
 1320|    819|            }
 1321|       |
 1322|  2.66k|            if (newSize < optSize) {
  ------------------
  |  Branch (1322:17): [True: 1.83k, False: 830]
  ------------------
 1323|  1.83k|                optSize = newSize;
 1324|  1.83k|                optLog = optLogGuess;
 1325|  1.83k|            }
 1326|  2.66k|        }
 1327|  1.31k|        assert(optLog <= HUF_TABLELOG_MAX);
  ------------------
  |  |   70|  1.31k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1328|  1.31k|        return optLog;
 1329|  3.07k|    }
 1330|  3.07k|}
HUF_compress1X_repeat:
 1444|  3.13k|{
 1445|  3.13k|    DEBUGLOG(5, "HUF_compress1X_repeat (srcSize = %zu)", srcSize);
  ------------------
  |  |  104|  3.13k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 3.13k]
  |  |  ------------------
  ------------------
 1446|  3.13k|    return HUF_compress_internal(dst, dstSize, src, srcSize,
 1447|  3.13k|                                 maxSymbolValue, huffLog, HUF_singleStream,
 1448|  3.13k|                                 workSpace, wkspSize, hufTable,
 1449|  3.13k|                                 repeat, flags);
 1450|  3.13k|}
huf_compress.c:HUF_alignUpWorkspace:
  114|  23.2k|{
  115|  23.2k|    size_t const mask = align - 1;
  116|  23.2k|    size_t const rem = (size_t)workspace & mask;
  117|  23.2k|    size_t const add = (align - rem) & mask;
  118|  23.2k|    BYTE* const aligned = (BYTE*)workspace + add;
  119|  23.2k|    assert((align & (align - 1)) == 0); /* pow 2 */
  ------------------
  |  |   70|  23.2k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  120|  23.2k|    assert(align <= HUF_WORKSPACE_MAX_ALIGNMENT);
  ------------------
  |  |   70|  23.2k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  121|  23.2k|    if (*workspaceSizePtr >= add) {
  ------------------
  |  Branch (121:9): [True: 23.2k, False: 0]
  ------------------
  122|  23.2k|        assert(add < align);
  ------------------
  |  |   70|  23.2k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  123|  23.2k|        assert(((size_t)aligned & mask) == 0);
  ------------------
  |  |   70|  23.2k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  124|  23.2k|        *workspaceSizePtr -= add;
  125|  23.2k|        return aligned;
  126|  23.2k|    } else {
  127|      0|        *workspaceSizePtr = 0;
  128|       |        return NULL;
  129|      0|    }
  130|  23.2k|}
huf_compress.c:HUF_getNbBits:
  190|  4.30M|{
  191|  4.30M|    return elt & 0xFF;
  192|  4.30M|}
huf_compress.c:HUF_compressWeights:
  151|  6.55k|{
  152|  6.55k|    BYTE* const ostart = (BYTE*) dst;
  153|  6.55k|    BYTE* op = ostart;
  154|  6.55k|    BYTE* const oend = ostart + dstSize;
  155|       |
  156|  6.55k|    unsigned maxSymbolValue = HUF_TABLELOG_MAX;
  ------------------
  |  |   37|  6.55k|#define HUF_TABLELOG_MAX      12      /* max runtime value of tableLog (due to static allocation); can be modified up to HUF_TABLELOG_ABSOLUTEMAX */
  ------------------
  157|  6.55k|    U32 tableLog = MAX_FSE_TABLELOG_FOR_HUFF_HEADER;
  ------------------
  |  |  138|  6.55k|#define MAX_FSE_TABLELOG_FOR_HUFF_HEADER 6
  ------------------
  158|  6.55k|    HUF_CompressWeightsWksp* wksp = (HUF_CompressWeightsWksp*)HUF_alignUpWorkspace(workspace, &workspaceSize, ZSTD_ALIGNOF(U32));
  ------------------
  |  |  315|  6.55k|#  define ZSTD_ALIGNOF(T) __alignof(T)
  ------------------
  159|       |
  160|  6.55k|    if (workspaceSize < sizeof(HUF_CompressWeightsWksp)) return ERROR(GENERIC);
  ------------------
  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (160:9): [True: 0, False: 6.55k]
  ------------------
  161|       |
  162|       |    /* init conditions */
  163|  6.55k|    if (wtSize <= 1) return 0;  /* Not compressible */
  ------------------
  |  Branch (163:9): [True: 0, False: 6.55k]
  ------------------
  164|       |
  165|       |    /* Scan input and build symbol stats */
  166|  6.55k|    {   unsigned const maxCount = HIST_count_simple(wksp->count, &maxSymbolValue, weightTable, wtSize);   /* never fails */
  167|  6.55k|        if (maxCount == wtSize) return 1;   /* only a single symbol in src : rle */
  ------------------
  |  Branch (167:13): [True: 0, False: 6.55k]
  ------------------
  168|  6.55k|        if (maxCount == 1) return 0;        /* each symbol present maximum once => not compressible */
  ------------------
  |  Branch (168:13): [True: 30, False: 6.52k]
  ------------------
  169|  6.55k|    }
  170|       |
  171|  6.52k|    tableLog = FSE_optimalTableLog(tableLog, wtSize, maxSymbolValue);
  172|  6.52k|    CHECK_F( FSE_normalizeCount(wksp->norm, tableLog, wksp->count, wtSize, maxSymbolValue, /* useLowProbCount */ 0) );
  ------------------
  |  |   63|  6.52k|#define CHECK_F(f)   do { CHECK_V_F(_var_err__, f); } while (0)
  |  |  ------------------
  |  |  |  |   58|  6.52k|    size_t const e = f;     \
  |  |  |  |   59|  6.52k|    do {                    \
  |  |  |  |   60|  6.52k|        if (ERR_isError(e)) \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (60:13): [True: 0, False: 6.52k]
  |  |  |  |  ------------------
  |  |  |  |   61|  6.52k|            return e;       \
  |  |  |  |   62|  6.52k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (62:14): [Folded, False: 6.52k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (63:62): [Folded, False: 6.52k]
  |  |  ------------------
  ------------------
  173|       |
  174|       |    /* Write table description header */
  175|  6.52k|    {   CHECK_V_F(hSize, FSE_writeNCount(op, (size_t)(oend-op), wksp->norm, maxSymbolValue, tableLog) );
  ------------------
  |  |   58|  6.52k|    size_t const e = f;     \
  |  |   59|  6.52k|    do {                    \
  |  |   60|  6.52k|        if (ERR_isError(e)) \
  |  |  ------------------
  |  |  |  Branch (60:13): [True: 0, False: 6.52k]
  |  |  ------------------
  |  |   61|  6.52k|            return e;       \
  |  |   62|  6.52k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (62:14): [Folded, False: 6.52k]
  |  |  ------------------
  ------------------
  176|  6.52k|        op += hSize;
  177|  6.52k|    }
  178|       |
  179|       |    /* Compress */
  180|  6.52k|    CHECK_F( FSE_buildCTable_wksp(wksp->CTable, wksp->norm, maxSymbolValue, tableLog, wksp->scratchBuffer, sizeof(wksp->scratchBuffer)) );
  ------------------
  |  |   63|  6.52k|#define CHECK_F(f)   do { CHECK_V_F(_var_err__, f); } while (0)
  |  |  ------------------
  |  |  |  |   58|  6.52k|    size_t const e = f;     \
  |  |  |  |   59|  6.52k|    do {                    \
  |  |  |  |   60|  6.52k|        if (ERR_isError(e)) \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (60:13): [True: 0, False: 6.52k]
  |  |  |  |  ------------------
  |  |  |  |   61|  6.52k|            return e;       \
  |  |  |  |   62|  6.52k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (62:14): [Folded, False: 6.52k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (63:62): [Folded, False: 6.52k]
  |  |  ------------------
  ------------------
  181|  6.52k|    {   CHECK_V_F(cSize, FSE_compress_usingCTable(op, (size_t)(oend - op), weightTable, wtSize, wksp->CTable) );
  ------------------
  |  |   58|  6.52k|    size_t const e = f;     \
  |  |   59|  6.52k|    do {                    \
  |  |   60|  6.52k|        if (ERR_isError(e)) \
  |  |  ------------------
  |  |  |  Branch (60:13): [True: 0, False: 6.52k]
  |  |  ------------------
  |  |   61|  6.52k|            return e;       \
  |  |   62|  6.52k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (62:14): [Folded, False: 6.52k]
  |  |  ------------------
  ------------------
  182|  6.52k|        if (cSize == 0) return 0;   /* not enough space for compressed data */
  ------------------
  |  Branch (182:13): [True: 9, False: 6.51k]
  ------------------
  183|  6.51k|        op += cSize;
  184|  6.51k|    }
  185|       |
  186|      0|    return (size_t)(op-ostart);
  187|  6.52k|}
huf_compress.c:HUF_writeCTableHeader:
  232|  7.04k|{
  233|  7.04k|    HUF_CTableHeader header;
  234|  7.04k|    HUF_STATIC_ASSERT(sizeof(ctable[0]) == sizeof(header));
  ------------------
  |  |   42|  7.04k|#define HUF_STATIC_ASSERT(c) DEBUG_STATIC_ASSERT(c)   /* use only *after* variable declarations */
  |  |  ------------------
  |  |  |  |   39|  7.04k|#define DEBUG_STATIC_ASSERT(c) (void)sizeof(char[(c) ? 1 : -1])
  |  |  ------------------
  ------------------
  235|  7.04k|    ZSTD_memset(&header, 0, sizeof(header));
  ------------------
  |  |   46|  7.04k|# define ZSTD_memset(p,v,l) __builtin_memset((p),(v),(l))
  ------------------
  236|  7.04k|    assert(tableLog < 256);
  ------------------
  |  |   70|  7.04k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  237|  7.04k|    header.tableLog = (BYTE)tableLog;
  238|  7.04k|    assert(maxSymbolValue < 256);
  ------------------
  |  |   70|  7.04k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  239|  7.04k|    header.maxSymbolValue = (BYTE)maxSymbolValue;
  240|  7.04k|    ZSTD_memcpy(ctable, &header, sizeof(header));
  ------------------
  |  |   44|  7.04k|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  ------------------
  241|  7.04k|}
huf_compress.c:HUF_setNbBits:
  210|  1.17M|{
  211|  1.17M|    assert(nbBits <= HUF_TABLELOG_ABSOLUTEMAX);
  ------------------
  |  |   70|  1.17M|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  212|  1.17M|    *elt = nbBits;
  213|  1.17M|}
huf_compress.c:HUF_setValue:
  216|  1.17M|{
  217|  1.17M|    size_t const nbBits = HUF_getNbBits(*elt);
  218|  1.17M|    if (nbBits > 0) {
  ------------------
  |  Branch (218:9): [True: 192k, False: 978k]
  ------------------
  219|   192k|        assert((value >> nbBits) == 0);
  ------------------
  |  |   70|   192k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  220|   192k|        *elt |= value << (sizeof(HUF_CElt) * 8 - nbBits);
  221|   192k|    }
  222|  1.17M|}
huf_compress.c:HUF_sort:
  622|  7.04k|static void HUF_sort(nodeElt huffNode[], const unsigned count[], U32 const maxSymbolValue, rankPos rankPosition[]) {
  623|  7.04k|    U32 n;
  624|  7.04k|    U32 const maxSymbolValue1 = maxSymbolValue+1;
  625|       |
  626|       |    /* Compute base and set curr to base.
  627|       |     * For symbol s let lowerRank = HUF_getIndex(count[n]) and rank = lowerRank + 1.
  628|       |     * See HUF_getIndex to see bucketing strategy.
  629|       |     * We attribute each symbol to lowerRank's base value, because we want to know where
  630|       |     * each rank begins in the output, so for rank R we want to count ranks R+1 and above.
  631|       |     */
  632|  7.04k|    ZSTD_memset(rankPosition, 0, sizeof(*rankPosition) * RANK_POSITION_TABLE_SIZE);
  ------------------
  |  |   46|  7.04k|# define ZSTD_memset(p,v,l) __builtin_memset((p),(v),(l))
  ------------------
  633|  1.17M|    for (n = 0; n < maxSymbolValue1; ++n) {
  ------------------
  |  Branch (633:17): [True: 1.16M, False: 7.04k]
  ------------------
  634|  1.16M|        U32 lowerRank = HUF_getIndex(count[n]);
  635|  1.16M|        assert(lowerRank < RANK_POSITION_TABLE_SIZE - 1);
  ------------------
  |  |   70|  1.16M|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  636|  1.16M|        rankPosition[lowerRank].base++;
  637|  1.16M|    }
  638|       |
  639|  7.04k|    assert(rankPosition[RANK_POSITION_TABLE_SIZE - 1].base == 0);
  ------------------
  |  |   70|  7.04k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  640|       |    /* Set up the rankPosition table */
  641|  1.35M|    for (n = RANK_POSITION_TABLE_SIZE - 1; n > 0; --n) {
  ------------------
  |  |  510|  7.04k|#define RANK_POSITION_TABLE_SIZE 192
  ------------------
  |  Branch (641:44): [True: 1.34M, False: 7.04k]
  ------------------
  642|  1.34M|        rankPosition[n-1].base += rankPosition[n].base;
  643|  1.34M|        rankPosition[n-1].curr = rankPosition[n-1].base;
  644|  1.34M|    }
  645|       |
  646|       |    /* Insert each symbol into their appropriate bucket, setting up rankPosition table. */
  647|  1.17M|    for (n = 0; n < maxSymbolValue1; ++n) {
  ------------------
  |  Branch (647:17): [True: 1.16M, False: 7.04k]
  ------------------
  648|  1.16M|        U32 const c = count[n];
  649|  1.16M|        U32 const r = HUF_getIndex(c) + 1;
  650|  1.16M|        U32 const pos = rankPosition[r].curr++;
  651|  1.16M|        assert(pos < maxSymbolValue1);
  ------------------
  |  |   70|  1.16M|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  652|  1.16M|        huffNode[pos].count = c;
  653|  1.16M|        huffNode[pos].byte  = (BYTE)n;
  654|  1.16M|    }
  655|       |
  656|       |    /* Sort each bucket. */
  657|   190k|    for (n = RANK_POSITION_DISTINCT_COUNT_CUTOFF; n < RANK_POSITION_TABLE_SIZE - 1; ++n) {
  ------------------
  |  |  527|  7.04k|#define RANK_POSITION_DISTINCT_COUNT_CUTOFF (RANK_POSITION_LOG_BUCKETS_BEGIN + ZSTD_highbit32(RANK_POSITION_LOG_BUCKETS_BEGIN) /* == 166 */)
  |  |  ------------------
  |  |  |  |  526|  7.04k|#define RANK_POSITION_LOG_BUCKETS_BEGIN ((RANK_POSITION_TABLE_SIZE - 1) - RANK_POSITION_MAX_COUNT_LOG - 1 /* == 158 */)
  |  |  |  |  ------------------
  |  |  |  |  |  |  510|  7.04k|#define RANK_POSITION_TABLE_SIZE 192
  |  |  |  |  ------------------
  |  |  |  |               #define RANK_POSITION_LOG_BUCKETS_BEGIN ((RANK_POSITION_TABLE_SIZE - 1) - RANK_POSITION_MAX_COUNT_LOG - 1 /* == 158 */)
  |  |  |  |  ------------------
  |  |  |  |  |  |  525|  7.04k|#define RANK_POSITION_MAX_COUNT_LOG 32
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define RANK_POSITION_DISTINCT_COUNT_CUTOFF (RANK_POSITION_LOG_BUCKETS_BEGIN + ZSTD_highbit32(RANK_POSITION_LOG_BUCKETS_BEGIN) /* == 166 */)
  |  |  ------------------
  |  |  |  |  526|  7.04k|#define RANK_POSITION_LOG_BUCKETS_BEGIN ((RANK_POSITION_TABLE_SIZE - 1) - RANK_POSITION_MAX_COUNT_LOG - 1 /* == 158 */)
  |  |  |  |  ------------------
  |  |  |  |  |  |  510|  7.04k|#define RANK_POSITION_TABLE_SIZE 192
  |  |  |  |  ------------------
  |  |  |  |               #define RANK_POSITION_LOG_BUCKETS_BEGIN ((RANK_POSITION_TABLE_SIZE - 1) - RANK_POSITION_MAX_COUNT_LOG - 1 /* == 158 */)
  |  |  |  |  ------------------
  |  |  |  |  |  |  525|  7.04k|#define RANK_POSITION_MAX_COUNT_LOG 32
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                  for (n = RANK_POSITION_DISTINCT_COUNT_CUTOFF; n < RANK_POSITION_TABLE_SIZE - 1; ++n) {
  ------------------
  |  |  510|   190k|#define RANK_POSITION_TABLE_SIZE 192
  ------------------
  |  Branch (657:51): [True: 183k, False: 7.04k]
  ------------------
  658|   183k|        int const bucketSize = rankPosition[n].curr - rankPosition[n].base;
  659|   183k|        U32 const bucketStartIdx = rankPosition[n].base;
  660|   183k|        if (bucketSize > 1) {
  ------------------
  |  Branch (660:13): [True: 0, False: 183k]
  ------------------
  661|      0|            assert(bucketStartIdx < maxSymbolValue1);
  ------------------
  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  662|      0|            HUF_simpleQuickSort(huffNode + bucketStartIdx, 0, bucketSize-1);
  663|      0|        }
  664|   183k|    }
  665|       |
  666|  7.04k|    assert(HUF_isSorted(huffNode, maxSymbolValue1));
  ------------------
  |  |   70|  7.04k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  667|  7.04k|}
huf_compress.c:HUF_getIndex:
  532|  2.33M|static U32 HUF_getIndex(U32 const count) {
  533|  2.33M|    return (count < RANK_POSITION_DISTINCT_COUNT_CUTOFF)
  ------------------
  |  |  527|  2.33M|#define RANK_POSITION_DISTINCT_COUNT_CUTOFF (RANK_POSITION_LOG_BUCKETS_BEGIN + ZSTD_highbit32(RANK_POSITION_LOG_BUCKETS_BEGIN) /* == 166 */)
  |  |  ------------------
  |  |  |  |  526|  2.33M|#define RANK_POSITION_LOG_BUCKETS_BEGIN ((RANK_POSITION_TABLE_SIZE - 1) - RANK_POSITION_MAX_COUNT_LOG - 1 /* == 158 */)
  |  |  |  |  ------------------
  |  |  |  |  |  |  510|  2.33M|#define RANK_POSITION_TABLE_SIZE 192
  |  |  |  |  ------------------
  |  |  |  |               #define RANK_POSITION_LOG_BUCKETS_BEGIN ((RANK_POSITION_TABLE_SIZE - 1) - RANK_POSITION_MAX_COUNT_LOG - 1 /* == 158 */)
  |  |  |  |  ------------------
  |  |  |  |  |  |  525|  2.33M|#define RANK_POSITION_MAX_COUNT_LOG 32
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define RANK_POSITION_DISTINCT_COUNT_CUTOFF (RANK_POSITION_LOG_BUCKETS_BEGIN + ZSTD_highbit32(RANK_POSITION_LOG_BUCKETS_BEGIN) /* == 166 */)
  |  |  ------------------
  |  |  |  |  526|  2.33M|#define RANK_POSITION_LOG_BUCKETS_BEGIN ((RANK_POSITION_TABLE_SIZE - 1) - RANK_POSITION_MAX_COUNT_LOG - 1 /* == 158 */)
  |  |  |  |  ------------------
  |  |  |  |  |  |  510|  2.33M|#define RANK_POSITION_TABLE_SIZE 192
  |  |  |  |  ------------------
  |  |  |  |               #define RANK_POSITION_LOG_BUCKETS_BEGIN ((RANK_POSITION_TABLE_SIZE - 1) - RANK_POSITION_MAX_COUNT_LOG - 1 /* == 158 */)
  |  |  |  |  ------------------
  |  |  |  |  |  |  525|  2.33M|#define RANK_POSITION_MAX_COUNT_LOG 32
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (533:12): [True: 2.33M, False: 0]
  ------------------
  534|  2.33M|        ? count
  535|  2.33M|        : ZSTD_highbit32(count) + RANK_POSITION_LOG_BUCKETS_BEGIN;
  ------------------
  |  |  526|      0|#define RANK_POSITION_LOG_BUCKETS_BEGIN ((RANK_POSITION_TABLE_SIZE - 1) - RANK_POSITION_MAX_COUNT_LOG - 1 /* == 158 */)
  |  |  ------------------
  |  |  |  |  510|      0|#define RANK_POSITION_TABLE_SIZE 192
  |  |  ------------------
  |  |               #define RANK_POSITION_LOG_BUCKETS_BEGIN ((RANK_POSITION_TABLE_SIZE - 1) - RANK_POSITION_MAX_COUNT_LOG - 1 /* == 158 */)
  |  |  ------------------
  |  |  |  |  525|      0|#define RANK_POSITION_MAX_COUNT_LOG 32
  |  |  ------------------
  ------------------
  536|  2.33M|}
huf_compress.c:HUF_buildTree:
  684|  7.04k|{
  685|  7.04k|    nodeElt* const huffNode0 = huffNode - 1;
  686|  7.04k|    int nonNullRank;
  687|  7.04k|    int lowS, lowN;
  688|  7.04k|    int nodeNb = STARTNODE;
  ------------------
  |  |  674|  7.04k|#define STARTNODE (HUF_SYMBOLVALUE_MAX+1)
  |  |  ------------------
  |  |  |  |   39|  7.04k|#define HUF_SYMBOLVALUE_MAX  255
  |  |  ------------------
  ------------------
  689|  7.04k|    int n, nodeRoot;
  690|  7.04k|    DEBUGLOG(5, "HUF_buildTree (alphabet size = %u)", maxSymbolValue + 1);
  ------------------
  |  |  104|  7.04k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 7.04k]
  |  |  ------------------
  ------------------
  691|       |    /* init for parents */
  692|  7.04k|    nonNullRank = (int)maxSymbolValue;
  693|   985k|    while(huffNode[nonNullRank].count == 0) nonNullRank--;
  ------------------
  |  Branch (693:11): [True: 978k, False: 7.04k]
  ------------------
  694|  7.04k|    lowS = nonNullRank; nodeRoot = nodeNb + lowS - 1; lowN = nodeNb;
  695|  7.04k|    huffNode[nodeNb].count = huffNode[lowS].count + huffNode[lowS-1].count;
  696|  7.04k|    huffNode[lowS].parent = huffNode[lowS-1].parent = (U16)nodeNb;
  697|  7.04k|    nodeNb++; lowS-=2;
  698|   182k|    for (n=nodeNb; n<=nodeRoot; n++) huffNode[n].count = (U32)(1U<<30);
  ------------------
  |  Branch (698:20): [True: 175k, False: 7.04k]
  ------------------
  699|  7.04k|    huffNode0[0].count = (U32)(1U<<31);  /* fake entry, strong barrier */
  700|       |
  701|       |    /* create parents */
  702|   182k|    while (nodeNb <= nodeRoot) {
  ------------------
  |  Branch (702:12): [True: 175k, False: 7.04k]
  ------------------
  703|   175k|        int const n1 = (huffNode[lowS].count < huffNode[lowN].count) ? lowS-- : lowN++;
  ------------------
  |  Branch (703:24): [True: 89.9k, False: 85.6k]
  ------------------
  704|   175k|        int const n2 = (huffNode[lowS].count < huffNode[lowN].count) ? lowS-- : lowN++;
  ------------------
  |  Branch (704:24): [True: 85.6k, False: 89.9k]
  ------------------
  705|   175k|        huffNode[nodeNb].count = huffNode[n1].count + huffNode[n2].count;
  706|   175k|        huffNode[n1].parent = huffNode[n2].parent = (U16)nodeNb;
  707|   175k|        nodeNb++;
  708|   175k|    }
  709|       |
  710|       |    /* distribute weights (unlimited tree height) */
  711|  7.04k|    huffNode[nodeRoot].nbBits = 0;
  712|   182k|    for (n=nodeRoot-1; n>=STARTNODE; n--)
  ------------------
  |  |  674|   182k|#define STARTNODE (HUF_SYMBOLVALUE_MAX+1)
  |  |  ------------------
  |  |  |  |   39|   182k|#define HUF_SYMBOLVALUE_MAX  255
  |  |  ------------------
  ------------------
  |  Branch (712:24): [True: 175k, False: 7.04k]
  ------------------
  713|   175k|        huffNode[n].nbBits = huffNode[ huffNode[n].parent ].nbBits + 1;
  714|   196k|    for (n=0; n<=nonNullRank; n++)
  ------------------
  |  Branch (714:15): [True: 189k, False: 7.04k]
  ------------------
  715|   189k|        huffNode[n].nbBits = huffNode[ huffNode[n].parent ].nbBits + 1;
  716|       |
  717|  7.04k|    DEBUGLOG(6, "Initial distribution of bits completed (%zu sorted symbols)", showHNodeBits(huffNode, maxSymbolValue+1));
  ------------------
  |  |  104|  7.04k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 7.04k]
  |  |  ------------------
  ------------------
  718|       |
  719|  7.04k|    return nonNullRank;
  720|  7.04k|}
huf_compress.c:HUF_setMaxHeight:
  378|  7.04k|{
  379|  7.04k|    const U32 largestBits = huffNode[lastNonNull].nbBits;
  380|       |    /* early exit : no elt > targetNbBits, so the tree is already valid. */
  381|  7.04k|    if (largestBits <= targetNbBits) return largestBits;
  ------------------
  |  Branch (381:9): [True: 3.10k, False: 3.94k]
  ------------------
  382|       |
  383|  3.94k|    DEBUGLOG(5, "HUF_setMaxHeight (targetNbBits = %u)", targetNbBits);
  ------------------
  |  |  104|  3.94k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 3.94k]
  |  |  ------------------
  ------------------
  384|       |
  385|       |    /* there are several too large elements (at least >= 2) */
  386|  3.94k|    {   int totalCost = 0;
  387|  3.94k|        const U32 baseCost = 1 << (largestBits - targetNbBits);
  388|  3.94k|        int n = (int)lastNonNull;
  389|       |
  390|       |        /* Adjust any ranks > targetNbBits to targetNbBits.
  391|       |         * Compute totalCost, which is how far the sum of the ranks is
  392|       |         * we are over 2^largestBits after adjust the offending ranks.
  393|       |         */
  394|  37.5k|        while (huffNode[n].nbBits > targetNbBits) {
  ------------------
  |  Branch (394:16): [True: 33.5k, False: 3.94k]
  ------------------
  395|  33.5k|            totalCost += baseCost - (1 << (largestBits - huffNode[n].nbBits));
  396|  33.5k|            huffNode[n].nbBits = (BYTE)targetNbBits;
  397|  33.5k|            n--;
  398|  33.5k|        }
  399|       |        /* n stops at huffNode[n].nbBits <= targetNbBits */
  400|  3.94k|        assert(huffNode[n].nbBits <= targetNbBits);
  ------------------
  |  |   70|  3.94k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  401|       |        /* n end at index of smallest symbol using < targetNbBits */
  402|  29.4k|        while (huffNode[n].nbBits == targetNbBits) --n;
  ------------------
  |  Branch (402:16): [True: 25.5k, False: 3.94k]
  ------------------
  403|       |
  404|       |        /* renorm totalCost from 2^largestBits to 2^targetNbBits
  405|       |         * note : totalCost is necessarily a multiple of baseCost */
  406|  3.94k|        assert(((U32)totalCost & (baseCost - 1)) == 0);
  ------------------
  |  |   70|  3.94k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  407|  3.94k|        totalCost >>= (largestBits - targetNbBits);
  408|  3.94k|        assert(totalCost > 0);
  ------------------
  |  |   70|  3.94k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  409|       |
  410|       |        /* repay normalized cost */
  411|  3.94k|        {   U32 const noSymbol = 0xF0F0F0F0;
  412|  3.94k|            U32 rankLast[HUF_TABLELOG_MAX+2];
  413|       |
  414|       |            /* Get pos of last (smallest = lowest cum. count) symbol per rank */
  415|  3.94k|            ZSTD_memset(rankLast, 0xF0, sizeof(rankLast));
  ------------------
  |  |   46|  3.94k|# define ZSTD_memset(p,v,l) __builtin_memset((p),(v),(l))
  ------------------
  416|  3.94k|            {   U32 currentNbBits = targetNbBits;
  417|  3.94k|                int pos;
  418|  48.4k|                for (pos=n ; pos >= 0; pos--) {
  ------------------
  |  Branch (418:30): [True: 44.4k, False: 3.94k]
  ------------------
  419|  44.4k|                    if (huffNode[pos].nbBits >= currentNbBits) continue;
  ------------------
  |  Branch (419:25): [True: 32.7k, False: 11.7k]
  ------------------
  420|  11.7k|                    currentNbBits = huffNode[pos].nbBits;   /* < targetNbBits */
  421|  11.7k|                    rankLast[targetNbBits-currentNbBits] = (U32)pos;
  422|  11.7k|            }   }
  423|       |
  424|  15.5k|            while (totalCost > 0) {
  ------------------
  |  Branch (424:20): [True: 11.5k, False: 3.94k]
  ------------------
  425|       |                /* Try to reduce the next power of 2 above totalCost because we
  426|       |                 * gain back half the rank.
  427|       |                 */
  428|  11.5k|                U32 nBitsToDecrease = ZSTD_highbit32((U32)totalCost) + 1;
  429|  11.5k|                assert(nBitsToDecrease <= HUF_TABLELOG_MAX+1);
  ------------------
  |  |   70|  11.5k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  430|  21.3k|                for ( ; nBitsToDecrease > 1; nBitsToDecrease--) {
  ------------------
  |  Branch (430:25): [True: 14.5k, False: 6.84k]
  ------------------
  431|  14.5k|                    U32 const highPos = rankLast[nBitsToDecrease];
  432|  14.5k|                    U32 const lowPos = rankLast[nBitsToDecrease-1];
  433|  14.5k|                    if (highPos == noSymbol) continue;
  ------------------
  |  Branch (433:25): [True: 5.44k, False: 9.08k]
  ------------------
  434|       |                    /* Decrease highPos if no symbols of lowPos or if it is
  435|       |                     * not cheaper to remove 2 lowPos than highPos.
  436|       |                     */
  437|  9.08k|                    if (lowPos == noSymbol) break;
  ------------------
  |  Branch (437:25): [True: 277, False: 8.80k]
  ------------------
  438|  8.80k|                    {   U32 const highTotal = huffNode[highPos].count;
  439|  8.80k|                        U32 const lowTotal = 2 * huffNode[lowPos].count;
  440|  8.80k|                        if (highTotal <= lowTotal) break;
  ------------------
  |  Branch (440:29): [True: 4.45k, False: 4.35k]
  ------------------
  441|  8.80k|                }   }
  442|       |                /* only triggered when no more rank 1 symbol left => find closest one (note : there is necessarily at least one !) */
  443|  11.5k|                assert(rankLast[nBitsToDecrease] != noSymbol || nBitsToDecrease == 1);
  ------------------
  |  |   70|  11.5k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  444|       |                /* HUF_MAX_TABLELOG test just to please gcc 5+; but it should not be necessary */
  445|  11.7k|                while ((nBitsToDecrease<=HUF_TABLELOG_MAX) && (rankLast[nBitsToDecrease] == noSymbol))
  ------------------
  |  |   37|  11.7k|#define HUF_TABLELOG_MAX      12      /* max runtime value of tableLog (due to static allocation); can be modified up to HUF_TABLELOG_ABSOLUTEMAX */
  ------------------
  |  Branch (445:24): [True: 11.7k, False: 0]
  |  Branch (445:63): [True: 147, False: 11.5k]
  ------------------
  446|    147|                    nBitsToDecrease++;
  447|  11.5k|                assert(rankLast[nBitsToDecrease] != noSymbol);
  ------------------
  |  |   70|  11.5k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  448|       |                /* Increase the number of bits to gain back half the rank cost. */
  449|  11.5k|                totalCost -= 1 << (nBitsToDecrease-1);
  450|  11.5k|                huffNode[rankLast[nBitsToDecrease]].nbBits++;
  451|       |
  452|       |                /* Fix up the new rank.
  453|       |                 * If the new rank was empty, this symbol is now its smallest.
  454|       |                 * Otherwise, this symbol will be the largest in the new rank so no adjustment.
  455|       |                 */
  456|  11.5k|                if (rankLast[nBitsToDecrease-1] == noSymbol)
  ------------------
  |  Branch (456:21): [True: 3.57k, False: 7.99k]
  ------------------
  457|  3.57k|                    rankLast[nBitsToDecrease-1] = rankLast[nBitsToDecrease];
  458|       |                /* Fix up the old rank.
  459|       |                 * If the symbol was at position 0, meaning it was the highest weight symbol in the tree,
  460|       |                 * it must be the only symbol in its rank, so the old rank now has no symbols.
  461|       |                 * Otherwise, since the Huffman nodes are sorted by count, the previous position is now
  462|       |                 * the smallest node in the rank. If the previous position belongs to a different rank,
  463|       |                 * then the rank is now empty.
  464|       |                 */
  465|  11.5k|                if (rankLast[nBitsToDecrease] == 0)    /* special case, reached largest symbol */
  ------------------
  |  Branch (465:21): [True: 1.02k, False: 10.5k]
  ------------------
  466|  1.02k|                    rankLast[nBitsToDecrease] = noSymbol;
  467|  10.5k|                else {
  468|  10.5k|                    rankLast[nBitsToDecrease]--;
  469|  10.5k|                    if (huffNode[rankLast[nBitsToDecrease]].nbBits != targetNbBits-nBitsToDecrease)
  ------------------
  |  Branch (469:25): [True: 726, False: 9.82k]
  ------------------
  470|    726|                        rankLast[nBitsToDecrease] = noSymbol;   /* this rank is now empty */
  471|  10.5k|                }
  472|  11.5k|            }   /* while (totalCost > 0) */
  473|       |
  474|       |            /* If we've removed too much weight, then we have to add it back.
  475|       |             * To avoid overshooting again, we only adjust the smallest rank.
  476|       |             * We take the largest nodes from the lowest rank 0 and move them
  477|       |             * to rank 1. There's guaranteed to be enough rank 0 symbols because
  478|       |             * TODO.
  479|       |             */
  480|  4.17k|            while (totalCost < 0) {  /* Sometimes, cost correction overshoot */
  ------------------
  |  Branch (480:20): [True: 230, False: 3.94k]
  ------------------
  481|       |                /* special case : no rank 1 symbol (using targetNbBits-1);
  482|       |                 * let's create one from largest rank 0 (using targetNbBits).
  483|       |                 */
  484|    230|                if (rankLast[1] == noSymbol) {
  ------------------
  |  Branch (484:21): [True: 32, False: 198]
  ------------------
  485|    135|                    while (huffNode[n].nbBits == targetNbBits) n--;
  ------------------
  |  Branch (485:28): [True: 103, False: 32]
  ------------------
  486|     32|                    huffNode[n+1].nbBits--;
  487|     32|                    assert(n >= 0);
  ------------------
  |  |   70|     32|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  488|     32|                    rankLast[1] = (U32)(n+1);
  489|     32|                    totalCost++;
  490|     32|                    continue;
  491|     32|                }
  492|    198|                huffNode[ rankLast[1] + 1 ].nbBits--;
  493|    198|                rankLast[1]++;
  494|    198|                totalCost ++;
  495|    198|            }
  496|  3.94k|        }   /* repay normalized cost */
  497|  3.94k|    }   /* there are several too large elements (at least >= 2) */
  498|       |
  499|  3.94k|    return targetNbBits;
  500|  7.04k|}
huf_compress.c:HUF_buildCTableFromTree:
  733|  7.04k|{
  734|  7.04k|    HUF_CElt* const ct = CTable + 1;
  735|       |    /* fill result into ctable (val, nbBits) */
  736|  7.04k|    int n;
  737|  7.04k|    U16 nbPerRank[HUF_TABLELOG_MAX+1] = {0};
  738|  7.04k|    U16 valPerRank[HUF_TABLELOG_MAX+1] = {0};
  739|  7.04k|    int const alphabetSize = (int)(maxSymbolValue + 1);
  740|   196k|    for (n=0; n<=nonNullRank; n++)
  ------------------
  |  Branch (740:15): [True: 189k, False: 7.04k]
  ------------------
  741|   189k|        nbPerRank[huffNode[n].nbBits]++;
  742|       |    /* determine starting value per rank */
  743|  7.04k|    {   U16 min = 0;
  744|  49.7k|        for (n=(int)maxNbBits; n>0; n--) {
  ------------------
  |  Branch (744:32): [True: 42.7k, False: 7.04k]
  ------------------
  745|  42.7k|            valPerRank[n] = min;      /* get starting value within each rank */
  746|  42.7k|            min += nbPerRank[n];
  747|  42.7k|            min >>= 1;
  748|  42.7k|    }   }
  749|  1.17M|    for (n=0; n<alphabetSize; n++)
  ------------------
  |  Branch (749:15): [True: 1.16M, False: 7.04k]
  ------------------
  750|  1.16M|        HUF_setNbBits(ct + huffNode[n].byte, huffNode[n].nbBits);   /* push nbBits per symbol, symbol order */
  751|  1.17M|    for (n=0; n<alphabetSize; n++)
  ------------------
  |  Branch (751:15): [True: 1.16M, False: 7.04k]
  ------------------
  752|  1.16M|        HUF_setValue(ct + n, valPerRank[HUF_getNbBits(ct[n])]++);   /* assign value within rank, symbol order */
  753|       |
  754|  7.04k|    HUF_writeCTableHeader(CTable, maxNbBits, maxSymbolValue);
  755|  7.04k|}
huf_compress.c:HUF_compress1X_usingCTable_internal:
 1144|  3.03k|{
 1145|  3.03k|    if (ZSTD_USE_BMI2(flags & HUF_flags_bmi2)) {
  ------------------
  |  |   36|  3.03k|#  define ZSTD_USE_BMI2(bmi2) (bmi2)
  |  |  ------------------
  |  |  |  Branch (36:31): [True: 3.03k, False: 0]
  |  |  ------------------
  ------------------
 1146|  3.03k|        return HUF_compress1X_usingCTable_internal_bmi2(dst, dstSize, src, srcSize, CTable);
 1147|  3.03k|    }
 1148|      0|    (void)flags;
 1149|      0|    return HUF_compress1X_usingCTable_internal_default(dst, dstSize, src, srcSize, CTable);
 1150|  3.03k|}
huf_compress.c:HUF_compress1X_usingCTable_internal_bmi2:
 1128|  3.03k|{
 1129|  3.03k|    return HUF_compress1X_usingCTable_internal_body(dst, dstSize, src, srcSize, CTable);
 1130|  3.03k|}
huf_compress.c:HUF_compress1X_usingCTable_internal_body:
 1061|  3.03k|{
 1062|  3.03k|    U32 const tableLog = HUF_readCTableHeader(CTable).tableLog;
 1063|  3.03k|    HUF_CElt const* ct = CTable + 1;
 1064|  3.03k|    const BYTE* ip = (const BYTE*) src;
 1065|  3.03k|    BYTE* const ostart = (BYTE*)dst;
 1066|  3.03k|    BYTE* const oend = ostart + dstSize;
 1067|  3.03k|    HUF_CStream_t bitC;
 1068|       |
 1069|       |    /* init */
 1070|  3.03k|    if (dstSize < 8) return 0;   /* not enough space to compress */
  ------------------
  |  Branch (1070:9): [True: 0, False: 3.03k]
  ------------------
 1071|  3.03k|    { BYTE* op = ostart;
 1072|  3.03k|      size_t const initErr = HUF_initCStream(&bitC, op, (size_t)(oend-op));
 1073|  3.03k|      if (HUF_isError(initErr)) return 0; }
  ------------------
  |  |   41|  3.03k|#define HUF_isError ERR_isError
  ------------------
  |  Branch (1073:11): [True: 2, False: 3.03k]
  ------------------
 1074|       |
 1075|  3.03k|    if (dstSize < HUF_tightCompressBound(srcSize, (size_t)tableLog) || tableLog > 11)
  ------------------
  |  Branch (1075:9): [True: 1.93k, False: 1.09k]
  |  Branch (1075:72): [True: 0, False: 1.09k]
  ------------------
 1076|  1.93k|        HUF_compress1X_usingCTable_internal_body_loop(&bitC, ip, srcSize, ct, /* kUnroll */ MEM_32bits() ? 2 : 4, /* kFast */ 0, /* kLastFast */ 0);
  ------------------
  |  Branch (1076:93): [True: 0, False: 1.93k]
  ------------------
 1077|  1.09k|    else {
 1078|  1.09k|        if (MEM_32bits()) {
  ------------------
  |  Branch (1078:13): [True: 0, False: 1.09k]
  ------------------
 1079|      0|            switch (tableLog) {
 1080|      0|            case 11:
  ------------------
  |  Branch (1080:13): [True: 0, False: 0]
  ------------------
 1081|      0|                HUF_compress1X_usingCTable_internal_body_loop(&bitC, ip, srcSize, ct, /* kUnroll */ 2, /* kFastFlush */ 1, /* kLastFast */ 0);
 1082|      0|                break;
 1083|      0|            case 10: ZSTD_FALLTHROUGH;
  ------------------
  |  |  288|      0|#  define ZSTD_FALLTHROUGH ; __attribute__((__fallthrough__))
  ------------------
  |  Branch (1083:13): [True: 0, False: 0]
  ------------------
 1084|      0|            case 9: ZSTD_FALLTHROUGH;
  ------------------
  |  |  288|      0|#  define ZSTD_FALLTHROUGH ; __attribute__((__fallthrough__))
  ------------------
  |  Branch (1084:13): [True: 0, False: 0]
  ------------------
 1085|      0|            case 8:
  ------------------
  |  Branch (1085:13): [True: 0, False: 0]
  ------------------
 1086|      0|                HUF_compress1X_usingCTable_internal_body_loop(&bitC, ip, srcSize, ct, /* kUnroll */ 2, /* kFastFlush */ 1, /* kLastFast */ 1);
 1087|      0|                break;
 1088|      0|            case 7: ZSTD_FALLTHROUGH;
  ------------------
  |  |  288|      0|#  define ZSTD_FALLTHROUGH ; __attribute__((__fallthrough__))
  ------------------
  |  Branch (1088:13): [True: 0, False: 0]
  ------------------
 1089|      0|            default:
  ------------------
  |  Branch (1089:13): [True: 0, False: 0]
  ------------------
 1090|      0|                HUF_compress1X_usingCTable_internal_body_loop(&bitC, ip, srcSize, ct, /* kUnroll */ 3, /* kFastFlush */ 1, /* kLastFast */ 1);
 1091|      0|                break;
 1092|      0|            }
 1093|  1.09k|        } else {
 1094|  1.09k|            switch (tableLog) {
 1095|      0|            case 11:
  ------------------
  |  Branch (1095:13): [True: 0, False: 1.09k]
  ------------------
 1096|      0|                HUF_compress1X_usingCTable_internal_body_loop(&bitC, ip, srcSize, ct, /* kUnroll */ 5, /* kFastFlush */ 1, /* kLastFast */ 0);
 1097|      0|                break;
 1098|      0|            case 10:
  ------------------
  |  Branch (1098:13): [True: 0, False: 1.09k]
  ------------------
 1099|      0|                HUF_compress1X_usingCTable_internal_body_loop(&bitC, ip, srcSize, ct, /* kUnroll */ 5, /* kFastFlush */ 1, /* kLastFast */ 1);
 1100|      0|                break;
 1101|      0|            case 9:
  ------------------
  |  Branch (1101:13): [True: 0, False: 1.09k]
  ------------------
 1102|      0|                HUF_compress1X_usingCTable_internal_body_loop(&bitC, ip, srcSize, ct, /* kUnroll */ 6, /* kFastFlush */ 1, /* kLastFast */ 0);
 1103|      0|                break;
 1104|      0|            case 8:
  ------------------
  |  Branch (1104:13): [True: 0, False: 1.09k]
  ------------------
 1105|      0|                HUF_compress1X_usingCTable_internal_body_loop(&bitC, ip, srcSize, ct, /* kUnroll */ 7, /* kFastFlush */ 1, /* kLastFast */ 0);
 1106|      0|                break;
 1107|    137|            case 7:
  ------------------
  |  Branch (1107:13): [True: 137, False: 962]
  ------------------
 1108|    137|                HUF_compress1X_usingCTable_internal_body_loop(&bitC, ip, srcSize, ct, /* kUnroll */ 8, /* kFastFlush */ 1, /* kLastFast */ 0);
 1109|    137|                break;
 1110|    241|            case 6: ZSTD_FALLTHROUGH;
  ------------------
  |  |  288|    241|#  define ZSTD_FALLTHROUGH ; __attribute__((__fallthrough__))
  ------------------
  |  Branch (1110:13): [True: 241, False: 858]
  ------------------
 1111|    962|            default:
  ------------------
  |  Branch (1111:13): [True: 721, False: 378]
  ------------------
 1112|    962|                HUF_compress1X_usingCTable_internal_body_loop(&bitC, ip, srcSize, ct, /* kUnroll */ 9, /* kFastFlush */ 1, /* kLastFast */ 1);
 1113|    962|                break;
 1114|  1.09k|            }
 1115|  1.09k|        }
 1116|  1.09k|    }
 1117|  3.03k|    assert(bitC.ptr <= bitC.endPtr);
  ------------------
  |  |   70|  3.03k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1118|       |
 1119|  3.03k|    return HUF_closeCStream(&bitC);
 1120|  3.03k|}
huf_compress.c:HUF_initCStream:
  860|  3.03k|{
  861|  3.03k|    ZSTD_memset(bitC, 0, sizeof(*bitC));
  ------------------
  |  |   46|  3.03k|# define ZSTD_memset(p,v,l) __builtin_memset((p),(v),(l))
  ------------------
  862|  3.03k|    bitC->startPtr = (BYTE*)startPtr;
  863|  3.03k|    bitC->ptr = bitC->startPtr;
  864|  3.03k|    bitC->endPtr = bitC->startPtr + dstCapacity - sizeof(bitC->bitContainer[0]);
  865|  3.03k|    if (dstCapacity <= sizeof(bitC->bitContainer[0])) return ERROR(dstSize_tooSmall);
  ------------------
  |  |   49|      2|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      2|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      2|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (865:9): [True: 2, False: 3.03k]
  ------------------
  866|  3.03k|    return 0;
  867|  3.03k|}
huf_compress.c:HUF_tightCompressBound:
 1052|  3.03k|{
 1053|  3.03k|    return ((srcSize * tableLog) >> 3) + 8;
 1054|  3.03k|}
huf_compress.c:HUF_compress1X_usingCTable_internal_body_loop:
  997|  3.03k|{
  998|       |    /* Join to kUnroll */
  999|  3.03k|    int n = (int)srcSize;
 1000|  3.03k|    int rem = n % kUnroll;
 1001|  3.03k|    if (rem > 0) {
  ------------------
  |  Branch (1001:9): [True: 1.55k, False: 1.48k]
  ------------------
 1002|  6.50k|        for (; rem > 0; --rem) {
  ------------------
  |  Branch (1002:16): [True: 4.95k, False: 1.55k]
  ------------------
 1003|  4.95k|            HUF_encodeSymbol(bitC, ip[--n], ct, 0, /* fast */ 0);
 1004|  4.95k|        }
 1005|  1.55k|        HUF_flushBits(bitC, kFastFlush);
 1006|  1.55k|    }
 1007|  3.03k|    assert(n % kUnroll == 0);
  ------------------
  |  |   70|  3.03k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1008|       |
 1009|       |    /* Join to 2 * kUnroll */
 1010|  3.03k|    if (n % (2 * kUnroll)) {
  ------------------
  |  Branch (1010:9): [True: 1.28k, False: 1.74k]
  ------------------
 1011|  1.28k|        int u;
 1012|  7.52k|        for (u = 1; u < kUnroll; ++u) {
  ------------------
  |  Branch (1012:21): [True: 6.23k, False: 1.28k]
  ------------------
 1013|  6.23k|            HUF_encodeSymbol(bitC, ip[n - u], ct, 0, 1);
 1014|  6.23k|        }
 1015|  1.28k|        HUF_encodeSymbol(bitC, ip[n - kUnroll], ct, 0, kLastFast);
 1016|  1.28k|        HUF_flushBits(bitC, kFastFlush);
 1017|  1.28k|        n -= kUnroll;
 1018|  1.28k|    }
 1019|  3.03k|    assert(n % (2 * kUnroll) == 0);
  ------------------
  |  |   70|  3.03k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1020|       |
 1021|  37.4k|    for (; n>0; n-= 2 * kUnroll) {
  ------------------
  |  Branch (1021:12): [True: 34.4k, False: 3.03k]
  ------------------
 1022|       |        /* Encode kUnroll symbols into the bitstream @ index 0. */
 1023|  34.4k|        int u;
 1024|   166k|        for (u = 1; u < kUnroll; ++u) {
  ------------------
  |  Branch (1024:21): [True: 132k, False: 34.4k]
  ------------------
 1025|   132k|            HUF_encodeSymbol(bitC, ip[n - u], ct, /* idx */ 0, /* fast */ 1);
 1026|   132k|        }
 1027|  34.4k|        HUF_encodeSymbol(bitC, ip[n - kUnroll], ct, /* idx */ 0, /* fast */ kLastFast);
 1028|  34.4k|        HUF_flushBits(bitC, kFastFlush);
 1029|       |        /* Encode kUnroll symbols into the bitstream @ index 1.
 1030|       |         * This allows us to start filling the bit container
 1031|       |         * without any data dependencies.
 1032|       |         */
 1033|  34.4k|        HUF_zeroIndex1(bitC);
 1034|   166k|        for (u = 1; u < kUnroll; ++u) {
  ------------------
  |  Branch (1034:21): [True: 132k, False: 34.4k]
  ------------------
 1035|   132k|            HUF_encodeSymbol(bitC, ip[n - kUnroll - u], ct, /* idx */ 1, /* fast */ 1);
 1036|   132k|        }
 1037|  34.4k|        HUF_encodeSymbol(bitC, ip[n - kUnroll - kUnroll], ct, /* idx */ 1, /* fast */ kLastFast);
 1038|       |        /* Merge bitstream @ index 1 into the bitstream @ index 0 */
 1039|  34.4k|        HUF_mergeIndex1(bitC);
 1040|  34.4k|        HUF_flushBits(bitC, kFastFlush);
 1041|  34.4k|    }
 1042|  3.03k|    assert(n == 0);
  ------------------
  |  |   70|  3.03k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1043|       |
 1044|  3.03k|}
huf_compress.c:HUF_encodeSymbol:
  988|   346k|{
  989|   346k|    HUF_addBits(bitCPtr, CTable[symbol], idx, fast);
  990|   346k|}
huf_compress.c:HUF_addBits:
  880|   349k|{
  881|   349k|    assert(idx <= 1);
  ------------------
  |  |   70|   349k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  882|   349k|    assert(HUF_getNbBits(elt) <= HUF_TABLELOG_ABSOLUTEMAX);
  ------------------
  |  |   70|   349k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  883|       |    /* This is efficient on x86-64 with BMI2 because shrx
  884|       |     * only reads the low 6 bits of the register. The compiler
  885|       |     * knows this and elides the mask. When fast is set,
  886|       |     * every operation can use the same value loaded from elt.
  887|       |     */
  888|   349k|    bitC->bitContainer[idx] >>= HUF_getNbBits(elt);
  889|   349k|    bitC->bitContainer[idx] |= kFast ? HUF_getValueFast(elt) : HUF_getValue(elt);
  ------------------
  |  Branch (889:32): [True: 282k, False: 67.0k]
  ------------------
  890|       |    /* We only read the low 8 bits of bitC->bitPos[idx] so it
  891|       |     * doesn't matter that the high bits have noise from the value.
  892|       |     */
  893|   349k|    bitC->bitPos[idx] += HUF_getNbBitsFast(elt);
  894|   349k|    assert((bitC->bitPos[idx] & 0xFF) <= HUF_BITS_IN_CONTAINER);
  ------------------
  |  |   70|   349k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  895|       |    /* The last 4-bits of elt are dirty if fast is set,
  896|       |     * so we must not be overwriting bits that have already been
  897|       |     * inserted into the bit container.
  898|       |     */
  899|       |#if DEBUGLEVEL >= 1
  900|       |    {
  901|       |        size_t const nbBits = HUF_getNbBits(elt);
  902|       |        size_t const dirtyBits = nbBits == 0 ? 0 : ZSTD_highbit32((U32)nbBits) + 1;
  903|       |        (void)dirtyBits;
  904|       |        /* Middle bits are 0. */
  905|       |        assert(((elt >> dirtyBits) << (dirtyBits + nbBits)) == 0);
  906|       |        /* We didn't overwrite any bits in the bit container. */
  907|       |        assert(!kFast || (bitC->bitPos[idx] & 0xFF) <= HUF_BITS_IN_CONTAINER);
  908|       |        (void)dirtyBits;
  909|       |    }
  910|       |#endif
  911|   349k|}
huf_compress.c:HUF_getValueFast:
  205|   282k|{
  206|   282k|    return elt;
  207|   282k|}
huf_compress.c:HUF_getValue:
  200|  67.0k|{
  201|  67.0k|    return elt & ~(size_t)0xFF;
  202|  67.0k|}
huf_compress.c:HUF_getNbBitsFast:
  195|   349k|{
  196|   349k|    return elt;
  197|   349k|}
huf_compress.c:HUF_flushBits:
  940|  74.7k|{
  941|       |    /* The upper bits of bitPos are noisy, so we must mask by 0xFF. */
  942|  74.7k|    size_t const nbBits = bitC->bitPos[0] & 0xFF;
  943|  74.7k|    size_t const nbBytes = nbBits >> 3;
  944|       |    /* The top nbBits bits of bitContainer are the ones we need. */
  945|  74.7k|    size_t const bitContainer = bitC->bitContainer[0] >> (HUF_BITS_IN_CONTAINER - nbBits);
  ------------------
  |  |  843|  74.7k|#define HUF_BITS_IN_CONTAINER (sizeof(size_t) * 8)
  ------------------
  946|       |    /* Mask bitPos to account for the bytes we consumed. */
  947|  74.7k|    bitC->bitPos[0] &= 7;
  948|  74.7k|    assert(nbBits > 0);
  ------------------
  |  |   70|  74.7k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  949|  74.7k|    assert(nbBits <= sizeof(bitC->bitContainer[0]) * 8);
  ------------------
  |  |   70|  74.7k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  950|  74.7k|    assert(bitC->ptr <= bitC->endPtr);
  ------------------
  |  |   70|  74.7k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  951|  74.7k|    MEM_writeLEST(bitC->ptr, bitContainer);
  952|  74.7k|    bitC->ptr += nbBytes;
  953|  74.7k|    assert(!kFast || bitC->ptr <= bitC->endPtr);
  ------------------
  |  |   70|  74.7k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  954|  74.7k|    if (!kFast && bitC->ptr > bitC->endPtr) bitC->ptr = bitC->endPtr;
  ------------------
  |  Branch (954:9): [True: 61.3k, False: 13.4k]
  |  Branch (954:19): [True: 3.99k, False: 57.3k]
  ------------------
  955|       |    /* bitContainer doesn't need to be modified because the leftover
  956|       |     * bits are already the top bitPos bits. And we don't care about
  957|       |     * noise in the lower values.
  958|       |     */
  959|  74.7k|}
huf_compress.c:HUF_zeroIndex1:
  914|  34.4k|{
  915|  34.4k|    bitC->bitContainer[1] = 0;
  916|  34.4k|    bitC->bitPos[1] = 0;
  917|  34.4k|}
huf_compress.c:HUF_mergeIndex1:
  924|  34.4k|{
  925|  34.4k|    assert((bitC->bitPos[1] & 0xFF) < HUF_BITS_IN_CONTAINER);
  ------------------
  |  |   70|  34.4k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  926|  34.4k|    bitC->bitContainer[0] >>= (bitC->bitPos[1] & 0xFF);
  927|  34.4k|    bitC->bitContainer[0] |= bitC->bitContainer[1];
  928|  34.4k|    bitC->bitPos[0] += bitC->bitPos[1];
  929|  34.4k|    assert((bitC->bitPos[0] & 0xFF) <= HUF_BITS_IN_CONTAINER);
  ------------------
  |  |   70|  34.4k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  930|  34.4k|}
huf_compress.c:HUF_closeCStream:
  976|  3.03k|{
  977|  3.03k|    HUF_addBits(bitC, HUF_endMark(), /* idx */ 0, /* kFast */ 0);
  978|  3.03k|    HUF_flushBits(bitC, /* kFast */ 0);
  979|  3.03k|    {
  980|  3.03k|        size_t const nbBits = bitC->bitPos[0] & 0xFF;
  981|  3.03k|        if (bitC->ptr >= bitC->endPtr) return 0; /* overflow detected */
  ------------------
  |  Branch (981:13): [True: 1.01k, False: 2.02k]
  ------------------
  982|  2.02k|        return (size_t)(bitC->ptr - bitC->startPtr) + (nbBits > 0);
  983|  3.03k|    }
  984|  3.03k|}
huf_compress.c:HUF_endMark:
  965|  3.03k|{
  966|  3.03k|    HUF_CElt endMark;
  967|  3.03k|    HUF_setNbBits(&endMark, 1);
  968|  3.03k|    HUF_setValue(&endMark, 1);
  969|  3.03k|    return endMark;
  970|  3.03k|}
huf_compress.c:HUF_compress_internal:
 1342|  3.13k|{
 1343|  3.13k|    HUF_compress_tables_t* const table = (HUF_compress_tables_t*)HUF_alignUpWorkspace(workSpace, &wkspSize, ZSTD_ALIGNOF(size_t));
  ------------------
  |  |  315|  3.13k|#  define ZSTD_ALIGNOF(T) __alignof(T)
  ------------------
 1344|  3.13k|    BYTE* const ostart = (BYTE*)dst;
 1345|  3.13k|    BYTE* const oend = ostart + dstSize;
 1346|  3.13k|    BYTE* op = ostart;
 1347|       |
 1348|  3.13k|    DEBUGLOG(5, "HUF_compress_internal (srcSize=%zu)", srcSize);
  ------------------
  |  |  104|  3.13k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 3.13k]
  |  |  ------------------
  ------------------
 1349|  3.13k|    HUF_STATIC_ASSERT(sizeof(*table) + HUF_WORKSPACE_MAX_ALIGNMENT <= HUF_WORKSPACE_SIZE);
  ------------------
  |  |   42|  3.13k|#define HUF_STATIC_ASSERT(c) DEBUG_STATIC_ASSERT(c)   /* use only *after* variable declarations */
  |  |  ------------------
  |  |  |  |   39|  3.13k|#define DEBUG_STATIC_ASSERT(c) (void)sizeof(char[(c) ? 1 : -1])
  |  |  ------------------
  ------------------
 1350|       |
 1351|       |    /* checks & inits */
 1352|  3.13k|    if (wkspSize < sizeof(*table)) return ERROR(workSpace_tooSmall);
  ------------------
  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1352:9): [True: 0, False: 3.13k]
  ------------------
 1353|  3.13k|    if (!srcSize) return 0;  /* Uncompressed */
  ------------------
  |  Branch (1353:9): [True: 0, False: 3.13k]
  ------------------
 1354|  3.13k|    if (!dstSize) return 0;  /* cannot fit anything within dst budget */
  ------------------
  |  Branch (1354:9): [True: 0, False: 3.13k]
  ------------------
 1355|  3.13k|    if (srcSize > HUF_BLOCKSIZE_MAX) return ERROR(srcSize_wrong);   /* current block size limit */
  ------------------
  |  |   25|  3.13k|#define HUF_BLOCKSIZE_MAX (128 * 1024)   /**< maximum input size for a single block compressed with HUF_compress */
  ------------------
                  if (srcSize > HUF_BLOCKSIZE_MAX) return ERROR(srcSize_wrong);   /* current block size limit */
  ------------------
  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1355:9): [True: 0, False: 3.13k]
  ------------------
 1356|  3.13k|    if (huffLog > HUF_TABLELOG_MAX) return ERROR(tableLog_tooLarge);
  ------------------
  |  |   37|  3.13k|#define HUF_TABLELOG_MAX      12      /* max runtime value of tableLog (due to static allocation); can be modified up to HUF_TABLELOG_ABSOLUTEMAX */
  ------------------
                  if (huffLog > HUF_TABLELOG_MAX) return ERROR(tableLog_tooLarge);
  ------------------
  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1356:9): [True: 0, False: 3.13k]
  ------------------
 1357|  3.13k|    if (maxSymbolValue > HUF_SYMBOLVALUE_MAX) return ERROR(maxSymbolValue_tooLarge);
  ------------------
  |  |   39|  3.13k|#define HUF_SYMBOLVALUE_MAX  255
  ------------------
                  if (maxSymbolValue > HUF_SYMBOLVALUE_MAX) return ERROR(maxSymbolValue_tooLarge);
  ------------------
  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1357:9): [True: 0, False: 3.13k]
  ------------------
 1358|  3.13k|    if (!maxSymbolValue) maxSymbolValue = HUF_SYMBOLVALUE_MAX;
  ------------------
  |  |   39|      0|#define HUF_SYMBOLVALUE_MAX  255
  ------------------
  |  Branch (1358:9): [True: 0, False: 3.13k]
  ------------------
 1359|  3.13k|    if (!huffLog) huffLog = HUF_TABLELOG_DEFAULT;
  ------------------
  |  |   38|      0|#define HUF_TABLELOG_DEFAULT  11      /* default tableLog value when none specified */
  ------------------
  |  Branch (1359:9): [True: 0, False: 3.13k]
  ------------------
 1360|       |
 1361|       |    /* Heuristic : If old table is valid, use it for small inputs */
 1362|  3.13k|    if ((flags & HUF_flags_preferRepeat) && repeat && *repeat == HUF_repeat_valid) {
  ------------------
  |  Branch (1362:9): [True: 192, False: 2.94k]
  |  Branch (1362:45): [True: 192, False: 0]
  |  Branch (1362:55): [True: 0, False: 192]
  ------------------
 1363|      0|        return HUF_compressCTable_internal(ostart, op, oend,
 1364|      0|                                           src, srcSize,
 1365|      0|                                           nbStreams, oldHufTable, flags);
 1366|      0|    }
 1367|       |
 1368|       |    /* If uncompressible data is suspected, do a smaller sampling first */
 1369|  3.13k|    DEBUG_STATIC_ASSERT(SUSPECT_INCOMPRESSIBLE_SAMPLE_RATIO >= 2);
  ------------------
  |  |   39|  3.13k|#define DEBUG_STATIC_ASSERT(c) (void)sizeof(char[(c) ? 1 : -1])
  ------------------
 1370|  3.13k|    if ((flags & HUF_flags_suspectUncompressible) && srcSize >= (SUSPECT_INCOMPRESSIBLE_SAMPLE_SIZE * SUSPECT_INCOMPRESSIBLE_SAMPLE_RATIO)) {
  ------------------
  |  | 1254|  2.55k|#define SUSPECT_INCOMPRESSIBLE_SAMPLE_SIZE 4096
  ------------------
                  if ((flags & HUF_flags_suspectUncompressible) && srcSize >= (SUSPECT_INCOMPRESSIBLE_SAMPLE_SIZE * SUSPECT_INCOMPRESSIBLE_SAMPLE_RATIO)) {
  ------------------
  |  | 1255|  2.55k|#define SUSPECT_INCOMPRESSIBLE_SAMPLE_RATIO 10  /* Must be >= 2 */
  ------------------
  |  Branch (1370:9): [True: 2.55k, False: 584]
  |  Branch (1370:54): [True: 0, False: 2.55k]
  ------------------
 1371|      0|        size_t largestTotal = 0;
 1372|      0|        DEBUGLOG(5, "input suspected incompressible : sampling to check");
  ------------------
  |  |  104|      0|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1373|      0|        {   unsigned maxSymbolValueBegin = maxSymbolValue;
 1374|      0|            CHECK_V_F(largestBegin, HIST_count_simple (table->count, &maxSymbolValueBegin, (const BYTE*)src, SUSPECT_INCOMPRESSIBLE_SAMPLE_SIZE) );
  ------------------
  |  |   58|      0|    size_t const e = f;     \
  |  |   59|      0|    do {                    \
  |  |   60|      0|        if (ERR_isError(e)) \
  |  |  ------------------
  |  |  |  Branch (60:13): [True: 0, False: 0]
  |  |  ------------------
  |  |   61|      0|            return e;       \
  |  |   62|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (62:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1375|      0|            largestTotal += largestBegin;
 1376|      0|        }
 1377|      0|        {   unsigned maxSymbolValueEnd = maxSymbolValue;
 1378|      0|            CHECK_V_F(largestEnd, HIST_count_simple (table->count, &maxSymbolValueEnd, (const BYTE*)src + srcSize - SUSPECT_INCOMPRESSIBLE_SAMPLE_SIZE, SUSPECT_INCOMPRESSIBLE_SAMPLE_SIZE) );
  ------------------
  |  |   58|      0|    size_t const e = f;     \
  |  |   59|      0|    do {                    \
  |  |   60|      0|        if (ERR_isError(e)) \
  |  |  ------------------
  |  |  |  Branch (60:13): [True: 0, False: 0]
  |  |  ------------------
  |  |   61|      0|            return e;       \
  |  |   62|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (62:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1379|      0|            largestTotal += largestEnd;
 1380|      0|        }
 1381|      0|        if (largestTotal <= ((2 * SUSPECT_INCOMPRESSIBLE_SAMPLE_SIZE) >> 7)+4) return 0;   /* heuristic : probably not compressible enough */
  ------------------
  |  | 1254|      0|#define SUSPECT_INCOMPRESSIBLE_SAMPLE_SIZE 4096
  ------------------
  |  Branch (1381:13): [True: 0, False: 0]
  ------------------
 1382|      0|    }
 1383|       |
 1384|       |    /* Scan input and build symbol stats */
 1385|  3.13k|    {   CHECK_V_F(largest, HIST_count_wksp (table->count, &maxSymbolValue, (const BYTE*)src, srcSize, table->wksps.hist_wksp, sizeof(table->wksps.hist_wksp)) );
  ------------------
  |  |   58|  3.13k|    size_t const e = f;     \
  |  |   59|  3.13k|    do {                    \
  |  |   60|  3.13k|        if (ERR_isError(e)) \
  |  |  ------------------
  |  |  |  Branch (60:13): [True: 0, False: 3.13k]
  |  |  ------------------
  |  |   61|  3.13k|            return e;       \
  |  |   62|  3.13k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (62:14): [Folded, False: 3.13k]
  |  |  ------------------
  ------------------
 1386|  3.13k|        if (largest == srcSize) { *ostart = ((const BYTE*)src)[0]; return 1; }   /* single symbol, rle */
  ------------------
  |  Branch (1386:13): [True: 0, False: 3.13k]
  ------------------
 1387|  3.13k|        if (largest <= (srcSize >> 7)+4) return 0;   /* heuristic : probably not compressible enough */
  ------------------
  |  Branch (1387:13): [True: 65, False: 3.07k]
  ------------------
 1388|  3.13k|    }
 1389|  3.07k|    DEBUGLOG(6, "histogram detail completed (%zu symbols)", showU32(table->count, maxSymbolValue+1));
  ------------------
  |  |  104|  3.07k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 3.07k]
  |  |  ------------------
  ------------------
 1390|       |
 1391|       |    /* Check validity of previous table */
 1392|  3.07k|    if ( repeat
  ------------------
  |  Branch (1392:10): [True: 3.07k, False: 0]
  ------------------
 1393|  3.07k|      && *repeat == HUF_repeat_check
  ------------------
  |  Branch (1393:10): [True: 0, False: 3.07k]
  ------------------
 1394|      0|      && !HUF_validateCTable(oldHufTable, table->count, maxSymbolValue)) {
  ------------------
  |  Branch (1394:10): [True: 0, False: 0]
  ------------------
 1395|      0|        *repeat = HUF_repeat_none;
 1396|      0|    }
 1397|       |    /* Heuristic : use existing table for small inputs */
 1398|  3.07k|    if ((flags & HUF_flags_preferRepeat) && repeat && *repeat != HUF_repeat_none) {
  ------------------
  |  Branch (1398:9): [True: 192, False: 2.87k]
  |  Branch (1398:45): [True: 192, False: 0]
  |  Branch (1398:55): [True: 0, False: 192]
  ------------------
 1399|      0|        return HUF_compressCTable_internal(ostart, op, oend,
 1400|      0|                                           src, srcSize,
 1401|      0|                                           nbStreams, oldHufTable, flags);
 1402|      0|    }
 1403|       |
 1404|       |    /* Build Huffman Tree */
 1405|  3.07k|    huffLog = HUF_optimalTableLog(huffLog, srcSize, maxSymbolValue, &table->wksps, sizeof(table->wksps), table->CTable, table->count, flags);
 1406|  3.07k|    {   size_t const maxBits = HUF_buildCTable_wksp(table->CTable, table->count,
 1407|  3.07k|                                            maxSymbolValue, huffLog,
 1408|  3.07k|                                            &table->wksps.buildCTable_wksp, sizeof(table->wksps.buildCTable_wksp));
 1409|  3.07k|        CHECK_F(maxBits);
  ------------------
  |  |   63|  3.07k|#define CHECK_F(f)   do { CHECK_V_F(_var_err__, f); } while (0)
  |  |  ------------------
  |  |  |  |   58|  3.07k|    size_t const e = f;     \
  |  |  |  |   59|  3.07k|    do {                    \
  |  |  |  |   60|  3.07k|        if (ERR_isError(e)) \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (60:13): [True: 0, False: 3.07k]
  |  |  |  |  ------------------
  |  |  |  |   61|  3.07k|            return e;       \
  |  |  |  |   62|  3.07k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (62:14): [Folded, False: 3.07k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (63:62): [Folded, False: 3.07k]
  |  |  ------------------
  ------------------
 1410|  3.07k|        huffLog = (U32)maxBits;
 1411|  3.07k|        DEBUGLOG(6, "bit distribution completed (%zu symbols)", showCTableBits(table->CTable + 1, maxSymbolValue+1));
  ------------------
  |  |  104|  3.07k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 3.07k]
  |  |  ------------------
  ------------------
 1412|  3.07k|    }
 1413|       |
 1414|       |    /* Write table description header */
 1415|  3.07k|    {   CHECK_V_F(hSize, HUF_writeCTable_wksp(op, dstSize, table->CTable, maxSymbolValue, huffLog,
  ------------------
  |  |   58|  3.07k|    size_t const e = f;     \
  |  |   59|  3.07k|    do {                    \
  |  |   60|  3.07k|        if (ERR_isError(e)) \
  |  |  ------------------
  |  |  |  Branch (60:13): [True: 9, False: 3.06k]
  |  |  ------------------
  |  |   61|  3.07k|            return e;       \
  |  |   62|  3.07k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (62:14): [Folded, False: 3.06k]
  |  |  ------------------
  ------------------
 1416|  3.07k|                                              &table->wksps.writeCTable_wksp, sizeof(table->wksps.writeCTable_wksp)) );
 1417|       |        /* Check if using previous huffman table is beneficial */
 1418|  3.06k|        if (repeat && *repeat != HUF_repeat_none) {
  ------------------
  |  Branch (1418:13): [True: 3.06k, False: 0]
  |  Branch (1418:23): [True: 0, False: 3.06k]
  ------------------
 1419|      0|            size_t const oldSize = HUF_estimateCompressedSize(oldHufTable, table->count, maxSymbolValue);
 1420|      0|            size_t const newSize = HUF_estimateCompressedSize(table->CTable, table->count, maxSymbolValue);
 1421|      0|            if (oldSize <= hSize + newSize || hSize + 12 >= srcSize) {
  ------------------
  |  Branch (1421:17): [True: 0, False: 0]
  |  Branch (1421:47): [True: 0, False: 0]
  ------------------
 1422|      0|                return HUF_compressCTable_internal(ostart, op, oend,
 1423|      0|                                                   src, srcSize,
 1424|      0|                                                   nbStreams, oldHufTable, flags);
 1425|      0|        }   }
 1426|       |
 1427|       |        /* Use the new huffman table */
 1428|  3.06k|        if (hSize + 12ul >= srcSize) { return 0; }
  ------------------
  |  Branch (1428:13): [True: 22, False: 3.03k]
  ------------------
 1429|  3.03k|        op += hSize;
 1430|  3.03k|        if (repeat) { *repeat = HUF_repeat_none; }
  ------------------
  |  Branch (1430:13): [True: 3.03k, False: 0]
  ------------------
 1431|  3.03k|        if (oldHufTable)
  ------------------
  |  Branch (1431:13): [True: 3.03k, False: 0]
  ------------------
 1432|  3.03k|            ZSTD_memcpy(oldHufTable, table->CTable, sizeof(table->CTable));  /* Save new table */
  ------------------
  |  |   44|  3.03k|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  ------------------
 1433|  3.03k|    }
 1434|      0|    return HUF_compressCTable_internal(ostart, op, oend,
 1435|  3.03k|                                       src, srcSize,
 1436|  3.03k|                                       nbStreams, table->CTable, flags);
 1437|  3.06k|}
huf_compress.c:HUF_compressCTable_internal:
 1231|  3.03k|{
 1232|  3.03k|    size_t const cSize = (nbStreams==HUF_singleStream) ?
  ------------------
  |  Branch (1232:26): [True: 3.03k, False: 0]
  ------------------
 1233|  3.03k|                         HUF_compress1X_usingCTable_internal(op, (size_t)(oend - op), src, srcSize, CTable, flags) :
 1234|  3.03k|                         HUF_compress4X_usingCTable_internal(op, (size_t)(oend - op), src, srcSize, CTable, flags);
 1235|  3.03k|    if (HUF_isError(cSize)) { return cSize; }
  ------------------
  |  |   41|  3.03k|#define HUF_isError ERR_isError
  ------------------
  |  Branch (1235:9): [True: 0, False: 3.03k]
  ------------------
 1236|  3.03k|    if (cSize==0) { return 0; }   /* uncompressible */
  ------------------
  |  Branch (1236:9): [True: 1.01k, False: 2.02k]
  ------------------
 1237|  2.02k|    op += cSize;
 1238|       |    /* check compressibility */
 1239|  2.02k|    assert(op >= ostart);
  ------------------
  |  |   70|  2.02k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1240|  2.02k|    if ((size_t)(op-ostart) >= srcSize-1) { return 0; }
  ------------------
  |  Branch (1240:9): [True: 154, False: 1.87k]
  ------------------
 1241|  1.87k|    return (size_t)(op-ostart);
 1242|  2.02k|}

ZSTD_createCCtx:
  107|     28|{
  108|     28|    return ZSTD_createCCtx_advanced(ZSTD_defaultCMem);
  109|     28|}
ZSTD_createCCtx_advanced:
  126|     28|{
  127|     28|    ZSTD_STATIC_ASSERT(zcss_init==0);
  ------------------
  |  |   43|     28|#define ZSTD_STATIC_ASSERT(c) DEBUG_STATIC_ASSERT(c)
  |  |  ------------------
  |  |  |  |   39|     28|#define DEBUG_STATIC_ASSERT(c) (void)sizeof(char[(c) ? 1 : -1])
  |  |  ------------------
  ------------------
  128|     28|    ZSTD_STATIC_ASSERT(ZSTD_CONTENTSIZE_UNKNOWN==(0ULL - 1));
  ------------------
  |  |   43|     28|#define ZSTD_STATIC_ASSERT(c) DEBUG_STATIC_ASSERT(c)
  |  |  ------------------
  |  |  |  |   39|     28|#define DEBUG_STATIC_ASSERT(c) (void)sizeof(char[(c) ? 1 : -1])
  |  |  ------------------
  ------------------
  129|     28|    if ((!customMem.customAlloc) ^ (!customMem.customFree)) return NULL;
  ------------------
  |  Branch (129:9): [True: 0, False: 28]
  ------------------
  130|     28|    {   ZSTD_CCtx* const cctx = (ZSTD_CCtx*)ZSTD_customMalloc(sizeof(ZSTD_CCtx), customMem);
  131|     28|        if (!cctx) return NULL;
  ------------------
  |  Branch (131:13): [True: 0, False: 28]
  ------------------
  132|     28|        ZSTD_initCCtx(cctx, customMem);
  133|     28|        return cctx;
  134|     28|    }
  135|     28|}
ZSTD_freeCCtx:
  195|     28|{
  196|     28|    DEBUGLOG(3, "ZSTD_freeCCtx (address: %p)", (void*)cctx);
  ------------------
  |  |  104|     28|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 28]
  |  |  ------------------
  ------------------
  197|     28|    if (cctx==NULL) return 0;   /* support free on NULL */
  ------------------
  |  Branch (197:9): [True: 0, False: 28]
  ------------------
  198|     28|    RETURN_ERROR_IF(cctx->staticSize, memory_allocation,
  ------------------
  |  |  114|     28|    do {                                                                       \
  |  |  115|     28|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 0, False: 28]
  |  |  ------------------
  |  |  116|      0|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|      0|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|      0|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|      0|    do {                                           \
  |  |  |  |   99|      0|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|      0|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|      0|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|      0|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|      0|        }                                                                      \
  |  |  123|     28|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 28]
  |  |  ------------------
  ------------------
  199|     28|                    "not compatible with static CCtx");
  200|     28|    {   int cctxInWorkspace = ZSTD_cwksp_owns_buffer(&cctx->workspace, cctx);
  201|     28|        ZSTD_freeCCtxContent(cctx);
  202|     28|        if (!cctxInWorkspace) ZSTD_customFree(cctx, cctx->customMem);
  ------------------
  |  Branch (202:13): [True: 28, False: 0]
  ------------------
  203|     28|    }
  204|     28|    return 0;
  205|     28|}
ZSTD_sizeof_CCtx:
  220|  2.89k|{
  221|  2.89k|    if (cctx==NULL) return 0;   /* support sizeof on NULL */
  ------------------
  |  Branch (221:9): [True: 0, False: 2.89k]
  ------------------
  222|       |    /* cctx may be in the workspace */
  223|  2.89k|    return (cctx->workspace.workspace == cctx ? 0 : sizeof(*cctx))
  ------------------
  |  Branch (223:13): [True: 0, False: 2.89k]
  ------------------
  224|  2.89k|           + ZSTD_cwksp_sizeof(&cctx->workspace)
  225|  2.89k|           + ZSTD_sizeof_localDict(cctx->localDict)
  226|  2.89k|           + ZSTD_sizeof_mtctx(cctx);
  227|  2.89k|}
ZSTD_CCtxParams_reset:
  375|     28|{
  376|     28|    return ZSTD_CCtxParams_init(params, ZSTD_CLEVEL_DEFAULT);
  ------------------
  |  |  134|     28|#  define ZSTD_CLEVEL_DEFAULT 3
  ------------------
  377|     28|}
ZSTD_CCtxParams_init:
  379|     28|size_t ZSTD_CCtxParams_init(ZSTD_CCtx_params* cctxParams, int compressionLevel) {
  380|     28|    RETURN_ERROR_IF(!cctxParams, GENERIC, "NULL pointer!");
  ------------------
  |  |  114|     28|    do {                                                                       \
  |  |  115|     28|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 0, False: 28]
  |  |  ------------------
  |  |  116|      0|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|      0|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|      0|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|      0|    do {                                           \
  |  |  |  |   99|      0|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|      0|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|      0|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|      0|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|      0|        }                                                                      \
  |  |  123|     28|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 28]
  |  |  ------------------
  ------------------
  381|     28|    ZSTD_memset(cctxParams, 0, sizeof(*cctxParams));
  ------------------
  |  |   46|     28|# define ZSTD_memset(p,v,l) __builtin_memset((p),(v),(l))
  ------------------
  382|     28|    cctxParams->compressionLevel = compressionLevel;
  383|     28|    cctxParams->fParams.contentSizeFlag = 1;
  384|     28|    return 0;
  385|     28|}
ZSTD_CCtx_reset:
 1405|     28|{
 1406|     28|    if ( (reset == ZSTD_reset_session_only)
  ------------------
  |  Branch (1406:10): [True: 0, False: 28]
  ------------------
 1407|     28|      || (reset == ZSTD_reset_session_and_parameters) ) {
  ------------------
  |  Branch (1407:10): [True: 0, False: 28]
  ------------------
 1408|       |#ifdef ZSTD_MULTITHREAD
 1409|       |        /* jobs of an abandoned frame may still reference the dictionary */
 1410|       |        if (cctx->mtctx != NULL) ZSTDMT_waitForPendingJobs(cctx->mtctx);
 1411|       |#endif
 1412|      0|        cctx->streamStage = zcss_init;
 1413|      0|        cctx->pledgedSrcSizePlusOne = 0;
 1414|      0|        cctx->stableIn_notConsumed = 0;  /* input pending in the abandoned frame */
 1415|      0|    }
 1416|     28|    if ( (reset == ZSTD_reset_parameters)
  ------------------
  |  Branch (1416:10): [True: 28, False: 0]
  ------------------
 1417|     28|      || (reset == ZSTD_reset_session_and_parameters) ) {
  ------------------
  |  Branch (1417:10): [True: 0, False: 0]
  ------------------
 1418|     28|        RETURN_ERROR_IF(cctx->streamStage != zcss_init, stage_wrong,
  ------------------
  |  |  114|     28|    do {                                                                       \
  |  |  115|     28|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 0, False: 28]
  |  |  ------------------
  |  |  116|      0|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|      0|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|      0|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|      0|    do {                                           \
  |  |  |  |   99|      0|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|      0|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|      0|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|      0|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|      0|        }                                                                      \
  |  |  123|     28|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 28]
  |  |  ------------------
  ------------------
 1419|     28|                        "Reset parameters is only possible during init stage.");
 1420|     28|        ZSTD_clearAllDicts(cctx);
 1421|     28|        return ZSTD_CCtxParams_reset(&cctx->requestedParams);
 1422|     28|    }
 1423|      0|    return 0;
 1424|     28|}
ZSTD_cycleLog:
 1468|  8.71k|{
 1469|  8.71k|    U32 const btScale = ((U32)strat >= (U32)ZSTD_btlazy2);
 1470|  8.71k|    return hashLog - btScale;
 1471|  8.71k|}
ZSTD_reset_compressedBlockState:
 1969|  4.36k|{
 1970|  4.36k|    int i;
 1971|  17.4k|    for (i = 0; i < ZSTD_REP_NUM; ++i)
  ------------------
  |  |   64|  17.4k|#define ZSTD_REP_NUM      3                 /* number of repcodes */
  ------------------
  |  Branch (1971:17): [True: 13.0k, False: 4.36k]
  ------------------
 1972|  13.0k|        bs->rep[i] = repStartValue[i];
 1973|  4.36k|    bs->entropy.huf.repeatMode = HUF_repeat_none;
 1974|  4.36k|    bs->entropy.fse.offcode_repeatMode = FSE_repeat_none;
 1975|  4.36k|    bs->entropy.fse.matchlength_repeatMode = FSE_repeat_none;
 1976|  4.36k|    bs->entropy.fse.litlength_repeatMode = FSE_repeat_none;
 1977|  4.36k|}
ZSTD_seqToCodes:
 2662|  2.81k|{
 2663|  2.81k|    const SeqDef* const sequences = seqStorePtr->sequencesStart;
 2664|  2.81k|    BYTE* const llCodeTable = seqStorePtr->llCode;
 2665|  2.81k|    BYTE* const ofCodeTable = seqStorePtr->ofCode;
 2666|  2.81k|    BYTE* const mlCodeTable = seqStorePtr->mlCode;
 2667|  2.81k|    U32 const nbSeq = (U32)(seqStorePtr->sequences - seqStorePtr->sequencesStart);
 2668|  2.81k|    U32 u;
 2669|  2.81k|    int longOffsets = 0;
 2670|  2.81k|    assert(nbSeq <= seqStorePtr->maxNbSeq);
  ------------------
  |  |   70|  2.81k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 2671|  15.8k|    for (u=0; u<nbSeq; u++) {
  ------------------
  |  Branch (2671:15): [True: 13.0k, False: 2.81k]
  ------------------
 2672|  13.0k|        U32 const llv = sequences[u].litLength;
 2673|  13.0k|        U32 const ofCode = ZSTD_highbit32(sequences[u].offBase);
 2674|  13.0k|        U32 const mlv = sequences[u].mlBase;
 2675|  13.0k|        llCodeTable[u] = (BYTE)ZSTD_LLcode(llv);
 2676|  13.0k|        ofCodeTable[u] = (BYTE)ofCode;
 2677|  13.0k|        mlCodeTable[u] = (BYTE)ZSTD_MLcode(mlv);
 2678|  13.0k|        assert(!(MEM_64bits() && ofCode >= STREAM_ACCUMULATOR_MIN));
  ------------------
  |  |   70|  13.0k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 2679|  13.0k|        if (MEM_32bits() && ofCode >= STREAM_ACCUMULATOR_MIN)
  ------------------
  |  |   45|      0|#define STREAM_ACCUMULATOR_MIN    ((U32)(MEM_32bits() ? STREAM_ACCUMULATOR_MIN_32 : STREAM_ACCUMULATOR_MIN_64))
  |  |  ------------------
  |  |  |  |   43|      0|#define STREAM_ACCUMULATOR_MIN_32  25
  |  |  ------------------
  |  |               #define STREAM_ACCUMULATOR_MIN    ((U32)(MEM_32bits() ? STREAM_ACCUMULATOR_MIN_32 : STREAM_ACCUMULATOR_MIN_64))
  |  |  ------------------
  |  |  |  |   44|      0|#define STREAM_ACCUMULATOR_MIN_64  57
  |  |  ------------------
  |  |  |  Branch (45:42): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (2679:13): [True: 0, False: 13.0k]
  |  Branch (2679:29): [True: 0, False: 0]
  ------------------
 2680|      0|            longOffsets = 1;
 2681|  13.0k|    }
 2682|  2.81k|    if (seqStorePtr->longLengthType==ZSTD_llt_literalLength)
  ------------------
  |  Branch (2682:9): [True: 0, False: 2.81k]
  ------------------
 2683|      0|        llCodeTable[seqStorePtr->longLengthPos] = MaxLL;
  ------------------
  |  |  104|      0|#define MaxLL   35
  ------------------
 2684|  2.81k|    if (seqStorePtr->longLengthType==ZSTD_llt_matchLength)
  ------------------
  |  Branch (2684:9): [True: 0, False: 2.81k]
  ------------------
 2685|      0|        mlCodeTable[seqStorePtr->longLengthPos] = MaxML;
  ------------------
  |  |  103|      0|#define MaxML   52
  ------------------
 2686|  2.81k|    return longOffsets;
 2687|  2.81k|}
ZSTD_selectBlockCompressor:
 3038|  4.35k|{
 3039|  4.35k|    static const ZSTD_BlockCompressor_f blockCompressor[4][ZSTD_STRATEGY_MAX+1] = {
 3040|  4.35k|        { ZSTD_compressBlock_fast  /* default for 0 */,
 3041|  4.35k|          ZSTD_compressBlock_fast,
 3042|  4.35k|          ZSTD_COMPRESSBLOCK_DOUBLEFAST,
  ------------------
  |  |   33|  4.35k|#define ZSTD_COMPRESSBLOCK_DOUBLEFAST ZSTD_compressBlock_doubleFast
  ------------------
 3043|  4.35k|          ZSTD_COMPRESSBLOCK_GREEDY,
  ------------------
  |  |   64|  4.35k|#define ZSTD_COMPRESSBLOCK_GREEDY ZSTD_compressBlock_greedy
  ------------------
 3044|  4.35k|          ZSTD_COMPRESSBLOCK_LAZY,
  ------------------
  |  |  109|  4.35k|#define ZSTD_COMPRESSBLOCK_LAZY ZSTD_compressBlock_lazy
  ------------------
 3045|  4.35k|          ZSTD_COMPRESSBLOCK_LAZY2,
  ------------------
  |  |  154|  4.35k|#define ZSTD_COMPRESSBLOCK_LAZY2 ZSTD_compressBlock_lazy2
  ------------------
 3046|  4.35k|          ZSTD_COMPRESSBLOCK_BTLAZY2,
  ------------------
  |  |  184|  4.35k|#define ZSTD_COMPRESSBLOCK_BTLAZY2 ZSTD_compressBlock_btlazy2
  ------------------
 3047|  4.35k|          ZSTD_COMPRESSBLOCK_BTOPT,
  ------------------
  |  |   34|  4.35k|#define ZSTD_COMPRESSBLOCK_BTOPT ZSTD_compressBlock_btopt
  ------------------
 3048|  4.35k|          ZSTD_COMPRESSBLOCK_BTULTRA,
  ------------------
  |  |   61|  4.35k|#define ZSTD_COMPRESSBLOCK_BTULTRA ZSTD_compressBlock_btultra
  ------------------
 3049|  4.35k|          ZSTD_COMPRESSBLOCK_BTULTRA2
  ------------------
  |  |   64|  4.35k|#define ZSTD_COMPRESSBLOCK_BTULTRA2 ZSTD_compressBlock_btultra2
  ------------------
 3050|  4.35k|        },
 3051|  4.35k|        { ZSTD_compressBlock_fast_extDict  /* default for 0 */,
 3052|  4.35k|          ZSTD_compressBlock_fast_extDict,
 3053|  4.35k|          ZSTD_COMPRESSBLOCK_DOUBLEFAST_EXTDICT,
  ------------------
  |  |   35|  4.35k|#define ZSTD_COMPRESSBLOCK_DOUBLEFAST_EXTDICT ZSTD_compressBlock_doubleFast_extDict
  ------------------
 3054|  4.35k|          ZSTD_COMPRESSBLOCK_GREEDY_EXTDICT,
  ------------------
  |  |   70|  4.35k|#define ZSTD_COMPRESSBLOCK_GREEDY_EXTDICT ZSTD_compressBlock_greedy_extDict
  ------------------
 3055|  4.35k|          ZSTD_COMPRESSBLOCK_LAZY_EXTDICT,
  ------------------
  |  |  115|  4.35k|#define ZSTD_COMPRESSBLOCK_LAZY_EXTDICT ZSTD_compressBlock_lazy_extDict
  ------------------
 3056|  4.35k|          ZSTD_COMPRESSBLOCK_LAZY2_EXTDICT,
  ------------------
  |  |  160|  4.35k|#define ZSTD_COMPRESSBLOCK_LAZY2_EXTDICT ZSTD_compressBlock_lazy2_extDict
  ------------------
 3057|  4.35k|          ZSTD_COMPRESSBLOCK_BTLAZY2_EXTDICT,
  ------------------
  |  |  186|  4.35k|#define ZSTD_COMPRESSBLOCK_BTLAZY2_EXTDICT ZSTD_compressBlock_btlazy2_extDict
  ------------------
 3058|  4.35k|          ZSTD_COMPRESSBLOCK_BTOPT_EXTDICT,
  ------------------
  |  |   36|  4.35k|#define ZSTD_COMPRESSBLOCK_BTOPT_EXTDICT ZSTD_compressBlock_btopt_extDict
  ------------------
 3059|  4.35k|          ZSTD_COMPRESSBLOCK_BTULTRA_EXTDICT,
  ------------------
  |  |   63|  4.35k|#define ZSTD_COMPRESSBLOCK_BTULTRA_EXTDICT ZSTD_compressBlock_btultra_extDict
  ------------------
 3060|  4.35k|          ZSTD_COMPRESSBLOCK_BTULTRA_EXTDICT
  ------------------
  |  |   63|  4.35k|#define ZSTD_COMPRESSBLOCK_BTULTRA_EXTDICT ZSTD_compressBlock_btultra_extDict
  ------------------
 3061|  4.35k|        },
 3062|  4.35k|        { ZSTD_compressBlock_fast_dictMatchState  /* default for 0 */,
 3063|  4.35k|          ZSTD_compressBlock_fast_dictMatchState,
 3064|  4.35k|          ZSTD_COMPRESSBLOCK_DOUBLEFAST_DICTMATCHSTATE,
  ------------------
  |  |   34|  4.35k|#define ZSTD_COMPRESSBLOCK_DOUBLEFAST_DICTMATCHSTATE ZSTD_compressBlock_doubleFast_dictMatchState
  ------------------
 3065|  4.35k|          ZSTD_COMPRESSBLOCK_GREEDY_DICTMATCHSTATE,
  ------------------
  |  |   66|  4.35k|#define ZSTD_COMPRESSBLOCK_GREEDY_DICTMATCHSTATE ZSTD_compressBlock_greedy_dictMatchState
  ------------------
 3066|  4.35k|          ZSTD_COMPRESSBLOCK_LAZY_DICTMATCHSTATE,
  ------------------
  |  |  111|  4.35k|#define ZSTD_COMPRESSBLOCK_LAZY_DICTMATCHSTATE ZSTD_compressBlock_lazy_dictMatchState
  ------------------
 3067|  4.35k|          ZSTD_COMPRESSBLOCK_LAZY2_DICTMATCHSTATE,
  ------------------
  |  |  156|  4.35k|#define ZSTD_COMPRESSBLOCK_LAZY2_DICTMATCHSTATE ZSTD_compressBlock_lazy2_dictMatchState
  ------------------
 3068|  4.35k|          ZSTD_COMPRESSBLOCK_BTLAZY2_DICTMATCHSTATE,
  ------------------
  |  |  185|  4.35k|#define ZSTD_COMPRESSBLOCK_BTLAZY2_DICTMATCHSTATE ZSTD_compressBlock_btlazy2_dictMatchState
  ------------------
 3069|  4.35k|          ZSTD_COMPRESSBLOCK_BTOPT_DICTMATCHSTATE,
  ------------------
  |  |   35|  4.35k|#define ZSTD_COMPRESSBLOCK_BTOPT_DICTMATCHSTATE ZSTD_compressBlock_btopt_dictMatchState
  ------------------
 3070|  4.35k|          ZSTD_COMPRESSBLOCK_BTULTRA_DICTMATCHSTATE,
  ------------------
  |  |   62|  4.35k|#define ZSTD_COMPRESSBLOCK_BTULTRA_DICTMATCHSTATE ZSTD_compressBlock_btultra_dictMatchState
  ------------------
 3071|  4.35k|          ZSTD_COMPRESSBLOCK_BTULTRA_DICTMATCHSTATE
  ------------------
  |  |   62|  4.35k|#define ZSTD_COMPRESSBLOCK_BTULTRA_DICTMATCHSTATE ZSTD_compressBlock_btultra_dictMatchState
  ------------------
 3072|  4.35k|        },
 3073|  4.35k|        { NULL  /* default for 0 */,
 3074|  4.35k|          NULL,
 3075|  4.35k|          NULL,
 3076|  4.35k|          ZSTD_COMPRESSBLOCK_GREEDY_DEDICATEDDICTSEARCH,
  ------------------
  |  |   68|  4.35k|#define ZSTD_COMPRESSBLOCK_GREEDY_DEDICATEDDICTSEARCH ZSTD_compressBlock_greedy_dedicatedDictSearch
  ------------------
 3077|  4.35k|          ZSTD_COMPRESSBLOCK_LAZY_DEDICATEDDICTSEARCH,
  ------------------
  |  |  113|  4.35k|#define ZSTD_COMPRESSBLOCK_LAZY_DEDICATEDDICTSEARCH ZSTD_compressBlock_lazy_dedicatedDictSearch
  ------------------
 3078|  4.35k|          ZSTD_COMPRESSBLOCK_LAZY2_DEDICATEDDICTSEARCH,
  ------------------
  |  |  158|  4.35k|#define ZSTD_COMPRESSBLOCK_LAZY2_DEDICATEDDICTSEARCH ZSTD_compressBlock_lazy2_dedicatedDictSearch
  ------------------
 3079|  4.35k|          NULL,
 3080|  4.35k|          NULL,
 3081|  4.35k|          NULL,
 3082|  4.35k|          NULL }
 3083|  4.35k|    };
 3084|  4.35k|    ZSTD_BlockCompressor_f selectedCompressor;
 3085|  4.35k|    ZSTD_STATIC_ASSERT((unsigned)ZSTD_fast == 1);
  ------------------
  |  |   43|  4.35k|#define ZSTD_STATIC_ASSERT(c) DEBUG_STATIC_ASSERT(c)
  |  |  ------------------
  |  |  |  |   39|  4.35k|#define DEBUG_STATIC_ASSERT(c) (void)sizeof(char[(c) ? 1 : -1])
  |  |  ------------------
  ------------------
 3086|       |
 3087|  4.35k|    assert(ZSTD_cParam_withinBounds(ZSTD_c_strategy, (int)strat));
  ------------------
  |  |   70|  4.35k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 3088|  4.35k|    DEBUGLOG(5, "Selected block compressor: dictMode=%d strat=%d rowMatchfinder=%d", (int)dictMode, (int)strat, (int)useRowMatchFinder);
  ------------------
  |  |  104|  4.35k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 4.35k]
  |  |  ------------------
  ------------------
 3089|  4.35k|    if (ZSTD_rowMatchFinderUsed(strat, useRowMatchFinder)) {
  ------------------
  |  Branch (3089:9): [True: 0, False: 4.35k]
  ------------------
 3090|      0|        static const ZSTD_BlockCompressor_f rowBasedBlockCompressors[4][3] = {
 3091|      0|            {
 3092|      0|                ZSTD_COMPRESSBLOCK_GREEDY_ROW,
  ------------------
  |  |   65|      0|#define ZSTD_COMPRESSBLOCK_GREEDY_ROW ZSTD_compressBlock_greedy_row
  ------------------
 3093|      0|                ZSTD_COMPRESSBLOCK_LAZY_ROW,
  ------------------
  |  |  110|      0|#define ZSTD_COMPRESSBLOCK_LAZY_ROW ZSTD_compressBlock_lazy_row
  ------------------
 3094|      0|                ZSTD_COMPRESSBLOCK_LAZY2_ROW
  ------------------
  |  |  155|      0|#define ZSTD_COMPRESSBLOCK_LAZY2_ROW ZSTD_compressBlock_lazy2_row
  ------------------
 3095|      0|            },
 3096|      0|            {
 3097|      0|                ZSTD_COMPRESSBLOCK_GREEDY_EXTDICT_ROW,
  ------------------
  |  |   71|      0|#define ZSTD_COMPRESSBLOCK_GREEDY_EXTDICT_ROW ZSTD_compressBlock_greedy_extDict_row
  ------------------
 3098|      0|                ZSTD_COMPRESSBLOCK_LAZY_EXTDICT_ROW,
  ------------------
  |  |  116|      0|#define ZSTD_COMPRESSBLOCK_LAZY_EXTDICT_ROW ZSTD_compressBlock_lazy_extDict_row
  ------------------
 3099|      0|                ZSTD_COMPRESSBLOCK_LAZY2_EXTDICT_ROW
  ------------------
  |  |  161|      0|#define ZSTD_COMPRESSBLOCK_LAZY2_EXTDICT_ROW ZSTD_compressBlock_lazy2_extDict_row
  ------------------
 3100|      0|            },
 3101|      0|            {
 3102|      0|                ZSTD_COMPRESSBLOCK_GREEDY_DICTMATCHSTATE_ROW,
  ------------------
  |  |   67|      0|#define ZSTD_COMPRESSBLOCK_GREEDY_DICTMATCHSTATE_ROW ZSTD_compressBlock_greedy_dictMatchState_row
  ------------------
 3103|      0|                ZSTD_COMPRESSBLOCK_LAZY_DICTMATCHSTATE_ROW,
  ------------------
  |  |  112|      0|#define ZSTD_COMPRESSBLOCK_LAZY_DICTMATCHSTATE_ROW ZSTD_compressBlock_lazy_dictMatchState_row
  ------------------
 3104|      0|                ZSTD_COMPRESSBLOCK_LAZY2_DICTMATCHSTATE_ROW
  ------------------
  |  |  157|      0|#define ZSTD_COMPRESSBLOCK_LAZY2_DICTMATCHSTATE_ROW ZSTD_compressBlock_lazy2_dictMatchState_row
  ------------------
 3105|      0|            },
 3106|      0|            {
 3107|      0|                ZSTD_COMPRESSBLOCK_GREEDY_DEDICATEDDICTSEARCH_ROW,
  ------------------
  |  |   69|      0|#define ZSTD_COMPRESSBLOCK_GREEDY_DEDICATEDDICTSEARCH_ROW ZSTD_compressBlock_greedy_dedicatedDictSearch_row
  ------------------
 3108|      0|                ZSTD_COMPRESSBLOCK_LAZY_DEDICATEDDICTSEARCH_ROW,
  ------------------
  |  |  114|      0|#define ZSTD_COMPRESSBLOCK_LAZY_DEDICATEDDICTSEARCH_ROW ZSTD_compressBlock_lazy_dedicatedDictSearch_row
  ------------------
 3109|      0|                ZSTD_COMPRESSBLOCK_LAZY2_DEDICATEDDICTSEARCH_ROW
  ------------------
  |  |  159|      0|#define ZSTD_COMPRESSBLOCK_LAZY2_DEDICATEDDICTSEARCH_ROW ZSTD_compressBlock_lazy2_dedicatedDictSearch_row
  ------------------
 3110|      0|            }
 3111|      0|        };
 3112|      0|        DEBUGLOG(5, "Selecting a row-based matchfinder");
  ------------------
  |  |  104|      0|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 0]
  |  |  ------------------
  ------------------
 3113|      0|        assert(useRowMatchFinder != ZSTD_ps_auto);
  ------------------
  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 3114|      0|        selectedCompressor = rowBasedBlockCompressors[(int)dictMode][(int)strat - (int)ZSTD_greedy];
 3115|  4.35k|    } else {
 3116|  4.35k|        selectedCompressor = blockCompressor[(int)dictMode][(int)strat];
 3117|  4.35k|    }
 3118|  4.35k|    assert(selectedCompressor != NULL);
  ------------------
  |  |   70|  4.35k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 3119|  4.35k|    return selectedCompressor;
 3120|  4.35k|}
ZSTD_resetSeqStore:
 3130|  4.67k|{
 3131|  4.67k|    ssPtr->lit = ssPtr->litStart;
 3132|  4.67k|    ssPtr->sequences = ssPtr->sequencesStart;
 3133|  4.67k|    ssPtr->longLengthType = ZSTD_llt_none;
 3134|  4.67k|}
ZSTD_sequenceBound:
 3482|  4.36k|size_t ZSTD_sequenceBound(size_t srcSize) {
 3483|  4.36k|    const size_t maxNbSeq = (srcSize / ZSTD_MINMATCH_MIN) + 1;
  ------------------
  |  | 1376|  4.36k|#define ZSTD_MINMATCH_MIN         3   /* only for ZSTD_btopt+, faster strategies are limited to 4 */
  ------------------
 3484|  4.36k|    const size_t maxNbDelims = (srcSize / ZSTD_BLOCKSIZE_MAX_MIN) + 1;
  ------------------
  |  | 1381|  4.36k|#define ZSTD_BLOCKSIZE_MAX_MIN (1 << 10) /* The minimum valid max blocksize. Maximum blocksizes smaller than this make compressBound() inaccurate. */
  ------------------
 3485|  4.36k|    return maxNbSeq + maxNbDelims;
 3486|  4.36k|}
ZSTD_referenceExternalSequences:
 4752|  4.36k|{
 4753|  4.36k|    assert(cctx->stage == ZSTDcs_init);
  ------------------
  |  |   70|  4.36k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 4754|  4.36k|    assert(nbSeq == 0 || cctx->appliedParams.ldmParams.enableLdm != ZSTD_ps_enable);
  ------------------
  |  |   70|  4.36k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 4755|  4.36k|    cctx->externSeqStore.seq = seq;
 4756|  4.36k|    cctx->externSeqStore.size = nbSeq;
 4757|  4.36k|    cctx->externSeqStore.capacity = nbSeq;
 4758|  4.36k|    cctx->externSeqStore.pos = 0;
 4759|  4.36k|    cctx->externSeqStore.posInSequence = 0;
 4760|  4.36k|}
ZSTD_CCtx_trace:
 5374|  2.90k|{
 5375|  2.90k|#if ZSTD_TRACE
 5376|  2.90k|    if (cctx->traceCtx && ZSTD_trace_compress_end != NULL) {
  ------------------
  |  Branch (5376:9): [True: 0, False: 2.90k]
  |  Branch (5376:27): [True: 0, False: 0]
  ------------------
 5377|      0|        int const streaming = cctx->inBuffSize > 0 || cctx->outBuffSize > 0 || cctx->appliedParams.nbWorkers > 0;
  ------------------
  |  Branch (5377:31): [True: 0, False: 0]
  |  Branch (5377:55): [True: 0, False: 0]
  |  Branch (5377:80): [True: 0, False: 0]
  ------------------
 5378|      0|        ZSTD_Trace trace;
 5379|      0|        ZSTD_memset(&trace, 0, sizeof(trace));
  ------------------
  |  |   46|      0|# define ZSTD_memset(p,v,l) __builtin_memset((p),(v),(l))
  ------------------
 5380|      0|        trace.version = ZSTD_VERSION_NUMBER;
  ------------------
  |  |  115|      0|#define ZSTD_VERSION_NUMBER  (ZSTD_VERSION_MAJOR *100*100 + ZSTD_VERSION_MINOR *100 + ZSTD_VERSION_RELEASE)
  |  |  ------------------
  |  |  |  |  112|      0|#define ZSTD_VERSION_MAJOR    1
  |  |  ------------------
  |  |               #define ZSTD_VERSION_NUMBER  (ZSTD_VERSION_MAJOR *100*100 + ZSTD_VERSION_MINOR *100 + ZSTD_VERSION_RELEASE)
  |  |  ------------------
  |  |  |  |  113|      0|#define ZSTD_VERSION_MINOR    6
  |  |  ------------------
  |  |               #define ZSTD_VERSION_NUMBER  (ZSTD_VERSION_MAJOR *100*100 + ZSTD_VERSION_MINOR *100 + ZSTD_VERSION_RELEASE)
  |  |  ------------------
  |  |  |  |  114|      0|#define ZSTD_VERSION_RELEASE  0
  |  |  ------------------
  ------------------
 5381|      0|        trace.streaming = streaming;
 5382|      0|        trace.dictionaryID = cctx->dictID;
 5383|      0|        trace.dictionarySize = cctx->dictContentSize;
 5384|      0|        trace.uncompressedSize = cctx->consumedSrcSize;
 5385|      0|        trace.compressedSize = cctx->producedCSize + extraCSize;
 5386|      0|        trace.params = &cctx->appliedParams;
 5387|      0|        trace.cctx = cctx;
 5388|      0|        ZSTD_trace_compress_end(cctx->traceCtx, &trace);
 5389|      0|    }
 5390|  2.90k|    cctx->traceCtx = 0;
 5391|       |#else
 5392|       |    (void)cctx;
 5393|       |    (void)extraCSize;
 5394|       |#endif
 5395|  2.90k|}
ZSTD_compressEnd_public:
 5400|  4.36k|{
 5401|  4.36k|    size_t endResult;
 5402|  4.36k|    size_t const cSize = ZSTD_compressContinue_internal(cctx,
 5403|  4.36k|                                dst, dstCapacity, src, srcSize,
 5404|  4.36k|                                1 /* frame mode */, 1 /* last chunk */);
 5405|  4.36k|    FORWARD_IF_ERROR(cSize, "ZSTD_compressContinue_internal failed");
  ------------------
  |  |  146|  4.36k|    do {                                                                           \
  |  |  147|  4.36k|        size_t const err_code = (err);                                             \
  |  |  148|  4.36k|        if (ERR_isError(err_code)) {                                               \
  |  |  ------------------
  |  |  |  Branch (148:13): [True: 1.46k, False: 2.90k]
  |  |  ------------------
  |  |  149|  1.46k|            RAWLOG(3, "%s:%d: ERROR!: forwarding error in %s: %s",                 \
  |  |  ------------------
  |  |  |  |  103|  1.46k|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 1.46k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  150|  1.46k|                  __FILE__, __LINE__, ERR_QUOTE(err), ERR_getErrorName(err_code)); \
  |  |  151|  1.46k|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                                 \
  |  |  ------------------
  |  |  |  |   98|  1.46k|    do {                                           \
  |  |  |  |   99|  1.46k|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 1.46k]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|  1.46k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 1.46k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  152|  1.46k|            RAWLOG(3, ": " __VA_ARGS__);                                           \
  |  |  ------------------
  |  |  |  |  103|  1.46k|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 1.46k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  153|  1.46k|            RAWLOG(3, "\n");                                                       \
  |  |  ------------------
  |  |  |  |  103|  1.46k|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 1.46k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  154|  1.46k|            return err_code;                                                       \
  |  |  155|  1.46k|        }                                                                          \
  |  |  156|  4.36k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (156:13): [Folded, False: 2.90k]
  |  |  ------------------
  ------------------
 5406|  2.90k|    endResult = ZSTD_writeEpilogue(cctx, (char*)dst + cSize, dstCapacity-cSize);
 5407|  2.90k|    FORWARD_IF_ERROR(endResult, "ZSTD_writeEpilogue failed");
  ------------------
  |  |  146|  2.90k|    do {                                                                           \
  |  |  147|  2.90k|        size_t const err_code = (err);                                             \
  |  |  148|  2.90k|        if (ERR_isError(err_code)) {                                               \
  |  |  ------------------
  |  |  |  Branch (148:13): [True: 0, False: 2.90k]
  |  |  ------------------
  |  |  149|      0|            RAWLOG(3, "%s:%d: ERROR!: forwarding error in %s: %s",                 \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  150|      0|                  __FILE__, __LINE__, ERR_QUOTE(err), ERR_getErrorName(err_code)); \
  |  |  151|      0|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                                 \
  |  |  ------------------
  |  |  |  |   98|      0|    do {                                           \
  |  |  |  |   99|      0|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  152|      0|            RAWLOG(3, ": " __VA_ARGS__);                                           \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  153|      0|            RAWLOG(3, "\n");                                                       \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  154|      0|            return err_code;                                                       \
  |  |  155|      0|        }                                                                          \
  |  |  156|  2.90k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (156:13): [Folded, False: 2.90k]
  |  |  ------------------
  ------------------
 5408|  2.90k|    assert(!(cctx->appliedParams.fParams.contentSizeFlag && cctx->pledgedSrcSizePlusOne == 0));
  ------------------
  |  |   70|  2.90k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 5409|  2.90k|    if (cctx->pledgedSrcSizePlusOne != 0) {  /* control src size */
  ------------------
  |  Branch (5409:9): [True: 2.90k, False: 0]
  ------------------
 5410|  2.90k|        ZSTD_STATIC_ASSERT(ZSTD_CONTENTSIZE_UNKNOWN == (unsigned long long)-1);
  ------------------
  |  |   43|  2.90k|#define ZSTD_STATIC_ASSERT(c) DEBUG_STATIC_ASSERT(c)
  |  |  ------------------
  |  |  |  |   39|  2.90k|#define DEBUG_STATIC_ASSERT(c) (void)sizeof(char[(c) ? 1 : -1])
  |  |  ------------------
  ------------------
 5411|  2.90k|        DEBUGLOG(4, "end of frame : controlling src size");
  ------------------
  |  |  104|  2.90k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 2.90k]
  |  |  ------------------
  ------------------
 5412|  2.90k|        RETURN_ERROR_IF(
  ------------------
  |  |  114|  2.90k|    do {                                                                       \
  |  |  115|  2.90k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 0, False: 2.90k]
  |  |  ------------------
  |  |  116|      0|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|      0|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|      0|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|      0|    do {                                           \
  |  |  |  |   99|      0|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|      0|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|      0|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|      0|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|      0|        }                                                                      \
  |  |  123|  2.90k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 2.90k]
  |  |  ------------------
  ------------------
 5413|  2.90k|            cctx->pledgedSrcSizePlusOne != cctx->consumedSrcSize+1,
 5414|  2.90k|            srcSize_wrong,
 5415|  2.90k|             "error : pledgedSrcSize = %u, while realSrcSize = %u",
 5416|  2.90k|            (unsigned)cctx->pledgedSrcSizePlusOne-1,
 5417|  2.90k|            (unsigned)cctx->consumedSrcSize);
 5418|  2.90k|    }
 5419|  2.90k|    ZSTD_CCtx_trace(cctx, endResult);
 5420|  2.90k|    return cSize + endResult;
 5421|  2.90k|}
ZSTD_compress_advanced_internal:
 5454|  4.36k|{
 5455|  4.36k|    DEBUGLOG(4, "ZSTD_compress_advanced_internal (srcSize:%u)", (unsigned)srcSize);
  ------------------
  |  |  104|  4.36k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 4.36k]
  |  |  ------------------
  ------------------
 5456|  4.36k|    FORWARD_IF_ERROR( ZSTD_compressBegin_internal(cctx,
  ------------------
  |  |  146|  4.36k|    do {                                                                           \
  |  |  147|  4.36k|        size_t const err_code = (err);                                             \
  |  |  148|  4.36k|        if (ERR_isError(err_code)) {                                               \
  |  |  ------------------
  |  |  |  Branch (148:13): [True: 0, False: 4.36k]
  |  |  ------------------
  |  |  149|      0|            RAWLOG(3, "%s:%d: ERROR!: forwarding error in %s: %s",                 \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  150|      0|                  __FILE__, __LINE__, ERR_QUOTE(err), ERR_getErrorName(err_code)); \
  |  |  151|      0|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                                 \
  |  |  ------------------
  |  |  |  |   98|      0|    do {                                           \
  |  |  |  |   99|      0|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  152|      0|            RAWLOG(3, ": " __VA_ARGS__);                                           \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  153|      0|            RAWLOG(3, "\n");                                                       \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  154|      0|            return err_code;                                                       \
  |  |  155|      0|        }                                                                          \
  |  |  156|  4.36k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (156:13): [Folded, False: 4.36k]
  |  |  ------------------
  ------------------
 5457|  4.36k|                         dict, dictSize, ZSTD_dct_auto, ZSTD_dtlm_fast, NULL,
 5458|  4.36k|                         params, srcSize, ZSTDb_not_buffered) , "");
 5459|  4.36k|    return ZSTD_compressEnd_public(cctx, dst, dstCapacity, src, srcSize);
 5460|  4.36k|}
ZSTD_compress_usingDict:
 5467|  4.36k|{
 5468|  4.36k|    {
 5469|  4.36k|        ZSTD_parameters const params = ZSTD_getParams_internal(compressionLevel, srcSize, dict ? dictSize : 0, ZSTD_cpm_noAttachDict);
  ------------------
  |  Branch (5469:91): [True: 0, False: 4.36k]
  ------------------
 5470|  4.36k|        assert(params.fParams.contentSizeFlag == 1);
  ------------------
  |  |   70|  4.36k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 5471|  4.36k|        ZSTD_CCtxParams_init_internal(&cctx->simpleApiParams, &params, (compressionLevel == 0) ? ZSTD_CLEVEL_DEFAULT: compressionLevel);
  ------------------
  |  |  134|      0|#  define ZSTD_CLEVEL_DEFAULT 3
  ------------------
  |  Branch (5471:72): [True: 0, False: 4.36k]
  ------------------
 5472|  4.36k|    }
 5473|  4.36k|    DEBUGLOG(4, "ZSTD_compress_usingDict (srcSize=%u)", (unsigned)srcSize);
  ------------------
  |  |  104|  4.36k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 4.36k]
  |  |  ------------------
  ------------------
 5474|  4.36k|    return ZSTD_compress_advanced_internal(cctx, dst, dstCapacity, src, srcSize, dict, dictSize, &cctx->simpleApiParams);
 5475|  4.36k|}
ZSTD_compressCCtx:
 5481|  4.36k|{
 5482|  4.36k|    DEBUGLOG(4, "ZSTD_compressCCtx (srcSize=%u)", (unsigned)srcSize);
  ------------------
  |  |  104|  4.36k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 4.36k]
  |  |  ------------------
  ------------------
 5483|  4.36k|    assert(cctx != NULL);
  ------------------
  |  |   70|  4.36k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 5484|       |    return ZSTD_compress_usingDict(cctx, dst, dstCapacity, src, srcSize, NULL, 0, compressionLevel);
 5485|  4.36k|}
ZSTD_sizeof_CDict:
 5554|  2.89k|{
 5555|  2.89k|    if (cdict==NULL) return 0;   /* support sizeof on NULL */
  ------------------
  |  Branch (5555:9): [True: 2.89k, False: 0]
  ------------------
 5556|      0|    DEBUGLOG(5, "sizeof(*cdict) : %u", (unsigned)sizeof(*cdict));
  ------------------
  |  |  104|      0|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 0]
  |  |  ------------------
  ------------------
 5557|       |    /* cdict may be in the workspace */
 5558|      0|    return (cdict->workspace.workspace == cdict ? 0 : sizeof(*cdict))
  ------------------
  |  Branch (5558:13): [True: 0, False: 0]
  ------------------
 5559|      0|        + ZSTD_cwksp_sizeof(&cdict->workspace);
 5560|  2.89k|}
ZSTD_freeCDict:
 5768|     56|{
 5769|     56|    if (cdict==NULL) return 0;   /* support free on NULL */
  ------------------
  |  Branch (5769:9): [True: 56, False: 0]
  ------------------
 5770|      0|    {   ZSTD_customMem const cMem = cdict->customMem;
 5771|      0|        int cdictInWorkspace = ZSTD_cwksp_owns_buffer(&cdict->workspace, cdict);
 5772|      0|        ZSTD_cwksp_free(&cdict->workspace, cMem);
 5773|      0|        if (!cdictInWorkspace) {
  ------------------
  |  Branch (5773:13): [True: 0, False: 0]
  ------------------
 5774|      0|            ZSTD_customFree(cdict, cMem);
 5775|      0|        }
 5776|      0|        return 0;
 5777|     56|    }
 5778|     56|}
ZSTD_maxCLevel:
 8234|    320|int ZSTD_maxCLevel(void) { return ZSTD_MAX_CLEVEL; }
  ------------------
  |  |   19|    320|#define ZSTD_MAX_CLEVEL     22
  ------------------
zstd_compress.c:ZSTD_initCCtx:
  112|     28|{
  113|     28|    assert(cctx != NULL);
  ------------------
  |  |   70|     28|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  114|     28|    ZSTD_memset(cctx, 0, sizeof(*cctx));
  ------------------
  |  |   46|     28|# define ZSTD_memset(p,v,l) __builtin_memset((p),(v),(l))
  ------------------
  115|     28|    cctx->customMem = memManager;
  116|     28|#if DYNAMIC_BMI2
  117|     28|    ZSTD_SET_BMI2(cctx->bmi2, ZSTD_cpuSupportsBmi2());
  ------------------
  |  |   37|     28|#  define ZSTD_SET_BMI2(state, value) do { (state) = (value); } while (0)
  |  |  ------------------
  |  |  |  Branch (37:72): [Folded, False: 28]
  |  |  ------------------
  ------------------
  118|     28|#endif
  119|     28|    {   size_t const err = ZSTD_CCtx_reset(cctx, ZSTD_reset_parameters);
  120|     28|        assert(!ZSTD_isError(err));
  ------------------
  |  |   70|     28|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  121|     28|        (void)err;
  122|     28|    }
  123|     28|}
zstd_compress.c:ZSTD_freeCCtxContent:
  184|     28|{
  185|     28|    assert(cctx != NULL);
  ------------------
  |  |   70|     28|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  186|     28|    assert(cctx->staticSize == 0);
  ------------------
  |  |   70|     28|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  187|       |#ifdef ZSTD_MULTITHREAD
  188|       |    ZSTDMT_freeCCtx(cctx->mtctx); cctx->mtctx = NULL;  /* pending jobs may use the dictionary */
  189|       |#endif
  190|     28|    ZSTD_clearAllDicts(cctx);
  191|     28|    ZSTD_cwksp_free(&cctx->workspace, cctx->customMem);
  192|     28|}
zstd_compress.c:ZSTD_sizeof_localDict:
  177|  2.89k|{
  178|  2.89k|    size_t const bufferSize = dict.dictBuffer != NULL ? dict.dictSize : 0;
  ------------------
  |  Branch (178:31): [True: 0, False: 2.89k]
  ------------------
  179|  2.89k|    size_t const cdictSize = ZSTD_sizeof_CDict(dict.cdict);
  180|  2.89k|    return bufferSize + cdictSize;
  181|  2.89k|}
zstd_compress.c:ZSTD_sizeof_mtctx:
  209|  2.89k|{
  210|       |#ifdef ZSTD_MULTITHREAD
  211|       |    return ZSTDMT_sizeof_CCtx(cctx->mtctx);
  212|       |#else
  213|  2.89k|    (void)cctx;
  214|  2.89k|    return 0;
  215|  2.89k|#endif
  216|  2.89k|}
zstd_compress.c:ZSTD_CCtxParams_init_internal:
  397|  4.36k|{
  398|  4.36k|    assert(!ZSTD_checkCParams(params->cParams));
  ------------------
  |  |   70|  4.36k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  399|  4.36k|    ZSTD_memset(cctxParams, 0, sizeof(*cctxParams));
  ------------------
  |  |   46|  4.36k|# define ZSTD_memset(p,v,l) __builtin_memset((p),(v),(l))
  ------------------
  400|  4.36k|    cctxParams->cParams = params->cParams;
  401|  4.36k|    cctxParams->fParams = params->fParams;
  402|       |    /* Should not matter, as all cParams are presumed properly defined.
  403|       |     * But, set it for tracing anyway.
  404|       |     */
  405|  4.36k|    cctxParams->compressionLevel = compressionLevel;
  406|  4.36k|    cctxParams->useRowMatchFinder = ZSTD_resolveRowMatchFinderMode(cctxParams->useRowMatchFinder, &params->cParams);
  407|  4.36k|    cctxParams->postBlockSplitter = ZSTD_resolveBlockSplitterMode(cctxParams->postBlockSplitter, &params->cParams);
  408|  4.36k|    cctxParams->ldmParams.enableLdm = ZSTD_resolveEnableLdm(cctxParams->ldmParams.enableLdm, &params->cParams);
  409|  4.36k|    cctxParams->validateSequences = ZSTD_resolveExternalSequenceValidation(cctxParams->validateSequences);
  410|  4.36k|    cctxParams->maxBlockSize = ZSTD_resolveMaxBlockSize(cctxParams->maxBlockSize);
  411|  4.36k|    cctxParams->searchForExternalRepcodes = ZSTD_resolveExternalRepcodeSearch(cctxParams->searchForExternalRepcodes, compressionLevel);
  412|  4.36k|    DEBUGLOG(4, "ZSTD_CCtxParams_init_internal: useRowMatchFinder=%d, useBlockSplitter=%d ldm=%d",
  ------------------
  |  |  104|  4.36k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 4.36k]
  |  |  ------------------
  ------------------
  413|  4.36k|                cctxParams->useRowMatchFinder, cctxParams->postBlockSplitter, cctxParams->ldmParams.enableLdm);
  414|  4.36k|}
zstd_compress.c:ZSTD_resolveBlockSplitterMode:
  270|  4.36k|                                                        const ZSTD_compressionParameters* const cParams) {
  271|  4.36k|    if (mode != ZSTD_ps_auto) return mode;
  ------------------
  |  Branch (271:9): [True: 0, False: 4.36k]
  ------------------
  272|  4.36k|    return (cParams->strategy >= ZSTD_btopt && cParams->windowLog >= 17) ? ZSTD_ps_enable : ZSTD_ps_disable;
  ------------------
  |  Branch (272:13): [True: 1.80k, False: 2.56k]
  |  Branch (272:48): [True: 0, False: 1.80k]
  ------------------
  273|  4.36k|}
zstd_compress.c:ZSTD_resolveEnableLdm:
  291|  4.36k|                                 const ZSTD_compressionParameters* const cParams) {
  292|  4.36k|    if (mode != ZSTD_ps_auto) return mode;
  ------------------
  |  Branch (292:9): [True: 0, False: 4.36k]
  ------------------
  293|  4.36k|    return (cParams->strategy >= ZSTD_btopt && cParams->windowLog >= 27) ? ZSTD_ps_enable : ZSTD_ps_disable;
  ------------------
  |  Branch (293:13): [True: 1.80k, False: 2.56k]
  |  Branch (293:48): [True: 0, False: 1.80k]
  ------------------
  294|  4.36k|}
zstd_compress.c:ZSTD_resolveExternalSequenceValidation:
  296|  4.36k|static int ZSTD_resolveExternalSequenceValidation(int mode) {
  297|  4.36k|    return mode;
  298|  4.36k|}
zstd_compress.c:ZSTD_resolveExternalRepcodeSearch:
  309|  4.36k|static ZSTD_ParamSwitch_e ZSTD_resolveExternalRepcodeSearch(ZSTD_ParamSwitch_e value, int cLevel) {
  310|  4.36k|    if (value != ZSTD_ps_auto) return value;
  ------------------
  |  Branch (310:9): [True: 0, False: 4.36k]
  ------------------
  311|  4.36k|    if (cLevel < 10) {
  ------------------
  |  Branch (311:9): [True: 2.56k, False: 1.80k]
  ------------------
  312|  2.56k|        return ZSTD_ps_disable;
  313|  2.56k|    } else {
  314|  1.80k|        return ZSTD_ps_enable;
  315|  1.80k|    }
  316|  4.36k|}
zstd_compress.c:ZSTD_clearAllDicts:
  168|     56|{
  169|     56|    ZSTD_customFree(cctx->localDict.dictBuffer, cctx->customMem);
  170|     56|    ZSTD_freeCDict(cctx->localDict.cdict);
  171|     56|    ZSTD_memset(&cctx->localDict, 0, sizeof(cctx->localDict));
  ------------------
  |  |   46|     56|# define ZSTD_memset(p,v,l) __builtin_memset((p),(v),(l))
  ------------------
  172|     56|    ZSTD_memset(&cctx->prefixDict, 0, sizeof(cctx->prefixDict));
  ------------------
  |  |   46|     56|# define ZSTD_memset(p,v,l) __builtin_memset((p),(v),(l))
  ------------------
  173|       |    cctx->cdict = NULL;
  174|     56|}
zstd_compress.c:ZSTD_adjustCParams_internal:
 1520|  4.36k|{
 1521|  4.36k|    const U64 minSrcSize = 513; /* (1<<9) + 1 */
 1522|  4.36k|    const U64 maxWindowResize = 1ULL << (ZSTD_WINDOWLOG_MAX-1);
  ------------------
  |  | 1365|  4.36k|#define ZSTD_WINDOWLOG_MAX     ((int)(sizeof(size_t) == 4 ? ZSTD_WINDOWLOG_MAX_32 : ZSTD_WINDOWLOG_MAX_64))
  |  |  ------------------
  |  |  |  | 1363|      0|#define ZSTD_WINDOWLOG_MAX_32    30
  |  |  ------------------
  |  |               #define ZSTD_WINDOWLOG_MAX     ((int)(sizeof(size_t) == 4 ? ZSTD_WINDOWLOG_MAX_32 : ZSTD_WINDOWLOG_MAX_64))
  |  |  ------------------
  |  |  |  | 1364|  4.36k|#define ZSTD_WINDOWLOG_MAX_64    31
  |  |  ------------------
  |  |  |  Branch (1365:39): [Folded, False: 4.36k]
  |  |  ------------------
  ------------------
 1523|  4.36k|    assert(ZSTD_checkCParams(cPar)==0);
  ------------------
  |  |   70|  4.36k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1524|       |
 1525|       |    /* Cascade the selected strategy down to the next-highest one built into
 1526|       |     * this binary. */
 1527|       |#ifdef ZSTD_EXCLUDE_BTULTRA_BLOCK_COMPRESSOR
 1528|       |    if (cPar.strategy == ZSTD_btultra2) {
 1529|       |        cPar.strategy = ZSTD_btultra;
 1530|       |    }
 1531|       |    if (cPar.strategy == ZSTD_btultra) {
 1532|       |        cPar.strategy = ZSTD_btopt;
 1533|       |    }
 1534|       |#endif
 1535|       |#ifdef ZSTD_EXCLUDE_BTOPT_BLOCK_COMPRESSOR
 1536|       |    if (cPar.strategy == ZSTD_btopt) {
 1537|       |        cPar.strategy = ZSTD_btlazy2;
 1538|       |    }
 1539|       |#endif
 1540|       |#ifdef ZSTD_EXCLUDE_BTLAZY2_BLOCK_COMPRESSOR
 1541|       |    if (cPar.strategy == ZSTD_btlazy2) {
 1542|       |        cPar.strategy = ZSTD_lazy2;
 1543|       |    }
 1544|       |#endif
 1545|       |#ifdef ZSTD_EXCLUDE_LAZY2_BLOCK_COMPRESSOR
 1546|       |    if (cPar.strategy == ZSTD_lazy2) {
 1547|       |        cPar.strategy = ZSTD_lazy;
 1548|       |    }
 1549|       |#endif
 1550|       |#ifdef ZSTD_EXCLUDE_LAZY_BLOCK_COMPRESSOR
 1551|       |    if (cPar.strategy == ZSTD_lazy) {
 1552|       |        cPar.strategy = ZSTD_greedy;
 1553|       |    }
 1554|       |#endif
 1555|       |#ifdef ZSTD_EXCLUDE_GREEDY_BLOCK_COMPRESSOR
 1556|       |    if (cPar.strategy == ZSTD_greedy) {
 1557|       |        cPar.strategy = ZSTD_dfast;
 1558|       |    }
 1559|       |#endif
 1560|       |#ifdef ZSTD_EXCLUDE_DFAST_BLOCK_COMPRESSOR
 1561|       |    if (cPar.strategy == ZSTD_dfast) {
 1562|       |        cPar.strategy = ZSTD_fast;
 1563|       |        cPar.targetLength = 0;
 1564|       |    }
 1565|       |#endif
 1566|       |
 1567|  4.36k|    switch (mode) {
 1568|      0|    case ZSTD_cpm_unknown:
  ------------------
  |  Branch (1568:5): [True: 0, False: 4.36k]
  ------------------
 1569|  4.36k|    case ZSTD_cpm_noAttachDict:
  ------------------
  |  Branch (1569:5): [True: 4.36k, False: 0]
  ------------------
 1570|       |        /* If we don't know the source size, don't make any
 1571|       |         * assumptions about it. We will already have selected
 1572|       |         * smaller parameters if a dictionary is in use.
 1573|       |         */
 1574|  4.36k|        break;
 1575|      0|    case ZSTD_cpm_createCDict:
  ------------------
  |  Branch (1575:5): [True: 0, False: 4.36k]
  ------------------
 1576|       |        /* Assume a small source size when creating a dictionary
 1577|       |         * with an unknown source size.
 1578|       |         */
 1579|      0|        if (dictSize && srcSize == ZSTD_CONTENTSIZE_UNKNOWN)
  ------------------
  |  |  203|      0|#define ZSTD_CONTENTSIZE_UNKNOWN (0ULL - 1)
  ------------------
  |  Branch (1579:13): [True: 0, False: 0]
  |  Branch (1579:25): [True: 0, False: 0]
  ------------------
 1580|      0|            srcSize = minSrcSize;
 1581|      0|        break;
 1582|      0|    case ZSTD_cpm_attachDict:
  ------------------
  |  Branch (1582:5): [True: 0, False: 4.36k]
  ------------------
 1583|       |        /* Dictionary has its own dedicated parameters which have
 1584|       |         * already been selected. We are selecting parameters
 1585|       |         * for only the source.
 1586|       |         */
 1587|      0|        dictSize = 0;
 1588|      0|        break;
 1589|      0|    default:
  ------------------
  |  Branch (1589:5): [True: 0, False: 4.36k]
  ------------------
 1590|      0|        assert(0);
  ------------------
  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1591|      0|        break;
 1592|  4.36k|    }
 1593|       |
 1594|       |    /* resize windowLog if input is small enough, to use less memory */
 1595|  4.36k|    if ( (srcSize <= maxWindowResize)
  ------------------
  |  Branch (1595:10): [True: 4.36k, False: 0]
  ------------------
 1596|  4.36k|      && (dictSize <= maxWindowResize) )  {
  ------------------
  |  Branch (1596:10): [True: 4.36k, False: 0]
  ------------------
 1597|  4.36k|        U32 const tSize = (U32)(srcSize + dictSize);
 1598|  4.36k|        static U32 const hashSizeMin = 1 << ZSTD_HASHLOG_MIN;
  ------------------
  |  | 1368|  4.36k|#define ZSTD_HASHLOG_MIN          6
  ------------------
 1599|  4.36k|        U32 const srcLog = (tSize < hashSizeMin) ? ZSTD_HASHLOG_MIN :
  ------------------
  |  | 1368|     58|#define ZSTD_HASHLOG_MIN          6
  ------------------
  |  Branch (1599:28): [True: 58, False: 4.30k]
  ------------------
 1600|  4.36k|                            ZSTD_highbit32(tSize-1) + 1;
 1601|  4.36k|        if (cPar.windowLog > srcLog) cPar.windowLog = srcLog;
  ------------------
  |  Branch (1601:13): [True: 4.36k, False: 0]
  ------------------
 1602|  4.36k|    }
 1603|  4.36k|    if (srcSize != ZSTD_CONTENTSIZE_UNKNOWN) {
  ------------------
  |  |  203|  4.36k|#define ZSTD_CONTENTSIZE_UNKNOWN (0ULL - 1)
  ------------------
  |  Branch (1603:9): [True: 4.36k, False: 0]
  ------------------
 1604|  4.36k|        U32 const dictAndWindowLog = ZSTD_dictAndWindowLog(cPar.windowLog, (U64)srcSize, (U64)dictSize);
 1605|  4.36k|        U32 const cycleLog = ZSTD_cycleLog(cPar.chainLog, cPar.strategy);
 1606|  4.36k|        if (cPar.hashLog > dictAndWindowLog+1) cPar.hashLog = dictAndWindowLog+1;
  ------------------
  |  Branch (1606:13): [True: 4.36k, False: 0]
  ------------------
 1607|  4.36k|        if (cycleLog > dictAndWindowLog)
  ------------------
  |  Branch (1607:13): [True: 4.36k, False: 0]
  ------------------
 1608|  4.36k|            cPar.chainLog -= (cycleLog - dictAndWindowLog);
 1609|  4.36k|    }
 1610|       |
 1611|  4.36k|    if (cPar.windowLog < ZSTD_WINDOWLOG_ABSOLUTEMIN)
  ------------------
  |  |   78|  4.36k|#define ZSTD_WINDOWLOG_ABSOLUTEMIN 10
  ------------------
  |  Branch (1611:9): [True: 4.36k, False: 0]
  ------------------
 1612|  4.36k|        cPar.windowLog = ZSTD_WINDOWLOG_ABSOLUTEMIN;  /* minimum wlog required for valid frame header */
  ------------------
  |  |   78|  4.36k|#define ZSTD_WINDOWLOG_ABSOLUTEMIN 10
  ------------------
 1613|       |
 1614|       |    /* We can't use more than 32 bits of hash in total, so that means that we require:
 1615|       |     * (hashLog + 8) <= 32 && (chainLog + 8) <= 32
 1616|       |     */
 1617|  4.36k|    if (mode == ZSTD_cpm_createCDict && ZSTD_CDictIndicesAreTagged(&cPar)) {
  ------------------
  |  Branch (1617:9): [True: 0, False: 4.36k]
  |  Branch (1617:41): [True: 0, False: 0]
  ------------------
 1618|      0|        U32 const maxShortCacheHashLog = 32 - ZSTD_SHORT_CACHE_TAG_BITS;
  ------------------
  |  | 1511|      0|#define ZSTD_SHORT_CACHE_TAG_BITS 8
  ------------------
 1619|      0|        if (cPar.hashLog > maxShortCacheHashLog) {
  ------------------
  |  Branch (1619:13): [True: 0, False: 0]
  ------------------
 1620|      0|            cPar.hashLog = maxShortCacheHashLog;
 1621|      0|        }
 1622|      0|        if (cPar.chainLog > maxShortCacheHashLog) {
  ------------------
  |  Branch (1622:13): [True: 0, False: 0]
  ------------------
 1623|      0|            cPar.chainLog = maxShortCacheHashLog;
 1624|      0|        }
 1625|      0|    }
 1626|       |
 1627|       |
 1628|       |    /* At this point, we aren't 100% sure if we are using the row match finder.
 1629|       |     * Unless it is explicitly disabled, conservatively assume that it is enabled.
 1630|       |     * In this case it will only be disabled for small sources, so shrinking the
 1631|       |     * hash log a little bit shouldn't result in any ratio loss.
 1632|       |     */
 1633|  4.36k|    if (useRowMatchFinder == ZSTD_ps_auto)
  ------------------
  |  Branch (1633:9): [True: 4.36k, False: 0]
  ------------------
 1634|  4.36k|        useRowMatchFinder = ZSTD_ps_enable;
 1635|       |
 1636|       |    /* We can't hash more than 32-bits in total. So that means that we require:
 1637|       |     * (hashLog - rowLog + 8) <= 32
 1638|       |     */
 1639|  4.36k|    if (ZSTD_rowMatchFinderUsed(cPar.strategy, useRowMatchFinder)) {
  ------------------
  |  Branch (1639:9): [True: 1.62k, False: 2.74k]
  ------------------
 1640|       |        /* Switch to 32-entry rows if searchLog is 5 (or more) */
 1641|  1.62k|        U32 const rowLog = BOUNDED(4, cPar.searchLog, 6);
  ------------------
  |  |   56|  1.62k|#define BOUNDED(min,val,max) (MAX(min,MIN(val,max)))
  |  |  ------------------
  |  |  |  |   55|  3.24k|#define MAX(a,b) ((a)>(b) ? (a) : (b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (55:19): [True: 51, False: 1.57k]
  |  |  |  |  |  Branch (55:24): [True: 51, False: 1.57k]
  |  |  |  |  |  Branch (55:36): [True: 0, False: 1.57k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1642|  1.62k|        U32 const maxRowHashLog = 32 - ZSTD_ROW_HASH_TAG_BITS;
  ------------------
  |  |   24|  1.62k|#define ZSTD_ROW_HASH_TAG_BITS 8        /* nb bits to use for the tag */
  ------------------
 1643|  1.62k|        U32 const maxHashLog = maxRowHashLog + rowLog;
 1644|  1.62k|        assert(cPar.hashLog >= rowLog);
  ------------------
  |  |   70|  1.62k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1645|  1.62k|        if (cPar.hashLog > maxHashLog) {
  ------------------
  |  Branch (1645:13): [True: 0, False: 1.62k]
  ------------------
 1646|      0|            cPar.hashLog = maxHashLog;
 1647|      0|        }
 1648|  1.62k|    }
 1649|       |
 1650|  4.36k|    return cPar;
 1651|  4.36k|}
zstd_compress.c:ZSTD_dictAndWindowLog:
 1482|  4.36k|{
 1483|  4.36k|    const U64 maxWindowSize = 1ULL << ZSTD_WINDOWLOG_MAX;
  ------------------
  |  | 1365|  4.36k|#define ZSTD_WINDOWLOG_MAX     ((int)(sizeof(size_t) == 4 ? ZSTD_WINDOWLOG_MAX_32 : ZSTD_WINDOWLOG_MAX_64))
  |  |  ------------------
  |  |  |  | 1363|      0|#define ZSTD_WINDOWLOG_MAX_32    30
  |  |  ------------------
  |  |               #define ZSTD_WINDOWLOG_MAX     ((int)(sizeof(size_t) == 4 ? ZSTD_WINDOWLOG_MAX_32 : ZSTD_WINDOWLOG_MAX_64))
  |  |  ------------------
  |  |  |  | 1364|  4.36k|#define ZSTD_WINDOWLOG_MAX_64    31
  |  |  ------------------
  |  |  |  Branch (1365:39): [Folded, False: 4.36k]
  |  |  ------------------
  ------------------
 1484|       |    /* No dictionary ==> No change */
 1485|  4.36k|    if (dictSize == 0) {
  ------------------
  |  Branch (1485:9): [True: 4.36k, False: 0]
  ------------------
 1486|  4.36k|        return windowLog;
 1487|  4.36k|    }
 1488|      0|    assert(windowLog <= ZSTD_WINDOWLOG_MAX);
  ------------------
  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1489|      0|    assert(srcSize != ZSTD_CONTENTSIZE_UNKNOWN); /* Handled in ZSTD_adjustCParams_internal() */
  ------------------
  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1490|      0|    {
 1491|      0|        U64 const windowSize = 1ULL << windowLog;
 1492|      0|        U64 const dictAndWindowSize = dictSize + windowSize;
 1493|       |        /* If the window size is already large enough to fit both the source and the dictionary
 1494|       |         * then just use the window size. Otherwise adjust so that it fits the dictionary and
 1495|       |         * the window.
 1496|       |         */
 1497|      0|        if (windowSize >= dictSize + srcSize) {
  ------------------
  |  Branch (1497:13): [True: 0, False: 0]
  ------------------
 1498|      0|            return windowLog; /* Window size large enough already */
 1499|      0|        } else if (dictAndWindowSize >= maxWindowSize) {
  ------------------
  |  Branch (1499:20): [True: 0, False: 0]
  ------------------
 1500|      0|            return ZSTD_WINDOWLOG_MAX; /* Larger than max window log */
  ------------------
  |  | 1365|      0|#define ZSTD_WINDOWLOG_MAX     ((int)(sizeof(size_t) == 4 ? ZSTD_WINDOWLOG_MAX_32 : ZSTD_WINDOWLOG_MAX_64))
  |  |  ------------------
  |  |  |  | 1363|      0|#define ZSTD_WINDOWLOG_MAX_32    30
  |  |  ------------------
  |  |               #define ZSTD_WINDOWLOG_MAX     ((int)(sizeof(size_t) == 4 ? ZSTD_WINDOWLOG_MAX_32 : ZSTD_WINDOWLOG_MAX_64))
  |  |  ------------------
  |  |  |  | 1364|      0|#define ZSTD_WINDOWLOG_MAX_64    31
  |  |  ------------------
  |  |  |  Branch (1365:39): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1501|      0|        } else  {
 1502|      0|            return ZSTD_highbit32((U32)dictAndWindowSize - 1) + 1;
 1503|      0|        }
 1504|      0|    }
 1505|      0|}
zstd_compress.c:ZSTD_resolveRowMatchFinderMode:
  252|  4.36k|                                                         const ZSTD_compressionParameters* const cParams) {
  253|       |#ifdef ZSTD_LINUX_KERNEL
  254|       |    /* The Linux Kernel does not use SIMD, and 128KB is a very common size, e.g. in BtrFS.
  255|       |     * The row match finder is slower for this size without SIMD, so disable it.
  256|       |     */
  257|       |    const unsigned kWindowLogLowerBound = 17;
  258|       |#else
  259|  4.36k|    const unsigned kWindowLogLowerBound = 14;
  260|  4.36k|#endif
  261|  4.36k|    if (mode != ZSTD_ps_auto) return mode; /* if requested enabled, but no SIMD, we still will use row matchfinder */
  ------------------
  |  Branch (261:9): [True: 0, False: 4.36k]
  ------------------
  262|  4.36k|    mode = ZSTD_ps_disable;
  263|  4.36k|    if (!ZSTD_rowMatchFinderSupported(cParams->strategy)) return mode;
  ------------------
  |  Branch (263:9): [True: 2.74k, False: 1.62k]
  ------------------
  264|  1.62k|    if (cParams->windowLog > kWindowLogLowerBound) mode = ZSTD_ps_enable;
  ------------------
  |  Branch (264:9): [True: 0, False: 1.62k]
  ------------------
  265|  1.62k|    return mode;
  266|  4.36k|}
zstd_compress.c:ZSTD_estimateCCtxSize_usingCCtxParams_internal:
 1754|  4.36k|{
 1755|  4.36k|    size_t const windowSize = (size_t) BOUNDED(1ULL, 1ULL << cParams->windowLog, pledgedSrcSize);
  ------------------
  |  |   56|  4.36k|#define BOUNDED(min,val,max) (MAX(min,MIN(val,max)))
  |  |  ------------------
  |  |  |  |   55|  8.72k|#define MAX(a,b) ((a)>(b) ? (a) : (b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (55:19): [True: 0, False: 4.36k]
  |  |  |  |  |  Branch (55:24): [True: 0, False: 4.36k]
  |  |  |  |  |  Branch (55:36): [True: 0, False: 4.36k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1756|  4.36k|    size_t const blockSize = MIN(ZSTD_resolveMaxBlockSize(maxBlockSize), windowSize);
  ------------------
  |  |   54|  4.36k|#define MIN(a,b) ((a)<(b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (54:19): [True: 0, False: 4.36k]
  |  |  ------------------
  ------------------
 1757|  4.36k|    size_t const maxNbSeq = ZSTD_maxNbSeq(blockSize, cParams->minMatch, useSequenceProducer);
 1758|  4.36k|    size_t const tokenSpace = ZSTD_cwksp_alloc_size(WILDCOPY_OVERLENGTH + blockSize)
  ------------------
  |  |  201|  4.36k|#define WILDCOPY_OVERLENGTH 32
  ------------------
 1759|  4.36k|                            + ZSTD_cwksp_aligned64_alloc_size(maxNbSeq * sizeof(SeqDef))
 1760|  4.36k|                            + 3 * ZSTD_cwksp_alloc_size(maxNbSeq * sizeof(BYTE));
 1761|  4.36k|    size_t const tmpWorkSpace = ZSTD_cwksp_alloc_size(TMP_WORKSPACE_SIZE);
  ------------------
  |  |  448|  4.36k|#define TMP_WORKSPACE_SIZE (MAX(ENTROPY_WORKSPACE_SIZE, ZSTD_SLIPBLOCK_WORKSPACESIZE))
  |  |  ------------------
  |  |  |  |   55|  8.72k|#define MAX(a,b) ((a)>(b) ? (a) : (b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (55:19): [True: 4.36k, Folded]
  |  |  |  |  |  Branch (55:20): [Folded, False: 4.36k]
  |  |  |  |  |  Branch (55:30): [Folded, False: 4.36k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1762|  4.36k|    size_t const blockStateSpace = 2 * ZSTD_cwksp_alloc_size(sizeof(ZSTD_compressedBlockState_t));
 1763|  4.36k|    size_t const matchStateSize = ZSTD_sizeof_matchState(cParams, useRowMatchFinder, /* enableDedicatedDictSearch */ 0, /* forCCtx */ 1);
 1764|       |
 1765|  4.36k|    size_t const ldmSpace = ZSTD_ldm_getTableSize(*ldmParams);
 1766|  4.36k|    size_t const maxNbLdmSeq = ZSTD_ldm_getMaxNbSeq(*ldmParams, blockSize);
 1767|  4.36k|    size_t const ldmSeqSpace = ldmParams->enableLdm == ZSTD_ps_enable ?
  ------------------
  |  Branch (1767:32): [True: 0, False: 4.36k]
  ------------------
 1768|  4.36k|        ZSTD_cwksp_aligned64_alloc_size(maxNbLdmSeq * sizeof(rawSeq)) : 0;
 1769|       |
 1770|       |
 1771|  4.36k|    size_t const bufferSpace = ZSTD_cwksp_alloc_size(buffInSize)
 1772|  4.36k|                             + ZSTD_cwksp_alloc_size(buffOutSize);
 1773|       |
 1774|  4.36k|    size_t const cctxSpace = isStatic ? ZSTD_cwksp_alloc_size(sizeof(ZSTD_CCtx)) : 0;
  ------------------
  |  Branch (1774:30): [True: 0, False: 4.36k]
  ------------------
 1775|       |
 1776|  4.36k|    size_t const maxNbExternalSeq = ZSTD_sequenceBound(blockSize);
 1777|  4.36k|    size_t const externalSeqSpace = useSequenceProducer
  ------------------
  |  Branch (1777:37): [True: 0, False: 4.36k]
  ------------------
 1778|  4.36k|        ? ZSTD_cwksp_aligned64_alloc_size(maxNbExternalSeq * sizeof(ZSTD_Sequence))
 1779|  4.36k|        : 0;
 1780|       |
 1781|  4.36k|    size_t const neededSpace =
 1782|  4.36k|        cctxSpace +
 1783|  4.36k|        tmpWorkSpace +
 1784|  4.36k|        blockStateSpace +
 1785|  4.36k|        ldmSpace +
 1786|  4.36k|        ldmSeqSpace +
 1787|  4.36k|        matchStateSize +
 1788|  4.36k|        tokenSpace +
 1789|  4.36k|        bufferSpace +
 1790|  4.36k|        externalSeqSpace;
 1791|       |
 1792|  4.36k|    DEBUGLOG(5, "estimate workspace : %u", (U32)neededSpace);
  ------------------
  |  |  104|  4.36k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 4.36k]
  |  |  ------------------
  ------------------
 1793|  4.36k|    return neededSpace;
 1794|  4.36k|}
zstd_compress.c:ZSTD_maxNbSeq:
 1739|  8.72k|static size_t ZSTD_maxNbSeq(size_t blockSize, unsigned minMatch, int useSequenceProducer) {
 1740|  8.72k|    U32 const divider = (minMatch==3 || useSequenceProducer) ? 3 : 4;
  ------------------
  |  Branch (1740:26): [True: 3.08k, False: 5.64k]
  |  Branch (1740:41): [True: 0, False: 5.64k]
  ------------------
 1741|  8.72k|    return blockSize / divider;
 1742|  8.72k|}
zstd_compress.c:ZSTD_rowMatchFinderSupported:
  238|  30.6k|static int ZSTD_rowMatchFinderSupported(const ZSTD_strategy strategy) {
  239|  30.6k|    return (strategy >= ZSTD_greedy && strategy <= ZSTD_lazy2);
  ------------------
  |  Branch (239:13): [True: 29.3k, False: 1.35k]
  |  Branch (239:40): [True: 11.3k, False: 17.9k]
  ------------------
  240|  30.6k|}
zstd_compress.c:ZSTD_resolveMaxBlockSize:
  301|  8.72k|static size_t ZSTD_resolveMaxBlockSize(size_t maxBlockSize) {
  302|  8.72k|    if (maxBlockSize == 0) {
  ------------------
  |  Branch (302:9): [True: 4.36k, False: 4.36k]
  ------------------
  303|  4.36k|        return ZSTD_BLOCKSIZE_MAX;
  ------------------
  |  |  148|  4.36k|#define ZSTD_BLOCKSIZE_MAX     (1<<ZSTD_BLOCKSIZELOG_MAX)
  |  |  ------------------
  |  |  |  |  147|  4.36k|#define ZSTD_BLOCKSIZELOG_MAX  17
  |  |  ------------------
  ------------------
  304|  4.36k|    } else {
  305|  4.36k|        return maxBlockSize;
  306|  4.36k|    }
  307|  8.72k|}
zstd_compress.c:ZSTD_rowMatchFinderUsed:
  245|  26.2k|static int ZSTD_rowMatchFinderUsed(const ZSTD_strategy strategy, const ZSTD_ParamSwitch_e mode) {
  246|  26.2k|    assert(mode != ZSTD_ps_auto);
  ------------------
  |  |   70|  26.2k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  247|  26.2k|    return ZSTD_rowMatchFinderSupported(strategy) && (mode == ZSTD_ps_enable);
  ------------------
  |  Branch (247:12): [True: 9.76k, False: 16.5k]
  |  Branch (247:54): [True: 1.62k, False: 8.14k]
  ------------------
  248|  26.2k|}
zstd_compress.c:ZSTD_buildSequencesStatistics:
 2737|  2.81k|{
 2738|  2.81k|    BYTE* const ostart = dst;
 2739|  2.81k|    const BYTE* const oend = dstEnd;
 2740|  2.81k|    BYTE* op = ostart;
 2741|  2.81k|    FSE_CTable* CTable_LitLength = nextEntropy->litlengthCTable;
 2742|  2.81k|    FSE_CTable* CTable_OffsetBits = nextEntropy->offcodeCTable;
 2743|  2.81k|    FSE_CTable* CTable_MatchLength = nextEntropy->matchlengthCTable;
 2744|  2.81k|    const BYTE* const ofCodeTable = seqStorePtr->ofCode;
 2745|  2.81k|    const BYTE* const llCodeTable = seqStorePtr->llCode;
 2746|  2.81k|    const BYTE* const mlCodeTable = seqStorePtr->mlCode;
 2747|  2.81k|    ZSTD_symbolEncodingTypeStats_t stats;
 2748|       |
 2749|  2.81k|    stats.lastCountSize = 0;
 2750|       |    /* convert length/distances into codes */
 2751|  2.81k|    stats.longOffsets = ZSTD_seqToCodes(seqStorePtr);
 2752|  2.81k|    assert(op <= oend);
  ------------------
  |  |   70|  2.81k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 2753|  2.81k|    assert(nbSeq != 0); /* ZSTD_selectEncodingType() divides by nbSeq */
  ------------------
  |  |   70|  2.81k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 2754|       |    /* build CTable for Literal Lengths */
 2755|  2.81k|    {   unsigned max = MaxLL;
  ------------------
  |  |  104|  2.81k|#define MaxLL   35
  ------------------
 2756|  2.81k|        size_t const mostFrequent = HIST_countFast_wksp(countWorkspace, &max, llCodeTable, nbSeq, entropyWorkspace, entropyWkspSize);   /* can't fail */
 2757|  2.81k|        DEBUGLOG(5, "Building LL table");
  ------------------
  |  |  104|  2.81k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 2.81k]
  |  |  ------------------
  ------------------
 2758|  2.81k|        nextEntropy->litlength_repeatMode = prevEntropy->litlength_repeatMode;
 2759|  2.81k|        stats.LLtype = ZSTD_selectEncodingType(&nextEntropy->litlength_repeatMode,
 2760|  2.81k|                                        countWorkspace, max, mostFrequent, nbSeq,
 2761|  2.81k|                                        LLFSELog, prevEntropy->litlengthCTable,
  ------------------
  |  |  109|  2.81k|#define LLFSELog    9
  ------------------
 2762|  2.81k|                                        LL_defaultNorm, LL_defaultNormLog,
 2763|  2.81k|                                        ZSTD_defaultAllowed, strategy);
 2764|  2.81k|        assert(set_basic < set_compressed && set_rle < set_compressed);
  ------------------
  |  |   70|  2.81k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 2765|  2.81k|        assert(!(stats.LLtype < set_compressed && nextEntropy->litlength_repeatMode != FSE_repeat_none)); /* We don't copy tables */
  ------------------
  |  |   70|  2.81k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 2766|  2.81k|        {   size_t const countSize = ZSTD_buildCTable(
 2767|  2.81k|                op, (size_t)(oend - op),
 2768|  2.81k|                CTable_LitLength, LLFSELog, (SymbolEncodingType_e)stats.LLtype,
  ------------------
  |  |  109|  2.81k|#define LLFSELog    9
  ------------------
 2769|  2.81k|                countWorkspace, max, llCodeTable, nbSeq,
 2770|  2.81k|                LL_defaultNorm, LL_defaultNormLog, MaxLL,
  ------------------
  |  |  104|  2.81k|#define MaxLL   35
  ------------------
 2771|  2.81k|                prevEntropy->litlengthCTable,
 2772|  2.81k|                sizeof(prevEntropy->litlengthCTable),
 2773|  2.81k|                entropyWorkspace, entropyWkspSize);
 2774|  2.81k|            if (ZSTD_isError(countSize)) {
  ------------------
  |  |   44|  2.81k|#define ZSTD_isError ERR_isError   /* for inlining */
  ------------------
  |  Branch (2774:17): [True: 0, False: 2.81k]
  ------------------
 2775|      0|                DEBUGLOG(3, "ZSTD_buildCTable for LitLens failed");
  ------------------
  |  |  104|      0|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2776|      0|                stats.size = countSize;
 2777|      0|                return stats;
 2778|      0|            }
 2779|  2.81k|            if (stats.LLtype == set_compressed)
  ------------------
  |  Branch (2779:17): [True: 79, False: 2.73k]
  ------------------
 2780|     79|                stats.lastCountSize = countSize;
 2781|  2.81k|            op += countSize;
 2782|  2.81k|            assert(op <= oend);
  ------------------
  |  |   70|  2.81k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 2783|  2.81k|    }   }
 2784|       |    /* build CTable for Offsets */
 2785|  2.81k|    {   unsigned max = MaxOff;
  ------------------
  |  |  106|  2.81k|#define MaxOff  31
  ------------------
 2786|  2.81k|        size_t const mostFrequent = HIST_countFast_wksp(
 2787|  2.81k|            countWorkspace, &max, ofCodeTable, nbSeq, entropyWorkspace, entropyWkspSize);  /* can't fail */
 2788|       |        /* We can only use the basic table if max <= DefaultMaxOff, otherwise the offsets are too large */
 2789|  2.81k|        ZSTD_DefaultPolicy_e const defaultPolicy = (max <= DefaultMaxOff) ? ZSTD_defaultAllowed : ZSTD_defaultDisallowed;
  ------------------
  |  |  105|  2.81k|#define DefaultMaxOff 28
  ------------------
  |  Branch (2789:52): [True: 2.81k, False: 0]
  ------------------
 2790|  2.81k|        DEBUGLOG(5, "Building OF table");
  ------------------
  |  |  104|  2.81k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 2.81k]
  |  |  ------------------
  ------------------
 2791|  2.81k|        nextEntropy->offcode_repeatMode = prevEntropy->offcode_repeatMode;
 2792|  2.81k|        stats.Offtype = ZSTD_selectEncodingType(&nextEntropy->offcode_repeatMode,
 2793|  2.81k|                                        countWorkspace, max, mostFrequent, nbSeq,
 2794|  2.81k|                                        OffFSELog, prevEntropy->offcodeCTable,
  ------------------
  |  |  110|  2.81k|#define OffFSELog   8
  ------------------
 2795|  2.81k|                                        OF_defaultNorm, OF_defaultNormLog,
 2796|  2.81k|                                        defaultPolicy, strategy);
 2797|  2.81k|        assert(!(stats.Offtype < set_compressed && nextEntropy->offcode_repeatMode != FSE_repeat_none)); /* We don't copy tables */
  ------------------
  |  |   70|  2.81k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 2798|  2.81k|        {   size_t const countSize = ZSTD_buildCTable(
 2799|  2.81k|                op, (size_t)(oend - op),
 2800|  2.81k|                CTable_OffsetBits, OffFSELog, (SymbolEncodingType_e)stats.Offtype,
  ------------------
  |  |  110|  2.81k|#define OffFSELog   8
  ------------------
 2801|  2.81k|                countWorkspace, max, ofCodeTable, nbSeq,
 2802|  2.81k|                OF_defaultNorm, OF_defaultNormLog, DefaultMaxOff,
  ------------------
  |  |  105|  2.81k|#define DefaultMaxOff 28
  ------------------
 2803|  2.81k|                prevEntropy->offcodeCTable,
 2804|  2.81k|                sizeof(prevEntropy->offcodeCTable),
 2805|  2.81k|                entropyWorkspace, entropyWkspSize);
 2806|  2.81k|            if (ZSTD_isError(countSize)) {
  ------------------
  |  |   44|  2.81k|#define ZSTD_isError ERR_isError   /* for inlining */
  ------------------
  |  Branch (2806:17): [True: 0, False: 2.81k]
  ------------------
 2807|      0|                DEBUGLOG(3, "ZSTD_buildCTable for Offsets failed");
  ------------------
  |  |  104|      0|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2808|      0|                stats.size = countSize;
 2809|      0|                return stats;
 2810|      0|            }
 2811|  2.81k|            if (stats.Offtype == set_compressed)
  ------------------
  |  Branch (2811:17): [True: 328, False: 2.48k]
  ------------------
 2812|    328|                stats.lastCountSize = countSize;
 2813|  2.81k|            op += countSize;
 2814|  2.81k|            assert(op <= oend);
  ------------------
  |  |   70|  2.81k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 2815|  2.81k|    }   }
 2816|       |    /* build CTable for MatchLengths */
 2817|  2.81k|    {   unsigned max = MaxML;
  ------------------
  |  |  103|  2.81k|#define MaxML   52
  ------------------
 2818|  2.81k|        size_t const mostFrequent = HIST_countFast_wksp(
 2819|  2.81k|            countWorkspace, &max, mlCodeTable, nbSeq, entropyWorkspace, entropyWkspSize);   /* can't fail */
 2820|  2.81k|        DEBUGLOG(5, "Building ML table (remaining space : %i)", (int)(oend-op));
  ------------------
  |  |  104|  2.81k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 2.81k]
  |  |  ------------------
  ------------------
 2821|  2.81k|        nextEntropy->matchlength_repeatMode = prevEntropy->matchlength_repeatMode;
 2822|  2.81k|        stats.MLtype = ZSTD_selectEncodingType(&nextEntropy->matchlength_repeatMode,
 2823|  2.81k|                                        countWorkspace, max, mostFrequent, nbSeq,
 2824|  2.81k|                                        MLFSELog, prevEntropy->matchlengthCTable,
  ------------------
  |  |  108|  2.81k|#define MLFSELog    9
  ------------------
 2825|  2.81k|                                        ML_defaultNorm, ML_defaultNormLog,
 2826|  2.81k|                                        ZSTD_defaultAllowed, strategy);
 2827|  2.81k|        assert(!(stats.MLtype < set_compressed && nextEntropy->matchlength_repeatMode != FSE_repeat_none)); /* We don't copy tables */
  ------------------
  |  |   70|  2.81k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 2828|  2.81k|        {   size_t const countSize = ZSTD_buildCTable(
 2829|  2.81k|                op, (size_t)(oend - op),
 2830|  2.81k|                CTable_MatchLength, MLFSELog, (SymbolEncodingType_e)stats.MLtype,
  ------------------
  |  |  108|  2.81k|#define MLFSELog    9
  ------------------
 2831|  2.81k|                countWorkspace, max, mlCodeTable, nbSeq,
 2832|  2.81k|                ML_defaultNorm, ML_defaultNormLog, MaxML,
  ------------------
  |  |  103|  2.81k|#define MaxML   52
  ------------------
 2833|  2.81k|                prevEntropy->matchlengthCTable,
 2834|  2.81k|                sizeof(prevEntropy->matchlengthCTable),
 2835|  2.81k|                entropyWorkspace, entropyWkspSize);
 2836|  2.81k|            if (ZSTD_isError(countSize)) {
  ------------------
  |  |   44|  2.81k|#define ZSTD_isError ERR_isError   /* for inlining */
  ------------------
  |  Branch (2836:17): [True: 9, False: 2.80k]
  ------------------
 2837|      9|                DEBUGLOG(3, "ZSTD_buildCTable for MatchLengths failed");
  ------------------
  |  |  104|      9|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 9]
  |  |  ------------------
  ------------------
 2838|      9|                stats.size = countSize;
 2839|      9|                return stats;
 2840|      9|            }
 2841|  2.80k|            if (stats.MLtype == set_compressed)
  ------------------
  |  Branch (2841:17): [True: 173, False: 2.63k]
  ------------------
 2842|    173|                stats.lastCountSize = countSize;
 2843|  2.80k|            op += countSize;
 2844|  2.80k|            assert(op <= oend);
  ------------------
  |  |   70|  2.80k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 2845|  2.80k|    }   }
 2846|      0|    stats.size = (size_t)(op-ostart);
 2847|  2.80k|    return stats;
 2848|  2.81k|}
zstd_compress.c:ZSTD_compressContinue_internal:
 4767|  4.36k|{
 4768|  4.36k|    ZSTD_MatchState_t* const ms = &cctx->blockState.matchState;
 4769|  4.36k|    size_t fhSize = 0;
 4770|       |
 4771|  4.36k|    DEBUGLOG(5, "ZSTD_compressContinue_internal, stage: %u, srcSize: %u",
  ------------------
  |  |  104|  4.36k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 4.36k]
  |  |  ------------------
  ------------------
 4772|  4.36k|                cctx->stage, (unsigned)srcSize);
 4773|  4.36k|    RETURN_ERROR_IF(cctx->stage==ZSTDcs_created, stage_wrong,
  ------------------
  |  |  114|  4.36k|    do {                                                                       \
  |  |  115|  4.36k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 0, False: 4.36k]
  |  |  ------------------
  |  |  116|      0|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|      0|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|      0|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|      0|    do {                                           \
  |  |  |  |   99|      0|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|      0|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|      0|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|      0|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|      0|        }                                                                      \
  |  |  123|  4.36k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 4.36k]
  |  |  ------------------
  ------------------
 4774|  4.36k|                    "missing init (ZSTD_compressBegin)");
 4775|       |
 4776|  4.36k|    if (frame && (cctx->stage==ZSTDcs_init)) {
  ------------------
  |  Branch (4776:9): [True: 4.36k, False: 0]
  |  Branch (4776:18): [True: 4.36k, False: 0]
  ------------------
 4777|  4.36k|        fhSize = ZSTD_writeFrameHeader(dst, dstCapacity, &cctx->appliedParams,
 4778|  4.36k|                                       cctx->pledgedSrcSizePlusOne-1, cctx->dictID);
 4779|  4.36k|        FORWARD_IF_ERROR(fhSize, "ZSTD_writeFrameHeader failed");
  ------------------
  |  |  146|  4.36k|    do {                                                                           \
  |  |  147|  4.36k|        size_t const err_code = (err);                                             \
  |  |  148|  4.36k|        if (ERR_isError(err_code)) {                                               \
  |  |  ------------------
  |  |  |  Branch (148:13): [True: 12, False: 4.35k]
  |  |  ------------------
  |  |  149|     12|            RAWLOG(3, "%s:%d: ERROR!: forwarding error in %s: %s",                 \
  |  |  ------------------
  |  |  |  |  103|     12|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 12]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  150|     12|                  __FILE__, __LINE__, ERR_QUOTE(err), ERR_getErrorName(err_code)); \
  |  |  151|     12|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                                 \
  |  |  ------------------
  |  |  |  |   98|     12|    do {                                           \
  |  |  |  |   99|     12|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 12]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|     12|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 12]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  152|     12|            RAWLOG(3, ": " __VA_ARGS__);                                           \
  |  |  ------------------
  |  |  |  |  103|     12|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 12]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  153|     12|            RAWLOG(3, "\n");                                                       \
  |  |  ------------------
  |  |  |  |  103|     12|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 12]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  154|     12|            return err_code;                                                       \
  |  |  155|     12|        }                                                                          \
  |  |  156|  4.36k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (156:13): [Folded, False: 4.35k]
  |  |  ------------------
  ------------------
 4780|  4.35k|        assert(fhSize <= dstCapacity);
  ------------------
  |  |   70|  4.35k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 4781|  4.35k|        dstCapacity -= fhSize;
 4782|  4.35k|        dst = (char*)dst + fhSize;
 4783|  4.35k|        cctx->stage = ZSTDcs_ongoing;
 4784|  4.35k|    }
 4785|       |
 4786|  4.35k|    if (!srcSize) return fhSize;  /* do not generate an empty block if no input */
  ------------------
  |  Branch (4786:9): [True: 0, False: 4.35k]
  ------------------
 4787|       |
 4788|  4.35k|    if (!ZSTD_window_update(&ms->window, src, srcSize, ms->forceNonContiguous)) {
  ------------------
  |  Branch (4788:9): [True: 4.35k, False: 0]
  ------------------
 4789|  4.35k|        ms->forceNonContiguous = 0;
 4790|  4.35k|        ms->nextToUpdate = ms->window.dictLimit;
 4791|  4.35k|    }
 4792|  4.35k|    if (cctx->appliedParams.ldmParams.enableLdm == ZSTD_ps_enable) {
  ------------------
  |  Branch (4792:9): [True: 0, False: 4.35k]
  ------------------
 4793|      0|        ZSTD_window_update(&cctx->ldmState.window, src, srcSize, /* forceNonContiguous */ 0);
 4794|      0|    }
 4795|       |
 4796|  4.35k|    if (!frame) {
  ------------------
  |  Branch (4796:9): [True: 0, False: 4.35k]
  ------------------
 4797|       |        /* overflow check and correction for block mode */
 4798|      0|        ZSTD_overflowCorrectIfNeeded(
 4799|      0|            ms, &cctx->workspace, &cctx->appliedParams,
 4800|      0|            src, (BYTE const*)src + srcSize);
 4801|      0|    }
 4802|       |
 4803|  4.35k|    DEBUGLOG(5, "ZSTD_compressContinue_internal (blockSize=%u)", (unsigned)cctx->blockSizeMax);
  ------------------
  |  |  104|  4.35k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 4.35k]
  |  |  ------------------
  ------------------
 4804|  4.35k|    {   size_t const cSize = frame ?
  ------------------
  |  Branch (4804:30): [True: 4.35k, False: 0]
  ------------------
 4805|  4.35k|                             ZSTD_compress_frameChunk (cctx, dst, dstCapacity, src, srcSize, lastFrameChunk) :
 4806|  4.35k|                             ZSTD_compressBlock_internal (cctx, dst, dstCapacity, src, srcSize, 0 /* frame */);
 4807|  4.35k|        FORWARD_IF_ERROR(cSize, "%s", frame ? "ZSTD_compress_frameChunk failed" : "ZSTD_compressBlock_internal failed");
  ------------------
  |  |  146|  4.35k|    do {                                                                           \
  |  |  147|  4.35k|        size_t const err_code = (err);                                             \
  |  |  148|  4.35k|        if (ERR_isError(err_code)) {                                               \
  |  |  ------------------
  |  |  |  Branch (148:13): [True: 1.44k, False: 2.90k]
  |  |  ------------------
  |  |  149|  1.44k|            RAWLOG(3, "%s:%d: ERROR!: forwarding error in %s: %s",                 \
  |  |  ------------------
  |  |  |  |  103|  1.44k|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 1.44k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  150|  1.44k|                  __FILE__, __LINE__, ERR_QUOTE(err), ERR_getErrorName(err_code)); \
  |  |  151|  1.44k|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                                 \
  |  |  ------------------
  |  |  |  |   98|  1.44k|    do {                                           \
  |  |  |  |   99|  1.44k|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 1.44k]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (100:38): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|  1.44k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 1.44k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  152|  1.44k|            RAWLOG(3, ": " __VA_ARGS__);                                           \
  |  |  ------------------
  |  |  |  |  103|  1.44k|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 1.44k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  153|  1.44k|            RAWLOG(3, "\n");                                                       \
  |  |  ------------------
  |  |  |  |  103|  1.44k|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 1.44k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  154|  1.44k|            return err_code;                                                       \
  |  |  155|  1.44k|        }                                                                          \
  |  |  156|  4.35k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (156:13): [Folded, False: 2.90k]
  |  |  ------------------
  ------------------
 4808|  2.90k|        cctx->consumedSrcSize += srcSize;
 4809|  2.90k|        cctx->producedCSize += (cSize + fhSize);
 4810|  2.90k|        assert(!(cctx->appliedParams.fParams.contentSizeFlag && cctx->pledgedSrcSizePlusOne == 0));
  ------------------
  |  |   70|  2.90k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 4811|  2.90k|        if (cctx->pledgedSrcSizePlusOne != 0) {  /* control src size */
  ------------------
  |  Branch (4811:13): [True: 2.90k, False: 0]
  ------------------
 4812|  2.90k|            ZSTD_STATIC_ASSERT(ZSTD_CONTENTSIZE_UNKNOWN == (unsigned long long)-1);
  ------------------
  |  |   43|  2.90k|#define ZSTD_STATIC_ASSERT(c) DEBUG_STATIC_ASSERT(c)
  |  |  ------------------
  |  |  |  |   39|  2.90k|#define DEBUG_STATIC_ASSERT(c) (void)sizeof(char[(c) ? 1 : -1])
  |  |  ------------------
  ------------------
 4813|  2.90k|            RETURN_ERROR_IF(
  ------------------
  |  |  114|  2.90k|    do {                                                                       \
  |  |  115|  2.90k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 0, False: 2.90k]
  |  |  ------------------
  |  |  116|      0|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|      0|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|      0|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|      0|    do {                                           \
  |  |  |  |   99|      0|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|      0|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|      0|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|      0|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|      0|        }                                                                      \
  |  |  123|  2.90k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 2.90k]
  |  |  ------------------
  ------------------
 4814|  2.90k|                cctx->consumedSrcSize+1 > cctx->pledgedSrcSizePlusOne,
 4815|  2.90k|                srcSize_wrong,
 4816|  2.90k|                "error : pledgedSrcSize = %u, while realSrcSize >= %u",
 4817|  2.90k|                (unsigned)cctx->pledgedSrcSizePlusOne-1,
 4818|  2.90k|                (unsigned)cctx->consumedSrcSize);
 4819|  2.90k|        }
 4820|  2.90k|        return cSize + fhSize;
 4821|  2.90k|    }
 4822|  2.90k|}
zstd_compress.c:ZSTD_overflowCorrectIfNeeded:
 4502|  4.35k|{
 4503|  4.35k|    U32 const cycleLog = ZSTD_cycleLog(params->cParams.chainLog, params->cParams.strategy);
 4504|  4.35k|    U32 const maxDist = (U32)1 << params->cParams.windowLog;
 4505|  4.35k|    if (ZSTD_window_needOverflowCorrection(ms->window, cycleLog, maxDist, ms->loadedDictEnd, ip, iend)) {
  ------------------
  |  Branch (4505:9): [True: 133, False: 4.21k]
  ------------------
 4506|    133|        U32 const correction = ZSTD_window_correctOverflow(&ms->window, cycleLog, maxDist, ip);
 4507|    133|        ZSTD_STATIC_ASSERT(ZSTD_CHAINLOG_MAX <= 30);
  ------------------
  |  |   43|    133|#define ZSTD_STATIC_ASSERT(c) DEBUG_STATIC_ASSERT(c)
  |  |  ------------------
  |  |  |  |   39|    133|#define DEBUG_STATIC_ASSERT(c) (void)sizeof(char[(c) ? 1 : -1])
  |  |  ------------------
  ------------------
 4508|    133|        ZSTD_STATIC_ASSERT(ZSTD_WINDOWLOG_MAX_32 <= 30);
  ------------------
  |  |   43|    133|#define ZSTD_STATIC_ASSERT(c) DEBUG_STATIC_ASSERT(c)
  |  |  ------------------
  |  |  |  |   39|    133|#define DEBUG_STATIC_ASSERT(c) (void)sizeof(char[(c) ? 1 : -1])
  |  |  ------------------
  ------------------
 4509|    133|        ZSTD_STATIC_ASSERT(ZSTD_WINDOWLOG_MAX <= 31);
  ------------------
  |  |   43|    133|#define ZSTD_STATIC_ASSERT(c) DEBUG_STATIC_ASSERT(c)
  |  |  ------------------
  |  |  |  |   39|    133|#define DEBUG_STATIC_ASSERT(c) (void)sizeof(char[(c) ? 1 : -1])
  |  |  ------------------
  ------------------
 4510|    133|        ZSTD_cwksp_mark_tables_dirty(ws);
 4511|    133|        ZSTD_reduceIndex(ms, params, correction);
 4512|    133|        ZSTD_cwksp_mark_tables_clean(ws);
 4513|    133|        if (ms->nextToUpdate < correction) ms->nextToUpdate = 0;
  ------------------
  |  Branch (4513:13): [True: 0, False: 133]
  ------------------
 4514|    133|        else ms->nextToUpdate -= correction;
 4515|       |        /* invalidate dictionaries on overflow correction */
 4516|    133|        ms->loadedDictEnd = 0;
 4517|       |        ms->dictMatchState = NULL;
 4518|    133|    }
 4519|  4.35k|}
zstd_compress.c:ZSTD_reduceIndex:
 2635|    133|{
 2636|    133|    {   U32 const hSize = (U32)1 << params->cParams.hashLog;
 2637|    133|        ZSTD_reduceTable(ms->hashTable, hSize, reducerValue);
 2638|    133|    }
 2639|       |
 2640|    133|    if (ZSTD_allocateChainTable(params->cParams.strategy, params->useRowMatchFinder, (U32)ms->dedicatedDictSearch)) {
  ------------------
  |  Branch (2640:9): [True: 133, False: 0]
  ------------------
 2641|    133|        U32 const chainSize = (U32)1 << params->cParams.chainLog;
 2642|    133|        if (params->cParams.strategy == ZSTD_btlazy2)
  ------------------
  |  Branch (2642:13): [True: 19, False: 114]
  ------------------
 2643|     19|            ZSTD_reduceTable_btlazy2(ms->chainTable, chainSize, reducerValue);
 2644|    114|        else
 2645|    114|            ZSTD_reduceTable(ms->chainTable, chainSize, reducerValue);
 2646|    133|    }
 2647|       |
 2648|    133|    if (ms->hashLog3) {
  ------------------
  |  Branch (2648:9): [True: 55, False: 78]
  ------------------
 2649|     55|        U32 const h3Size = (U32)1 << ms->hashLog3;
 2650|     55|        ZSTD_reduceTable(ms->hashTable3, h3Size, reducerValue);
 2651|     55|    }
 2652|    133|}
zstd_compress.c:ZSTD_reduceTable:
 2623|    302|{
 2624|    302|    ZSTD_reduceTable_internal(table, size, reducerValue, 0);
 2625|    302|}
zstd_compress.c:ZSTD_reduceTable_internal:
 2582|    321|{
 2583|    321|    int const nbRows = (int)size / ZSTD_ROWSIZE;
  ------------------
  |  | 2573|    321|#define ZSTD_ROWSIZE 16
  ------------------
 2584|    321|    int cellNb = 0;
 2585|    321|    int rowNb;
 2586|       |    /* Protect special index values < ZSTD_WINDOW_START_INDEX. */
 2587|    321|    U32 const reducerThreshold = reducerValue + ZSTD_WINDOW_START_INDEX;
  ------------------
  |  |  270|    321|#define ZSTD_WINDOW_START_INDEX 2
  ------------------
 2588|    321|    assert((size & (ZSTD_ROWSIZE-1)) == 0);  /* multiple of ZSTD_ROWSIZE */
  ------------------
  |  |   70|    321|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 2589|    321|    assert(size < (1U<<31));   /* can be cast to int */
  ------------------
  |  |   70|    321|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 2590|       |
 2591|       |#if ZSTD_MEMORY_SANITIZER && !defined (ZSTD_MSAN_DONT_POISON_WORKSPACE)
 2592|       |    /* To validate that the table reuse logic is sound, and that we don't
 2593|       |     * access table space that we haven't cleaned, we re-"poison" the table
 2594|       |     * space every time we mark it dirty.
 2595|       |     *
 2596|       |     * This function however is intended to operate on those dirty tables and
 2597|       |     * re-clean them. So when this function is used correctly, we can unpoison
 2598|       |     * the memory it operated on. This introduces a blind spot though, since
 2599|       |     * if we now try to operate on __actually__ poisoned memory, we will not
 2600|       |     * detect that. */
 2601|       |    __msan_unpoison(table, size * sizeof(U32));
 2602|       |#endif
 2603|       |
 2604|  7.56k|    for (rowNb=0 ; rowNb < nbRows ; rowNb++) {
  ------------------
  |  Branch (2604:20): [True: 7.24k, False: 321]
  ------------------
 2605|  7.24k|        int column;
 2606|   123k|        for (column=0; column<ZSTD_ROWSIZE; column++) {
  ------------------
  |  | 2573|   123k|#define ZSTD_ROWSIZE 16
  ------------------
  |  Branch (2606:24): [True: 115k, False: 7.24k]
  ------------------
 2607|   115k|            U32 newVal;
 2608|   115k|            if (preserveMark && table[cellNb] == ZSTD_DUBT_UNSORTED_MARK) {
  ------------------
  |  |   34|  4.22k|#define ZSTD_DUBT_UNSORTED_MARK 1   /* For btlazy2 strategy, index ZSTD_DUBT_UNSORTED_MARK==1 means "unsorted".
  ------------------
  |  Branch (2608:17): [True: 4.22k, False: 111k]
  |  Branch (2608:33): [True: 655, False: 3.56k]
  ------------------
 2609|       |                /* This write is pointless, but is required(?) for the compiler
 2610|       |                 * to auto-vectorize the loop. */
 2611|    655|                newVal = ZSTD_DUBT_UNSORTED_MARK;
  ------------------
  |  |   34|    655|#define ZSTD_DUBT_UNSORTED_MARK 1   /* For btlazy2 strategy, index ZSTD_DUBT_UNSORTED_MARK==1 means "unsorted".
  ------------------
 2612|   115k|            } else if (table[cellNb] < reducerThreshold) {
  ------------------
  |  Branch (2612:24): [True: 59.9k, False: 55.2k]
  ------------------
 2613|  59.9k|                newVal = 0;
 2614|  59.9k|            } else {
 2615|  55.2k|                newVal = table[cellNb] - reducerValue;
 2616|  55.2k|            }
 2617|   115k|            table[cellNb] = newVal;
 2618|   115k|            cellNb++;
 2619|   115k|    }   }
 2620|    321|}
zstd_compress.c:ZSTD_allocateChainTable:
  278|  8.85k|                                   const U32 forDDSDict) {
  279|  8.85k|    assert(useRowMatchFinder != ZSTD_ps_auto);
  ------------------
  |  |   70|  8.85k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  280|       |    /* We always should allocate a chaintable if we are allocating a matchstate for a DDS dictionary matchstate.
  281|       |     * We do not allocate a chaintable if we are using ZSTD_fast, or are using the row-based matchfinder.
  282|       |     */
  283|  8.85k|    return forDDSDict || ((strategy != ZSTD_fast) && !ZSTD_rowMatchFinderUsed(strategy, useRowMatchFinder));
  ------------------
  |  Branch (283:12): [True: 0, False: 8.85k]
  |  Branch (283:27): [True: 8.85k, False: 0]
  |  Branch (283:54): [True: 8.85k, False: 0]
  ------------------
  284|  8.85k|}
zstd_compress.c:ZSTD_reduceTable_btlazy2:
 2628|     19|{
 2629|     19|    ZSTD_reduceTable_internal(table, size, reducerValue, 1);
 2630|     19|}
zstd_compress.c:ZSTD_compress_frameChunk:
 4566|  4.35k|{
 4567|  4.35k|    size_t blockSizeMax = cctx->blockSizeMax;
 4568|  4.35k|    size_t remaining = srcSize;
 4569|  4.35k|    const BYTE* ip = (const BYTE*)src;
 4570|  4.35k|    BYTE* const ostart = (BYTE*)dst;
 4571|  4.35k|    BYTE* op = ostart;
 4572|  4.35k|    U32 const maxDist = (U32)1 << cctx->appliedParams.cParams.windowLog;
 4573|  4.35k|    S64 savings = (S64)cctx->consumedSrcSize - (S64)cctx->producedCSize;
 4574|       |
 4575|  4.35k|    assert(cctx->appliedParams.cParams.windowLog <= ZSTD_WINDOWLOG_MAX);
  ------------------
  |  |   70|  4.35k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 4576|       |
 4577|  4.35k|    DEBUGLOG(5, "ZSTD_compress_frameChunk (srcSize=%u, blockSizeMax=%u)", (unsigned)srcSize, (unsigned)blockSizeMax);
  ------------------
  |  |  104|  4.35k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 4.35k]
  |  |  ------------------
  ------------------
 4578|  4.35k|    if (cctx->appliedParams.fParams.checksumFlag && srcSize)
  ------------------
  |  Branch (4578:9): [True: 0, False: 4.35k]
  |  Branch (4578:53): [True: 0, False: 0]
  ------------------
 4579|      0|        XXH64_update(&cctx->xxhState, src, srcSize);
  ------------------
  |  |  460|      0|#  define XXH64_update XXH_NAME2(XXH_NAMESPACE, XXH64_update)
  |  |  ------------------
  |  |  |  |  443|      0|#  define XXH_NAME2(A,B) XXH_CAT(A,B)
  |  |  |  |  ------------------
  |  |  |  |  |  |  442|      0|#  define XXH_CAT(A,B) A##B
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4580|       |
 4581|  7.25k|    while (remaining) {
  ------------------
  |  Branch (4581:12): [True: 4.35k, False: 2.90k]
  ------------------
 4582|  4.35k|        ZSTD_MatchState_t* const ms = &cctx->blockState.matchState;
 4583|  4.35k|        size_t const blockSize = ZSTD_optimalBlockSize(cctx,
 4584|  4.35k|                                ip, remaining,
 4585|  4.35k|                                blockSizeMax,
 4586|  4.35k|                                cctx->appliedParams.preBlockSplitter_level,
 4587|  4.35k|                                cctx->appliedParams.cParams.strategy,
 4588|  4.35k|                                savings);
 4589|  4.35k|        U32 const lastBlock = lastFrameChunk & (blockSize == remaining);
 4590|  4.35k|        assert(blockSize <= remaining);
  ------------------
  |  |   70|  4.35k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 4591|       |
 4592|       |        /* TODO: See 3090. We reduced MIN_CBLOCK_SIZE from 3 to 2 so to compensate we are adding
 4593|       |         * additional 1. We need to revisit and change this logic to be more consistent */
 4594|  4.35k|        RETURN_ERROR_IF(dstCapacity < ZSTD_blockHeaderSize + MIN_CBLOCK_SIZE + 1,
  ------------------
  |  |  114|  4.35k|    do {                                                                       \
  |  |  115|  4.35k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 0, False: 4.35k]
  |  |  ------------------
  |  |  116|      0|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|      0|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|      0|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|      0|    do {                                           \
  |  |  |  |   99|      0|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|      0|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|      0|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|      0|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|      0|        }                                                                      \
  |  |  123|  4.35k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 4.35k]
  |  |  ------------------
  ------------------
 4595|  4.35k|                        dstSize_tooSmall,
 4596|  4.35k|                        "not enough space to store compressed block");
 4597|       |
 4598|  4.35k|        ZSTD_overflowCorrectIfNeeded(
 4599|  4.35k|            ms, &cctx->workspace, &cctx->appliedParams, ip, ip + blockSize);
 4600|  4.35k|        ZSTD_checkDictValidity(&ms->window, ip + blockSize, maxDist, &ms->loadedDictEnd, &ms->dictMatchState);
 4601|  4.35k|        ZSTD_window_enforceMaxDist(&ms->window, ip, maxDist, &ms->loadedDictEnd, &ms->dictMatchState);
 4602|       |
 4603|       |        /* Ensure hash/chain table insertion resumes no sooner than lowlimit */
 4604|  4.35k|        if (ms->nextToUpdate < ms->window.lowLimit) ms->nextToUpdate = ms->window.lowLimit;
  ------------------
  |  Branch (4604:13): [True: 0, False: 4.35k]
  ------------------
 4605|       |
 4606|  4.35k|        {   size_t cSize;
 4607|  4.35k|            if (ZSTD_useTargetCBlockSize(&cctx->appliedParams)) {
  ------------------
  |  Branch (4607:17): [True: 0, False: 4.35k]
  ------------------
 4608|      0|                cSize = ZSTD_compressBlock_targetCBlockSize(cctx, op, dstCapacity, ip, blockSize, lastBlock);
 4609|      0|                FORWARD_IF_ERROR(cSize, "ZSTD_compressBlock_targetCBlockSize failed");
  ------------------
  |  |  146|      0|    do {                                                                           \
  |  |  147|      0|        size_t const err_code = (err);                                             \
  |  |  148|      0|        if (ERR_isError(err_code)) {                                               \
  |  |  ------------------
  |  |  |  Branch (148:13): [True: 0, False: 0]
  |  |  ------------------
  |  |  149|      0|            RAWLOG(3, "%s:%d: ERROR!: forwarding error in %s: %s",                 \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  150|      0|                  __FILE__, __LINE__, ERR_QUOTE(err), ERR_getErrorName(err_code)); \
  |  |  151|      0|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                                 \
  |  |  ------------------
  |  |  |  |   98|      0|    do {                                           \
  |  |  |  |   99|      0|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  152|      0|            RAWLOG(3, ": " __VA_ARGS__);                                           \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  153|      0|            RAWLOG(3, "\n");                                                       \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  154|      0|            return err_code;                                                       \
  |  |  155|      0|        }                                                                          \
  |  |  156|      0|    } while(0)
  |  |  ------------------
  |  |  |  Branch (156:13): [Folded, False: 0]
  |  |  ------------------
  ------------------
 4610|      0|                assert(cSize > 0);
  ------------------
  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 4611|      0|                assert(cSize <= blockSize + ZSTD_blockHeaderSize);
  ------------------
  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 4612|  4.35k|            } else if (ZSTD_blockSplitterEnabled(&cctx->appliedParams)) {
  ------------------
  |  Branch (4612:24): [True: 0, False: 4.35k]
  ------------------
 4613|      0|                cSize = ZSTD_compressBlock_splitBlock(cctx, op, dstCapacity, ip, blockSize, lastBlock);
 4614|      0|                FORWARD_IF_ERROR(cSize, "ZSTD_compressBlock_splitBlock failed");
  ------------------
  |  |  146|      0|    do {                                                                           \
  |  |  147|      0|        size_t const err_code = (err);                                             \
  |  |  148|      0|        if (ERR_isError(err_code)) {                                               \
  |  |  ------------------
  |  |  |  Branch (148:13): [True: 0, False: 0]
  |  |  ------------------
  |  |  149|      0|            RAWLOG(3, "%s:%d: ERROR!: forwarding error in %s: %s",                 \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  150|      0|                  __FILE__, __LINE__, ERR_QUOTE(err), ERR_getErrorName(err_code)); \
  |  |  151|      0|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                                 \
  |  |  ------------------
  |  |  |  |   98|      0|    do {                                           \
  |  |  |  |   99|      0|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  152|      0|            RAWLOG(3, ": " __VA_ARGS__);                                           \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  153|      0|            RAWLOG(3, "\n");                                                       \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  154|      0|            return err_code;                                                       \
  |  |  155|      0|        }                                                                          \
  |  |  156|      0|    } while(0)
  |  |  ------------------
  |  |  |  Branch (156:13): [Folded, False: 0]
  |  |  ------------------
  ------------------
 4615|      0|                assert(cSize > 0 || cctx->seqCollector.collectSequences == 1);
  ------------------
  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 4616|  4.35k|            } else {
 4617|  4.35k|                cSize = ZSTD_compressBlock_internal(cctx,
 4618|  4.35k|                                        op+ZSTD_blockHeaderSize, dstCapacity-ZSTD_blockHeaderSize,
 4619|  4.35k|                                        ip, blockSize, 1 /* frame */);
 4620|  4.35k|                FORWARD_IF_ERROR(cSize, "ZSTD_compressBlock_internal failed");
  ------------------
  |  |  146|  4.35k|    do {                                                                           \
  |  |  147|  4.35k|        size_t const err_code = (err);                                             \
  |  |  148|  4.35k|        if (ERR_isError(err_code)) {                                               \
  |  |  ------------------
  |  |  |  Branch (148:13): [True: 1.44k, False: 2.90k]
  |  |  ------------------
  |  |  149|  1.44k|            RAWLOG(3, "%s:%d: ERROR!: forwarding error in %s: %s",                 \
  |  |  ------------------
  |  |  |  |  103|  1.44k|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 1.44k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  150|  1.44k|                  __FILE__, __LINE__, ERR_QUOTE(err), ERR_getErrorName(err_code)); \
  |  |  151|  1.44k|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                                 \
  |  |  ------------------
  |  |  |  |   98|  1.44k|    do {                                           \
  |  |  |  |   99|  1.44k|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 1.44k]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|  1.44k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 1.44k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  152|  1.44k|            RAWLOG(3, ": " __VA_ARGS__);                                           \
  |  |  ------------------
  |  |  |  |  103|  1.44k|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 1.44k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  153|  1.44k|            RAWLOG(3, "\n");                                                       \
  |  |  ------------------
  |  |  |  |  103|  1.44k|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 1.44k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  154|  1.44k|            return err_code;                                                       \
  |  |  155|  1.44k|        }                                                                          \
  |  |  156|  4.35k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (156:13): [Folded, False: 2.90k]
  |  |  ------------------
  ------------------
 4621|       |
 4622|  2.90k|                if (cSize == 0) {  /* block is not compressible */
  ------------------
  |  Branch (4622:21): [True: 0, False: 2.90k]
  ------------------
 4623|      0|                    cSize = ZSTD_noCompressBlock(op, dstCapacity, ip, blockSize, lastBlock);
 4624|      0|                    FORWARD_IF_ERROR(cSize, "ZSTD_noCompressBlock failed");
  ------------------
  |  |  146|      0|    do {                                                                           \
  |  |  147|      0|        size_t const err_code = (err);                                             \
  |  |  148|      0|        if (ERR_isError(err_code)) {                                               \
  |  |  ------------------
  |  |  |  Branch (148:13): [True: 0, False: 0]
  |  |  ------------------
  |  |  149|      0|            RAWLOG(3, "%s:%d: ERROR!: forwarding error in %s: %s",                 \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  150|      0|                  __FILE__, __LINE__, ERR_QUOTE(err), ERR_getErrorName(err_code)); \
  |  |  151|      0|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                                 \
  |  |  ------------------
  |  |  |  |   98|      0|    do {                                           \
  |  |  |  |   99|      0|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  152|      0|            RAWLOG(3, ": " __VA_ARGS__);                                           \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  153|      0|            RAWLOG(3, "\n");                                                       \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  154|      0|            return err_code;                                                       \
  |  |  155|      0|        }                                                                          \
  |  |  156|      0|    } while(0)
  |  |  ------------------
  |  |  |  Branch (156:13): [Folded, False: 0]
  |  |  ------------------
  ------------------
 4625|  2.90k|                } else {
 4626|  2.90k|                    U32 const cBlockHeader = cSize == 1 ?
  ------------------
  |  Branch (4626:46): [True: 0, False: 2.90k]
  ------------------
 4627|      0|                        lastBlock + (((U32)bt_rle)<<1) + (U32)(blockSize << 3) :
 4628|  2.90k|                        lastBlock + (((U32)bt_compressed)<<1) + (U32)(cSize << 3);
 4629|  2.90k|                    MEM_writeLE24(op, cBlockHeader);
 4630|  2.90k|                    cSize += ZSTD_blockHeaderSize;
 4631|  2.90k|                }
 4632|  2.90k|            }  /* if (ZSTD_useTargetCBlockSize(&cctx->appliedParams))*/
 4633|       |
 4634|       |            /* @savings is employed to ensure that splitting doesn't worsen expansion of incompressible data.
 4635|       |             * Without splitting, the maximum expansion is 3 bytes per full block.
 4636|       |             * An adversarial input could attempt to fudge the split detector,
 4637|       |             * and make it split incompressible data, resulting in more block headers.
 4638|       |             * Note that, since ZSTD_COMPRESSBOUND() assumes a worst case scenario of 1KB per block,
 4639|       |             * and the splitter never creates blocks that small (current lower limit is 8 KB),
 4640|       |             * there is already no risk to expand beyond ZSTD_COMPRESSBOUND() limit.
 4641|       |             * But if the goal is to not expand by more than 3-bytes per 128 KB full block,
 4642|       |             * then yes, it becomes possible to make the block splitter oversplit incompressible data.
 4643|       |             * Using @savings, we enforce an even more conservative condition,
 4644|       |             * requiring the presence of enough savings (at least 3 bytes) to authorize splitting,
 4645|       |             * otherwise only full blocks are used.
 4646|       |             * But being conservative is fine,
 4647|       |             * since splitting barely compressible blocks is not fruitful anyway */
 4648|  2.90k|            savings += (S64)blockSize - (S64)cSize;
 4649|       |
 4650|  2.90k|            ip += blockSize;
 4651|  2.90k|            assert(remaining >= blockSize);
  ------------------
  |  |   70|  2.90k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 4652|  2.90k|            remaining -= blockSize;
 4653|  2.90k|            op += cSize;
 4654|  2.90k|            assert(dstCapacity >= cSize);
  ------------------
  |  |   70|  2.90k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 4655|  2.90k|            dstCapacity -= cSize;
 4656|  2.90k|            cctx->isFirstBlock = 0;
 4657|  2.90k|            DEBUGLOG(5, "ZSTD_compress_frameChunk: adding a block of size %u",
  ------------------
  |  |  104|  2.90k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 2.90k]
  |  |  ------------------
  ------------------
 4658|  2.90k|                        (unsigned)cSize);
 4659|  2.90k|    }   }
 4660|       |
 4661|  2.90k|    if (lastFrameChunk && (op>ostart)) cctx->stage = ZSTDcs_ending;
  ------------------
  |  Branch (4661:9): [True: 2.90k, False: 0]
  |  Branch (4661:27): [True: 2.90k, False: 0]
  ------------------
 4662|  2.90k|    return (size_t)(op-ostart);
 4663|  4.35k|}
zstd_compress.c:ZSTD_optimalBlockSize:
 4524|  4.35k|{
 4525|       |    /* split level based on compression strategy, from `fast` to `btultra2` */
 4526|  4.35k|    static const int splitLevels[] = { 0, 0, 1, 2, 2, 3, 3, 4, 4, 4 };
 4527|       |    /* note: conservatively only split full blocks (128 KB) currently.
 4528|       |     * While it's possible to go lower, let's keep it simple for a first implementation.
 4529|       |     * Besides, benefits of splitting are reduced when blocks are already small.
 4530|       |     */
 4531|  4.35k|    if (srcSize < 128 KB || blockSizeMax < 128 KB)
  ------------------
  |  |   67|  8.70k|#define KB *(1 <<10)
  ------------------
                  if (srcSize < 128 KB || blockSizeMax < 128 KB)
  ------------------
  |  |   67|      0|#define KB *(1 <<10)
  ------------------
  |  Branch (4531:9): [True: 4.35k, False: 0]
  |  Branch (4531:29): [True: 0, False: 0]
  ------------------
 4532|  4.35k|        return MIN(srcSize, blockSizeMax);
  ------------------
  |  |   54|  4.35k|#define MIN(a,b) ((a)<(b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (54:19): [True: 0, False: 4.35k]
  |  |  ------------------
  ------------------
 4533|       |    /* do not split incompressible data though:
 4534|       |     * require verified savings to allow pre-splitting.
 4535|       |     * Note: as a consequence, the first full block is not split.
 4536|       |     */
 4537|      0|    if (savings < 3) {
  ------------------
  |  Branch (4537:9): [True: 0, False: 0]
  ------------------
 4538|      0|        DEBUGLOG(6, "don't attempt splitting: savings (%i) too low", (int)savings);
  ------------------
  |  |  104|      0|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 0]
  |  |  ------------------
  ------------------
 4539|      0|        return 128 KB;
  ------------------
  |  |   67|      0|#define KB *(1 <<10)
  ------------------
 4540|      0|    }
 4541|       |    /* apply @splitLevel, or use default value (which depends on @strat).
 4542|       |     * note that splitting heuristic is still conditioned by @savings >= 3,
 4543|       |     * so the first block will not reach this code path */
 4544|      0|    if (splitLevel == 1) return 128 KB;
  ------------------
  |  |   67|      0|#define KB *(1 <<10)
  ------------------
  |  Branch (4544:9): [True: 0, False: 0]
  ------------------
 4545|      0|    if (splitLevel == 0) {
  ------------------
  |  Branch (4545:9): [True: 0, False: 0]
  ------------------
 4546|      0|        assert(ZSTD_fast <= strat && strat <= ZSTD_btultra2);
  ------------------
  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 4547|      0|        splitLevel = splitLevels[strat];
 4548|      0|    } else {
 4549|      0|        assert(2 <= splitLevel && splitLevel <= 6);
  ------------------
  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 4550|      0|        splitLevel -= 2;
 4551|      0|    }
 4552|      0|    return ZSTD_splitBlock(src, blockSizeMax, splitLevel, cctx->tmpWorkspace, cctx->tmpWkspSize);
 4553|      0|}
zstd_compress.c:ZSTD_useTargetCBlockSize:
 2694|  4.35k|{
 2695|  4.35k|    DEBUGLOG(5, "ZSTD_useTargetCBlockSize (targetCBlockSize=%zu)", cctxParams->targetCBlockSize);
  ------------------
  |  |  104|  4.35k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 4.35k]
  |  |  ------------------
  ------------------
 2696|  4.35k|    return (cctxParams->targetCBlockSize != 0);
 2697|  4.35k|}
zstd_compress.c:ZSTD_buildSeqStore:
 3233|  4.35k|{
 3234|  4.35k|    ZSTD_MatchState_t* const ms = &zc->blockState.matchState;
 3235|  4.35k|    DEBUGLOG(5, "ZSTD_buildSeqStore (srcSize=%zu)", srcSize);
  ------------------
  |  |  104|  4.35k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 4.35k]
  |  |  ------------------
  ------------------
 3236|  4.35k|    assert(srcSize <= ZSTD_BLOCKSIZE_MAX);
  ------------------
  |  |   70|  4.35k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 3237|       |    /* Assert that we have correctly flushed the ctx params into the ms's copy */
 3238|  4.35k|    ZSTD_assertEqualCParams(zc->appliedParams.cParams, ms->cParams);
 3239|       |    /* TODO: See 3090. We reduced MIN_CBLOCK_SIZE from 3 to 2 so to compensate we are adding
 3240|       |     * additional 1. We need to revisit and change this logic to be more consistent */
 3241|  4.35k|    if (srcSize < MIN_CBLOCK_SIZE+ZSTD_blockHeaderSize+1+1) {
  ------------------
  |  |   91|  4.35k|#define MIN_CBLOCK_SIZE (1 /*litCSize*/ + 1 /* RLE or RAW */)   /* for a non-null block */
  ------------------
  |  Branch (3241:9): [True: 0, False: 4.35k]
  ------------------
 3242|      0|        if (zc->appliedParams.cParams.strategy >= ZSTD_btopt) {
  ------------------
  |  Branch (3242:13): [True: 0, False: 0]
  ------------------
 3243|      0|            ZSTD_ldm_skipRawSeqStoreBytes(&zc->externSeqStore, srcSize);
 3244|      0|        } else {
 3245|      0|            ZSTD_ldm_skipSequences(&zc->externSeqStore, srcSize, zc->appliedParams.cParams.minMatch);
 3246|      0|        }
 3247|      0|        return ZSTDbss_noCompress; /* don't even attempt compression below a certain srcSize */
 3248|      0|    }
 3249|  4.35k|    ZSTD_resetSeqStore(&(zc->seqStore));
 3250|       |    /* required for optimal parser to read stats from dictionary */
 3251|  4.35k|    ms->opt.symbolCosts = &zc->blockState.prevCBlock->entropy;
 3252|       |    /* tell the optimal parser how we expect to compress literals */
 3253|  4.35k|    ms->opt.literalCompressionMode = zc->appliedParams.literalCompressionMode;
 3254|       |    /* a gap between an attached dict and the current window is not safe,
 3255|       |     * they must remain adjacent,
 3256|       |     * and when that stops being the case, the dict must be unset */
 3257|  4.35k|    assert(ms->dictMatchState == NULL || ms->loadedDictEnd == ms->window.dictLimit);
  ------------------
  |  |   70|  4.35k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 3258|       |
 3259|       |    /* limited update after a very long match */
 3260|  4.35k|    {   const BYTE* const base = ms->window.base;
 3261|  4.35k|        const BYTE* const istart = (const BYTE*)src;
 3262|  4.35k|        const U32 curr = (U32)(istart-base);
 3263|  4.35k|        if (sizeof(ptrdiff_t)==8) assert(istart - base < (ptrdiff_t)(U32)(-1));   /* ensure no overflow */
  ------------------
  |  |   70|  4.35k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  |  Branch (3263:13): [True: 4.35k, Folded]
  ------------------
 3264|  4.35k|        if (curr > ms->nextToUpdate + 384)
  ------------------
  |  Branch (3264:13): [True: 0, False: 4.35k]
  ------------------
 3265|      0|            ms->nextToUpdate = curr - MIN(192, (U32)(curr - ms->nextToUpdate - 384));
  ------------------
  |  |   54|      0|#define MIN(a,b) ((a)<(b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (54:19): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 3266|  4.35k|    }
 3267|       |
 3268|       |    /* select and store sequences */
 3269|  4.35k|    {   ZSTD_dictMode_e const dictMode = ZSTD_matchState_dictMode(ms);
 3270|  4.35k|        size_t lastLLSize;
 3271|  4.35k|        {   int i;
 3272|  17.4k|            for (i = 0; i < ZSTD_REP_NUM; ++i)
  ------------------
  |  |   64|  17.4k|#define ZSTD_REP_NUM      3                 /* number of repcodes */
  ------------------
  |  Branch (3272:25): [True: 13.0k, False: 4.35k]
  ------------------
 3273|  13.0k|                zc->blockState.nextCBlock->rep[i] = zc->blockState.prevCBlock->rep[i];
 3274|  4.35k|        }
 3275|  4.35k|        if (zc->externSeqStore.pos < zc->externSeqStore.size) {
  ------------------
  |  Branch (3275:13): [True: 0, False: 4.35k]
  ------------------
 3276|      0|            assert(zc->appliedParams.ldmParams.enableLdm == ZSTD_ps_disable);
  ------------------
  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 3277|       |
 3278|       |            /* External matchfinder + LDM is technically possible, just not implemented yet.
 3279|       |             * We need to revisit soon and implement it. */
 3280|      0|            RETURN_ERROR_IF(
  ------------------
  |  |  114|      0|    do {                                                                       \
  |  |  115|      0|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 0, False: 0]
  |  |  ------------------
  |  |  116|      0|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|      0|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|      0|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|      0|    do {                                           \
  |  |  |  |   99|      0|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|      0|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|      0|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|      0|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|      0|        }                                                                      \
  |  |  123|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
 3281|      0|                ZSTD_hasExtSeqProd(&zc->appliedParams),
 3282|      0|                parameter_combination_unsupported,
 3283|      0|                "Long-distance matching with external sequence producer enabled is not currently supported."
 3284|      0|            );
 3285|       |
 3286|       |            /* Updates ldmSeqStore.pos */
 3287|      0|            lastLLSize =
 3288|      0|                ZSTD_ldm_blockCompress(&zc->externSeqStore,
 3289|      0|                                       ms, &zc->seqStore,
 3290|      0|                                       zc->blockState.nextCBlock->rep,
 3291|      0|                                       zc->appliedParams.useRowMatchFinder,
 3292|      0|                                       src, srcSize);
 3293|      0|            assert(zc->externSeqStore.pos <= zc->externSeqStore.size);
  ------------------
  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 3294|  4.35k|        } else if (zc->appliedParams.ldmParams.enableLdm == ZSTD_ps_enable) {
  ------------------
  |  Branch (3294:20): [True: 0, False: 4.35k]
  ------------------
 3295|      0|            RawSeqStore_t ldmSeqStore = kNullRawSeqStore;
 3296|       |
 3297|       |            /* External matchfinder + LDM is technically possible, just not implemented yet.
 3298|       |             * We need to revisit soon and implement it. */
 3299|      0|            RETURN_ERROR_IF(
  ------------------
  |  |  114|      0|    do {                                                                       \
  |  |  115|      0|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 0, False: 0]
  |  |  ------------------
  |  |  116|      0|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|      0|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|      0|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|      0|    do {                                           \
  |  |  |  |   99|      0|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|      0|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|      0|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|      0|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|      0|        }                                                                      \
  |  |  123|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
 3300|      0|                ZSTD_hasExtSeqProd(&zc->appliedParams),
 3301|      0|                parameter_combination_unsupported,
 3302|      0|                "Long-distance matching with external sequence producer enabled is not currently supported."
 3303|      0|            );
 3304|       |
 3305|      0|            ldmSeqStore.seq = zc->ldmSequences;
 3306|      0|            ldmSeqStore.capacity = zc->maxNbLdmSequences;
 3307|       |            /* Updates ldmSeqStore.size */
 3308|      0|            FORWARD_IF_ERROR(ZSTD_ldm_generateSequences(&zc->ldmState, &ldmSeqStore,
  ------------------
  |  |  146|      0|    do {                                                                           \
  |  |  147|      0|        size_t const err_code = (err);                                             \
  |  |  148|      0|        if (ERR_isError(err_code)) {                                               \
  |  |  ------------------
  |  |  |  Branch (148:13): [True: 0, False: 0]
  |  |  ------------------
  |  |  149|      0|            RAWLOG(3, "%s:%d: ERROR!: forwarding error in %s: %s",                 \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  150|      0|                  __FILE__, __LINE__, ERR_QUOTE(err), ERR_getErrorName(err_code)); \
  |  |  151|      0|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                                 \
  |  |  ------------------
  |  |  |  |   98|      0|    do {                                           \
  |  |  |  |   99|      0|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  152|      0|            RAWLOG(3, ": " __VA_ARGS__);                                           \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  153|      0|            RAWLOG(3, "\n");                                                       \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  154|      0|            return err_code;                                                       \
  |  |  155|      0|        }                                                                          \
  |  |  156|      0|    } while(0)
  |  |  ------------------
  |  |  |  Branch (156:13): [Folded, False: 0]
  |  |  ------------------
  ------------------
 3309|      0|                                               &zc->appliedParams.ldmParams,
 3310|      0|                                               src, srcSize), "");
 3311|       |            /* Updates ldmSeqStore.pos */
 3312|      0|            lastLLSize =
 3313|      0|                ZSTD_ldm_blockCompress(&ldmSeqStore,
 3314|      0|                                       ms, &zc->seqStore,
 3315|      0|                                       zc->blockState.nextCBlock->rep,
 3316|      0|                                       zc->appliedParams.useRowMatchFinder,
 3317|      0|                                       src, srcSize);
 3318|      0|            assert(ldmSeqStore.pos == ldmSeqStore.size);
  ------------------
  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 3319|  4.35k|        } else if (ZSTD_hasExtSeqProd(&zc->appliedParams)) {
  ------------------
  |  Branch (3319:20): [True: 0, False: 4.35k]
  ------------------
 3320|      0|            assert(
  ------------------
  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 3321|      0|                zc->extSeqBufCapacity >= ZSTD_sequenceBound(srcSize)
 3322|      0|            );
 3323|      0|            assert(zc->appliedParams.extSeqProdFunc != NULL);
  ------------------
  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 3324|       |
 3325|      0|            {   U32 const windowSize = (U32)1 << zc->appliedParams.cParams.windowLog;
 3326|       |
 3327|      0|                size_t const nbExternalSeqs = (zc->appliedParams.extSeqProdFunc)(
 3328|      0|                    zc->appliedParams.extSeqProdState,
 3329|      0|                    zc->extSeqBuf,
 3330|      0|                    zc->extSeqBufCapacity,
 3331|      0|                    src, srcSize,
 3332|      0|                    NULL, 0,  /* dict and dictSize, currently not supported */
 3333|      0|                    zc->appliedParams.compressionLevel,
 3334|      0|                    windowSize
 3335|      0|                );
 3336|       |
 3337|      0|                size_t const nbPostProcessedSeqs = ZSTD_postProcessSequenceProducerResult(
 3338|      0|                    zc->extSeqBuf,
 3339|      0|                    nbExternalSeqs,
 3340|      0|                    zc->extSeqBufCapacity,
 3341|      0|                    srcSize
 3342|      0|                );
 3343|       |
 3344|       |                /* Return early if there is no error, since we don't need to worry about last literals */
 3345|      0|                if (!ZSTD_isError(nbPostProcessedSeqs)) {
  ------------------
  |  |   44|      0|#define ZSTD_isError ERR_isError   /* for inlining */
  ------------------
  |  Branch (3345:21): [True: 0, False: 0]
  ------------------
 3346|      0|                    ZSTD_SequencePosition seqPos = {0,0,0};
 3347|      0|                    size_t const seqLenSum = ZSTD_fastSequenceLengthSum(zc->extSeqBuf, nbPostProcessedSeqs);
 3348|      0|                    RETURN_ERROR_IF(seqLenSum > srcSize, externalSequences_invalid, "External sequences imply too large a block!");
  ------------------
  |  |  114|      0|    do {                                                                       \
  |  |  115|      0|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 0, False: 0]
  |  |  ------------------
  |  |  116|      0|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|      0|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|      0|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|      0|    do {                                           \
  |  |  |  |   99|      0|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|      0|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|      0|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|      0|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|      0|        }                                                                      \
  |  |  123|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
 3349|      0|                    FORWARD_IF_ERROR(
  ------------------
  |  |  146|      0|    do {                                                                           \
  |  |  147|      0|        size_t const err_code = (err);                                             \
  |  |  148|      0|        if (ERR_isError(err_code)) {                                               \
  |  |  ------------------
  |  |  |  Branch (148:13): [True: 0, False: 0]
  |  |  ------------------
  |  |  149|      0|            RAWLOG(3, "%s:%d: ERROR!: forwarding error in %s: %s",                 \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  150|      0|                  __FILE__, __LINE__, ERR_QUOTE(err), ERR_getErrorName(err_code)); \
  |  |  151|      0|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                                 \
  |  |  ------------------
  |  |  |  |   98|      0|    do {                                           \
  |  |  |  |   99|      0|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  152|      0|            RAWLOG(3, ": " __VA_ARGS__);                                           \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  153|      0|            RAWLOG(3, "\n");                                                       \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  154|      0|            return err_code;                                                       \
  |  |  155|      0|        }                                                                          \
  |  |  156|      0|    } while(0)
  |  |  ------------------
  |  |  |  Branch (156:13): [Folded, False: 0]
  |  |  ------------------
  ------------------
 3350|      0|                        ZSTD_transferSequences_wBlockDelim(
 3351|      0|                            zc, &seqPos,
 3352|      0|                            zc->extSeqBuf, nbPostProcessedSeqs,
 3353|      0|                            src, srcSize,
 3354|      0|                            zc->appliedParams.searchForExternalRepcodes
 3355|      0|                        ),
 3356|      0|                        "Failed to copy external sequences to seqStore!"
 3357|      0|                    );
 3358|      0|                    ms->ldmSeqStore = NULL;
 3359|      0|                    DEBUGLOG(5, "Copied %lu sequences from external sequence producer to internal seqStore.", (unsigned long)nbExternalSeqs);
  ------------------
  |  |  104|      0|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 0]
  |  |  ------------------
  ------------------
 3360|      0|                    return ZSTDbss_compress;
 3361|      0|                }
 3362|       |
 3363|       |                /* Propagate the error if fallback is disabled */
 3364|      0|                if (!zc->appliedParams.enableMatchFinderFallback) {
  ------------------
  |  Branch (3364:21): [True: 0, False: 0]
  ------------------
 3365|      0|                    return nbPostProcessedSeqs;
 3366|      0|                }
 3367|       |
 3368|       |                /* Fallback to software matchfinder */
 3369|      0|                {   ZSTD_BlockCompressor_f const blockCompressor =
 3370|      0|                        ZSTD_selectBlockCompressor(
 3371|      0|                            zc->appliedParams.cParams.strategy,
 3372|      0|                            zc->appliedParams.useRowMatchFinder,
 3373|      0|                            dictMode);
 3374|      0|                    ms->ldmSeqStore = NULL;
 3375|      0|                    DEBUGLOG(
  ------------------
  |  |  104|      0|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 0]
  |  |  ------------------
  ------------------
 3376|      0|                        5,
 3377|      0|                        "External sequence producer returned error code %lu. Falling back to internal parser.",
 3378|      0|                        (unsigned long)nbExternalSeqs
 3379|      0|                    );
 3380|      0|                    lastLLSize = blockCompressor(ms, &zc->seqStore, zc->blockState.nextCBlock->rep, src, srcSize);
 3381|      0|            }   }
 3382|  4.35k|        } else {   /* not long range mode and no external matchfinder */
 3383|  4.35k|            ZSTD_BlockCompressor_f const blockCompressor = ZSTD_selectBlockCompressor(
 3384|  4.35k|                    zc->appliedParams.cParams.strategy,
 3385|  4.35k|                    zc->appliedParams.useRowMatchFinder,
 3386|  4.35k|                    dictMode);
 3387|  4.35k|            ms->ldmSeqStore = NULL;
 3388|  4.35k|            lastLLSize = blockCompressor(ms, &zc->seqStore, zc->blockState.nextCBlock->rep, src, srcSize);
 3389|  4.35k|        }
 3390|  4.35k|        {   const BYTE* const lastLiterals = (const BYTE*)src + srcSize - lastLLSize;
 3391|  4.35k|            ZSTD_storeLastLiterals(&zc->seqStore, lastLiterals, lastLLSize);
 3392|  4.35k|    }   }
 3393|      0|    ZSTD_validateSeqStore(&zc->seqStore, &zc->appliedParams.cParams);
 3394|  4.35k|    return ZSTDbss_compress;
 3395|  4.35k|}
zstd_compress.c:ZSTD_assertEqualCParams:
 1956|  4.35k|{
 1957|  4.35k|    (void)cParams1;
 1958|  4.35k|    (void)cParams2;
 1959|  4.35k|    assert(cParams1.windowLog    == cParams2.windowLog);
  ------------------
  |  |   70|  4.35k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1960|  4.35k|    assert(cParams1.chainLog     == cParams2.chainLog);
  ------------------
  |  |   70|  4.35k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1961|  4.35k|    assert(cParams1.hashLog      == cParams2.hashLog);
  ------------------
  |  |   70|  4.35k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1962|  4.35k|    assert(cParams1.searchLog    == cParams2.searchLog);
  ------------------
  |  |   70|  4.35k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1963|  4.35k|    assert(cParams1.minMatch     == cParams2.minMatch);
  ------------------
  |  |   70|  4.35k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1964|  4.35k|    assert(cParams1.targetLength == cParams2.targetLength);
  ------------------
  |  |   70|  4.35k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1965|  4.35k|    assert(cParams1.strategy     == cParams2.strategy);
  ------------------
  |  |   70|  4.35k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1966|  4.35k|}
zstd_compress.c:ZSTD_storeLastLiterals:
 3124|  4.35k|{
 3125|  4.35k|    ZSTD_memcpy(seqStorePtr->lit, anchor, lastLLSize);
  ------------------
  |  |   44|  4.35k|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  ------------------
 3126|  4.35k|    seqStorePtr->lit += lastLLSize;
 3127|  4.35k|}
zstd_compress.c:ZSTD_validateSeqStore:
 3206|  4.35k|{
 3207|       |#if DEBUGLEVEL >= 1
 3208|       |    const SeqDef* seq = seqStore->sequencesStart;
 3209|       |    const SeqDef* const seqEnd = seqStore->sequences;
 3210|       |    size_t const matchLenLowerBound = cParams->minMatch == 3 ? 3 : 4;
 3211|       |    for (; seq < seqEnd; ++seq) {
 3212|       |        const ZSTD_SequenceLength seqLength = ZSTD_getSequenceLength(seqStore, seq);
 3213|       |        assert(seqLength.matchLength >= matchLenLowerBound);
 3214|       |        (void)seqLength;
 3215|       |        (void)matchLenLowerBound;
 3216|       |    }
 3217|       |#else
 3218|  4.35k|    (void)seqStore;
 3219|  4.35k|    (void)cParams;
 3220|  4.35k|#endif
 3221|  4.35k|}
zstd_compress.c:ZSTD_blockState_confirmRepcodesAndEntropyTables:
 3576|  2.90k|{
 3577|  2.90k|    ZSTD_compressedBlockState_t* const tmp = bs->prevCBlock;
 3578|  2.90k|    bs->prevCBlock = bs->nextCBlock;
 3579|  2.90k|    bs->nextCBlock = tmp;
 3580|  2.90k|}
zstd_compress.c:ZSTD_blockSplitterEnabled:
 2705|  4.35k|{
 2706|  4.35k|    DEBUGLOG(5, "ZSTD_blockSplitterEnabled (postBlockSplitter=%d)", cctxParams->postBlockSplitter);
  ------------------
  |  |  104|  4.35k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 4.35k]
  |  |  ------------------
  ------------------
 2707|  4.35k|    assert(cctxParams->postBlockSplitter != ZSTD_ps_auto);
  ------------------
  |  |   70|  4.35k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 2708|  4.35k|    return (cctxParams->postBlockSplitter == ZSTD_ps_enable);
 2709|  4.35k|}
zstd_compress.c:ZSTD_entropyCompressSeqStore:
 3022|  4.35k|{
 3023|  4.35k|    return ZSTD_entropyCompressSeqStore_wExtLitBuffer(
 3024|  4.35k|                dst, dstCapacity,
 3025|  4.35k|                seqStorePtr->litStart, (size_t)(seqStorePtr->lit - seqStorePtr->litStart),
 3026|  4.35k|                srcSize,
 3027|  4.35k|                seqStorePtr,
 3028|  4.35k|                prevEntropy, nextEntropy,
 3029|  4.35k|                cctxParams,
 3030|  4.35k|                entropyWorkspace, entropyWkspSize,
 3031|  4.35k|                bmi2);
 3032|  4.35k|}
zstd_compress.c:ZSTD_entropyCompressSeqStore_wExtLitBuffer:
 2984|  4.35k|{
 2985|  4.35k|    size_t const cSize = ZSTD_entropyCompressSeqStore_internal(
 2986|  4.35k|                            dst, dstCapacity,
 2987|  4.35k|                            literals, litSize,
 2988|  4.35k|                            seqStorePtr, prevEntropy, nextEntropy, cctxParams,
 2989|  4.35k|                            entropyWorkspace, entropyWkspSize, bmi2);
 2990|  4.35k|    if (cSize == 0) return 0;
  ------------------
  |  Branch (2990:9): [True: 0, False: 4.35k]
  ------------------
 2991|       |    /* When srcSize <= dstCapacity, there is enough space to write a raw uncompressed block.
 2992|       |     * Since we ran out of space, block must be not compressible, so fall back to raw uncompressed block.
 2993|       |     */
 2994|  4.35k|    if ((cSize == ERROR(dstSize_tooSmall)) & (blockSize <= dstCapacity)) {
  ------------------
  |  |   49|  4.35k|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|  4.35k|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|  4.35k|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2994:9): [True: 0, False: 4.35k]
  ------------------
 2995|      0|        DEBUGLOG(4, "not enough dstCapacity (%zu) for ZSTD_entropyCompressSeqStore_internal()=> do not compress block", dstCapacity);
  ------------------
  |  |  104|      0|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2996|      0|        return 0;  /* block not compressed */
 2997|      0|    }
 2998|  4.35k|    FORWARD_IF_ERROR(cSize, "ZSTD_entropyCompressSeqStore_internal failed");
  ------------------
  |  |  146|  4.35k|    do {                                                                           \
  |  |  147|  4.35k|        size_t const err_code = (err);                                             \
  |  |  148|  4.35k|        if (ERR_isError(err_code)) {                                               \
  |  |  ------------------
  |  |  |  Branch (148:13): [True: 1.44k, False: 2.90k]
  |  |  ------------------
  |  |  149|  1.44k|            RAWLOG(3, "%s:%d: ERROR!: forwarding error in %s: %s",                 \
  |  |  ------------------
  |  |  |  |  103|  1.44k|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 1.44k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  150|  1.44k|                  __FILE__, __LINE__, ERR_QUOTE(err), ERR_getErrorName(err_code)); \
  |  |  151|  1.44k|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                                 \
  |  |  ------------------
  |  |  |  |   98|  1.44k|    do {                                           \
  |  |  |  |   99|  1.44k|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 1.44k]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|  1.44k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 1.44k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  152|  1.44k|            RAWLOG(3, ": " __VA_ARGS__);                                           \
  |  |  ------------------
  |  |  |  |  103|  1.44k|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 1.44k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  153|  1.44k|            RAWLOG(3, "\n");                                                       \
  |  |  ------------------
  |  |  |  |  103|  1.44k|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 1.44k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  154|  1.44k|            return err_code;                                                       \
  |  |  155|  1.44k|        }                                                                          \
  |  |  156|  4.35k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (156:13): [Folded, False: 2.90k]
  |  |  ------------------
  ------------------
 2999|       |
 3000|       |    /* Check compressibility */
 3001|  2.90k|    {   size_t const maxCSize = blockSize - ZSTD_minGain(blockSize, cctxParams->cParams.strategy);
 3002|  2.90k|        if (cSize >= maxCSize) return 0;  /* block not compressed */
  ------------------
  |  Branch (3002:13): [True: 0, False: 2.90k]
  ------------------
 3003|  2.90k|    }
 3004|  2.90k|    DEBUGLOG(5, "ZSTD_entropyCompressSeqStore() cSize: %zu", cSize);
  ------------------
  |  |  104|  2.90k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 2.90k]
  |  |  ------------------
  ------------------
 3005|       |    /* libzstd decoder before  > v1.5.4 is not compatible with compressed blocks of size ZSTD_BLOCKSIZE_MAX exactly.
 3006|       |     * This restriction is indirectly already fulfilled by respecting ZSTD_minGain() condition above.
 3007|       |     */
 3008|  2.90k|    assert(cSize < ZSTD_BLOCKSIZE_MAX);
  ------------------
  |  |   70|  2.90k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 3009|  2.90k|    return cSize;
 3010|  2.90k|}
zstd_compress.c:ZSTD_entropyCompressSeqStore_internal:
 2865|  4.35k|{
 2866|  4.35k|    ZSTD_strategy const strategy = cctxParams->cParams.strategy;
 2867|  4.35k|    unsigned* count = (unsigned*)entropyWorkspace;
 2868|  4.35k|    FSE_CTable* CTable_LitLength = nextEntropy->fse.litlengthCTable;
 2869|  4.35k|    FSE_CTable* CTable_OffsetBits = nextEntropy->fse.offcodeCTable;
 2870|  4.35k|    FSE_CTable* CTable_MatchLength = nextEntropy->fse.matchlengthCTable;
 2871|  4.35k|    const SeqDef* const sequences = seqStorePtr->sequencesStart;
 2872|  4.35k|    const size_t nbSeq = (size_t)(seqStorePtr->sequences - seqStorePtr->sequencesStart);
 2873|  4.35k|    const BYTE* const ofCodeTable = seqStorePtr->ofCode;
 2874|  4.35k|    const BYTE* const llCodeTable = seqStorePtr->llCode;
 2875|  4.35k|    const BYTE* const mlCodeTable = seqStorePtr->mlCode;
 2876|  4.35k|    BYTE* const ostart = (BYTE*)dst;
 2877|  4.35k|    BYTE* const oend = ostart + dstCapacity;
 2878|  4.35k|    BYTE* op = ostart;
 2879|  4.35k|    size_t lastCountSize;
 2880|  4.35k|    int longOffsets = 0;
 2881|       |
 2882|  4.35k|    entropyWorkspace = count + (MaxSeq + 1);
  ------------------
  |  |  107|  4.35k|#define MaxSeq MAX(MaxLL, MaxML)   /* Assumption : MaxOff < MaxLL,MaxML */
  |  |  ------------------
  |  |  |  |   55|  4.35k|#define MAX(a,b) ((a)>(b) ? (a) : (b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (55:19): [Folded, False: 4.35k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2883|  4.35k|    entropyWkspSize -= (MaxSeq + 1) * sizeof(*count);
  ------------------
  |  |  107|  4.35k|#define MaxSeq MAX(MaxLL, MaxML)   /* Assumption : MaxOff < MaxLL,MaxML */
  |  |  ------------------
  |  |  |  |   55|  4.35k|#define MAX(a,b) ((a)>(b) ? (a) : (b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (55:19): [Folded, False: 4.35k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2884|       |
 2885|  4.35k|    DEBUGLOG(5, "ZSTD_entropyCompressSeqStore_internal (nbSeq=%zu, dstCapacity=%zu)", nbSeq, dstCapacity);
  ------------------
  |  |  104|  4.35k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 4.35k]
  |  |  ------------------
  ------------------
 2886|  4.35k|    ZSTD_STATIC_ASSERT(HUF_WORKSPACE_SIZE >= (1<<MAX(MLFSELog,LLFSELog)));
  ------------------
  |  |   43|  4.35k|#define ZSTD_STATIC_ASSERT(c) DEBUG_STATIC_ASSERT(c)
  |  |  ------------------
  |  |  |  |   39|  4.35k|#define DEBUG_STATIC_ASSERT(c) (void)sizeof(char[(c) ? 1 : -1])
  |  |  ------------------
  ------------------
 2887|  4.35k|    assert(entropyWkspSize >= HUF_WORKSPACE_SIZE);
  ------------------
  |  |   70|  4.35k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 2888|       |
 2889|       |    /* Compress literals */
 2890|  4.35k|    {   size_t const numSequences = (size_t)(seqStorePtr->sequences - seqStorePtr->sequencesStart);
 2891|       |        /* Base suspicion of uncompressibility on ratio of literals to sequences */
 2892|  4.35k|        int const suspectUncompressible = (numSequences == 0) || (litSize / numSequences >= SUSPECT_UNCOMPRESSIBLE_LITERAL_RATIO);
  ------------------
  |  | 2854|  3.52k|#define SUSPECT_UNCOMPRESSIBLE_LITERAL_RATIO 20
  ------------------
  |  Branch (2892:43): [True: 828, False: 3.52k]
  |  Branch (2892:66): [True: 1.74k, False: 1.78k]
  ------------------
 2893|       |
 2894|  4.35k|        size_t const cSize = ZSTD_compressLiterals(
 2895|  4.35k|                                    op, dstCapacity,
 2896|  4.35k|                                    literals, litSize,
 2897|  4.35k|                                    entropyWorkspace, entropyWkspSize,
 2898|  4.35k|                                    &prevEntropy->huf, &nextEntropy->huf,
 2899|  4.35k|                                    cctxParams->cParams.strategy,
 2900|  4.35k|                                    ZSTD_literalsCompressionIsDisabled(cctxParams),
 2901|  4.35k|                                    suspectUncompressible, bmi2);
 2902|  4.35k|        FORWARD_IF_ERROR(cSize, "ZSTD_compressLiterals failed");
  ------------------
  |  |  146|  4.35k|    do {                                                                           \
  |  |  147|  4.35k|        size_t const err_code = (err);                                             \
  |  |  148|  4.35k|        if (ERR_isError(err_code)) {                                               \
  |  |  ------------------
  |  |  |  Branch (148:13): [True: 961, False: 3.39k]
  |  |  ------------------
  |  |  149|    961|            RAWLOG(3, "%s:%d: ERROR!: forwarding error in %s: %s",                 \
  |  |  ------------------
  |  |  |  |  103|    961|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 961]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  150|    961|                  __FILE__, __LINE__, ERR_QUOTE(err), ERR_getErrorName(err_code)); \
  |  |  151|    961|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                                 \
  |  |  ------------------
  |  |  |  |   98|    961|    do {                                           \
  |  |  |  |   99|    961|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 961]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|    961|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 961]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  152|    961|            RAWLOG(3, ": " __VA_ARGS__);                                           \
  |  |  ------------------
  |  |  |  |  103|    961|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 961]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  153|    961|            RAWLOG(3, "\n");                                                       \
  |  |  ------------------
  |  |  |  |  103|    961|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 961]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  154|    961|            return err_code;                                                       \
  |  |  155|    961|        }                                                                          \
  |  |  156|  4.35k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (156:13): [Folded, False: 3.39k]
  |  |  ------------------
  ------------------
 2903|  3.39k|        assert(cSize <= dstCapacity);
  ------------------
  |  |   70|  3.39k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 2904|  3.39k|        op += cSize;
 2905|  3.39k|    }
 2906|       |
 2907|       |    /* Sequences Header */
 2908|  3.39k|    RETURN_ERROR_IF((oend-op) < 3 /*max nbSeq Size*/ + 1 /*seqHead*/,
  ------------------
  |  |  114|  3.39k|    do {                                                                       \
  |  |  115|  3.39k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 79, False: 3.31k]
  |  |  ------------------
  |  |  116|     79|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|     79|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 79]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|     79|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|     79|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|     79|    do {                                           \
  |  |  |  |   99|     79|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 79]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|     79|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 79]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|     79|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|     79|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 79]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|     79|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|     79|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 79]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|     79|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|     79|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|     79|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|     79|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|     79|        }                                                                      \
  |  |  123|  3.39k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 3.31k]
  |  |  ------------------
  ------------------
 2909|  3.39k|                    dstSize_tooSmall, "Can't fit seq hdr in output buf!");
 2910|  3.31k|    if (nbSeq < 128) {
  ------------------
  |  Branch (2910:9): [True: 3.31k, False: 0]
  ------------------
 2911|  3.31k|        *op++ = (BYTE)nbSeq;
 2912|  3.31k|    } else if (nbSeq < LONGNBSEQ) {
  ------------------
  |  |   96|      0|#define LONGNBSEQ 0x7F00
  ------------------
  |  Branch (2912:16): [True: 0, False: 0]
  ------------------
 2913|      0|        op[0] = (BYTE)((nbSeq>>8) + 0x80);
 2914|      0|        op[1] = (BYTE)nbSeq;
 2915|      0|        op+=2;
 2916|      0|    } else {
 2917|      0|        op[0]=0xFF;
 2918|      0|        MEM_writeLE16(op+1, (U16)(nbSeq - LONGNBSEQ));
  ------------------
  |  |   96|      0|#define LONGNBSEQ 0x7F00
  ------------------
 2919|      0|        op+=3;
 2920|      0|    }
 2921|  3.31k|    assert(op <= oend);
  ------------------
  |  |   70|  3.31k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 2922|  3.31k|    if (nbSeq==0) {
  ------------------
  |  Branch (2922:9): [True: 496, False: 2.81k]
  ------------------
 2923|       |        /* Copy the old tables over as if we repeated them */
 2924|    496|        ZSTD_memcpy(&nextEntropy->fse, &prevEntropy->fse, sizeof(prevEntropy->fse));
  ------------------
  |  |   44|    496|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  ------------------
 2925|    496|        return (size_t)(op - ostart);
 2926|    496|    }
 2927|  2.81k|    {   BYTE* const seqHead = op++;
 2928|       |        /* build stats for sequences */
 2929|  2.81k|        const ZSTD_symbolEncodingTypeStats_t stats =
 2930|  2.81k|                ZSTD_buildSequencesStatistics(seqStorePtr, nbSeq,
 2931|  2.81k|                                             &prevEntropy->fse, &nextEntropy->fse,
 2932|  2.81k|                                              op, oend,
 2933|  2.81k|                                              strategy, count,
 2934|  2.81k|                                              entropyWorkspace, entropyWkspSize);
 2935|  2.81k|        FORWARD_IF_ERROR(stats.size, "ZSTD_buildSequencesStatistics failed!");
  ------------------
  |  |  146|  2.81k|    do {                                                                           \
  |  |  147|  2.81k|        size_t const err_code = (err);                                             \
  |  |  148|  2.81k|        if (ERR_isError(err_code)) {                                               \
  |  |  ------------------
  |  |  |  Branch (148:13): [True: 9, False: 2.80k]
  |  |  ------------------
  |  |  149|      9|            RAWLOG(3, "%s:%d: ERROR!: forwarding error in %s: %s",                 \
  |  |  ------------------
  |  |  |  |  103|      9|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 9]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  150|      9|                  __FILE__, __LINE__, ERR_QUOTE(err), ERR_getErrorName(err_code)); \
  |  |  151|      9|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                                 \
  |  |  ------------------
  |  |  |  |   98|      9|    do {                                           \
  |  |  |  |   99|      9|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 9]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      9|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 9]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  152|      9|            RAWLOG(3, ": " __VA_ARGS__);                                           \
  |  |  ------------------
  |  |  |  |  103|      9|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 9]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  153|      9|            RAWLOG(3, "\n");                                                       \
  |  |  ------------------
  |  |  |  |  103|      9|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 9]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  154|      9|            return err_code;                                                       \
  |  |  155|      9|        }                                                                          \
  |  |  156|  2.81k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (156:13): [Folded, False: 2.80k]
  |  |  ------------------
  ------------------
 2936|  2.80k|        *seqHead = (BYTE)((stats.LLtype<<6) + (stats.Offtype<<4) + (stats.MLtype<<2));
 2937|  2.80k|        lastCountSize = stats.lastCountSize;
 2938|  2.80k|        op += stats.size;
 2939|  2.80k|        longOffsets = stats.longOffsets;
 2940|  2.80k|    }
 2941|       |
 2942|      0|    {   size_t const bitstreamSize = ZSTD_encodeSequences(
 2943|  2.80k|                                        op, (size_t)(oend - op),
 2944|  2.80k|                                        CTable_MatchLength, mlCodeTable,
 2945|  2.80k|                                        CTable_OffsetBits, ofCodeTable,
 2946|  2.80k|                                        CTable_LitLength, llCodeTable,
 2947|  2.80k|                                        sequences, nbSeq,
 2948|  2.80k|                                        longOffsets, bmi2);
 2949|  2.80k|        FORWARD_IF_ERROR(bitstreamSize, "ZSTD_encodeSequences failed");
  ------------------
  |  |  146|  2.80k|    do {                                                                           \
  |  |  147|  2.80k|        size_t const err_code = (err);                                             \
  |  |  148|  2.80k|        if (ERR_isError(err_code)) {                                               \
  |  |  ------------------
  |  |  |  Branch (148:13): [True: 400, False: 2.40k]
  |  |  ------------------
  |  |  149|    400|            RAWLOG(3, "%s:%d: ERROR!: forwarding error in %s: %s",                 \
  |  |  ------------------
  |  |  |  |  103|    400|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 400]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  150|    400|                  __FILE__, __LINE__, ERR_QUOTE(err), ERR_getErrorName(err_code)); \
  |  |  151|    400|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                                 \
  |  |  ------------------
  |  |  |  |   98|    400|    do {                                           \
  |  |  |  |   99|    400|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 400]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|    400|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 400]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  152|    400|            RAWLOG(3, ": " __VA_ARGS__);                                           \
  |  |  ------------------
  |  |  |  |  103|    400|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 400]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  153|    400|            RAWLOG(3, "\n");                                                       \
  |  |  ------------------
  |  |  |  |  103|    400|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 400]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  154|    400|            return err_code;                                                       \
  |  |  155|    400|        }                                                                          \
  |  |  156|  2.80k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (156:13): [Folded, False: 2.40k]
  |  |  ------------------
  ------------------
 2950|  2.40k|        op += bitstreamSize;
 2951|  2.40k|        assert(op <= oend);
  ------------------
  |  |   70|  2.40k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 2952|       |        /* zstd versions <= 1.3.4 mistakenly report corruption when
 2953|       |         * FSE_readNCount() receives a buffer < 4 bytes.
 2954|       |         * Fixed by https://github.com/facebook/zstd/pull/1146.
 2955|       |         * This can happen when the last set_compressed table present is 2
 2956|       |         * bytes and the bitstream is only one byte.
 2957|       |         * In this exceedingly rare case, we will simply emit an uncompressed
 2958|       |         * block, since it isn't worth optimizing.
 2959|       |         */
 2960|  2.40k|        if (lastCountSize && (lastCountSize + bitstreamSize) < 4) {
  ------------------
  |  Branch (2960:13): [True: 400, False: 2.00k]
  |  Branch (2960:30): [True: 0, False: 400]
  ------------------
 2961|       |            /* lastCountSize >= 2 && bitstreamSize > 0 ==> lastCountSize == 3 */
 2962|      0|            assert(lastCountSize + bitstreamSize == 3);
  ------------------
  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 2963|      0|            DEBUGLOG(5, "Avoiding bug in zstd decoder in versions <= 1.3.4 by "
  ------------------
  |  |  104|      0|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2964|      0|                        "emitting an uncompressed block.");
 2965|      0|            return 0;
 2966|      0|        }
 2967|  2.40k|    }
 2968|       |
 2969|  2.40k|    DEBUGLOG(5, "compressed block size : %u", (unsigned)(op - ostart));
  ------------------
  |  |  104|  2.40k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 2.40k]
  |  |  ------------------
  ------------------
 2970|  2.40k|    return (size_t)(op - ostart);
 2971|  2.40k|}
zstd_compress.c:ZSTD_compressBlock_internal:
 4357|  4.35k|{
 4358|       |    /* This is an estimated upper bound for the length of an rle block.
 4359|       |     * This isn't the actual upper bound.
 4360|       |     * Finding the real threshold needs further investigation.
 4361|       |     */
 4362|  4.35k|    const U32 rleMaxLength = 25;
 4363|  4.35k|    size_t cSize;
 4364|  4.35k|    const BYTE* ip = (const BYTE*)src;
 4365|  4.35k|    BYTE* op = (BYTE*)dst;
 4366|  4.35k|    DEBUGLOG(5, "ZSTD_compressBlock_internal (dstCapacity=%u, dictLimit=%u, nextToUpdate=%u)",
  ------------------
  |  |  104|  4.35k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 4.35k]
  |  |  ------------------
  ------------------
 4367|  4.35k|                (unsigned)dstCapacity, (unsigned)zc->blockState.matchState.window.dictLimit,
 4368|  4.35k|                (unsigned)zc->blockState.matchState.nextToUpdate);
 4369|       |
 4370|  4.35k|    {   const size_t bss = ZSTD_buildSeqStore(zc, src, srcSize);
 4371|  4.35k|        FORWARD_IF_ERROR(bss, "ZSTD_buildSeqStore failed");
  ------------------
  |  |  146|  4.35k|    do {                                                                           \
  |  |  147|  4.35k|        size_t const err_code = (err);                                             \
  |  |  148|  4.35k|        if (ERR_isError(err_code)) {                                               \
  |  |  ------------------
  |  |  |  Branch (148:13): [True: 0, False: 4.35k]
  |  |  ------------------
  |  |  149|      0|            RAWLOG(3, "%s:%d: ERROR!: forwarding error in %s: %s",                 \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  150|      0|                  __FILE__, __LINE__, ERR_QUOTE(err), ERR_getErrorName(err_code)); \
  |  |  151|      0|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                                 \
  |  |  ------------------
  |  |  |  |   98|      0|    do {                                           \
  |  |  |  |   99|      0|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  152|      0|            RAWLOG(3, ": " __VA_ARGS__);                                           \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  153|      0|            RAWLOG(3, "\n");                                                       \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  154|      0|            return err_code;                                                       \
  |  |  155|      0|        }                                                                          \
  |  |  156|  4.35k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (156:13): [Folded, False: 4.35k]
  |  |  ------------------
  ------------------
 4372|  4.35k|        if (bss == ZSTDbss_noCompress) {
  ------------------
  |  Branch (4372:13): [True: 0, False: 4.35k]
  ------------------
 4373|      0|            RETURN_ERROR_IF(zc->seqCollector.collectSequences, sequenceProducer_failed, "Uncompressible block");
  ------------------
  |  |  114|      0|    do {                                                                       \
  |  |  115|      0|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 0, False: 0]
  |  |  ------------------
  |  |  116|      0|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|      0|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|      0|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|      0|    do {                                           \
  |  |  |  |   99|      0|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|      0|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|      0|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|      0|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|      0|        }                                                                      \
  |  |  123|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
 4374|      0|            cSize = 0;
 4375|      0|            goto out;
 4376|      0|        }
 4377|  4.35k|    }
 4378|       |
 4379|  4.35k|    if (zc->seqCollector.collectSequences) {
  ------------------
  |  Branch (4379:9): [True: 0, False: 4.35k]
  ------------------
 4380|      0|        FORWARD_IF_ERROR(ZSTD_copyBlockSequences(&zc->seqCollector, ZSTD_getSeqStore(zc), zc->blockState.prevCBlock->rep), "copyBlockSequences failed");
  ------------------
  |  |  146|      0|    do {                                                                           \
  |  |  147|      0|        size_t const err_code = (err);                                             \
  |  |  148|      0|        if (ERR_isError(err_code)) {                                               \
  |  |  ------------------
  |  |  |  Branch (148:13): [True: 0, False: 0]
  |  |  ------------------
  |  |  149|      0|            RAWLOG(3, "%s:%d: ERROR!: forwarding error in %s: %s",                 \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  150|      0|                  __FILE__, __LINE__, ERR_QUOTE(err), ERR_getErrorName(err_code)); \
  |  |  151|      0|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                                 \
  |  |  ------------------
  |  |  |  |   98|      0|    do {                                           \
  |  |  |  |   99|      0|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  152|      0|            RAWLOG(3, ": " __VA_ARGS__);                                           \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  153|      0|            RAWLOG(3, "\n");                                                       \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  154|      0|            return err_code;                                                       \
  |  |  155|      0|        }                                                                          \
  |  |  156|      0|    } while(0)
  |  |  ------------------
  |  |  |  Branch (156:13): [Folded, False: 0]
  |  |  ------------------
  ------------------
 4381|      0|        ZSTD_blockState_confirmRepcodesAndEntropyTables(&zc->blockState);
 4382|      0|        return 0;
 4383|      0|    }
 4384|       |
 4385|       |    /* encode sequences and literals */
 4386|  4.35k|    cSize = ZSTD_entropyCompressSeqStore(&zc->seqStore,
 4387|  4.35k|            &zc->blockState.prevCBlock->entropy, &zc->blockState.nextCBlock->entropy,
 4388|  4.35k|            &zc->appliedParams,
 4389|  4.35k|            dst, dstCapacity,
 4390|  4.35k|            srcSize,
 4391|  4.35k|            zc->tmpWorkspace, zc->tmpWkspSize /* statically allocated in resetCCtx */,
 4392|  4.35k|            ZSTD_CCtx_get_bmi2(zc));
 4393|       |
 4394|  4.35k|    if (frame &&
  ------------------
  |  Branch (4394:9): [True: 4.35k, False: 0]
  ------------------
 4395|       |        /* We don't want to emit our first block as a RLE even if it qualifies because
 4396|       |         * doing so will cause the decoder (cli only) to throw a "should consume all input error."
 4397|       |         * This is only an issue for zstd <= v1.4.3
 4398|       |         */
 4399|  4.35k|        !zc->isFirstBlock &&
  ------------------
  |  Branch (4399:9): [True: 0, False: 4.35k]
  ------------------
 4400|      0|        cSize < rleMaxLength &&
  ------------------
  |  Branch (4400:9): [True: 0, False: 0]
  ------------------
 4401|      0|        ZSTD_isRLE(ip, srcSize))
  ------------------
  |  Branch (4401:9): [True: 0, False: 0]
  ------------------
 4402|      0|    {
 4403|      0|        cSize = 1;
 4404|      0|        op[0] = ip[0];
 4405|      0|    }
 4406|       |
 4407|  4.35k|out:
 4408|  4.35k|    if (!ZSTD_isError(cSize) && cSize > 1) {
  ------------------
  |  |   44|  4.35k|#define ZSTD_isError ERR_isError   /* for inlining */
  ------------------
  |  Branch (4408:9): [True: 2.90k, False: 1.44k]
  |  Branch (4408:33): [True: 2.90k, False: 0]
  ------------------
 4409|  2.90k|        ZSTD_blockState_confirmRepcodesAndEntropyTables(&zc->blockState);
 4410|  2.90k|    }
 4411|       |    /* We check that dictionaries have offset codes available for the first
 4412|       |     * block. After the first block, the offcode table might not have large
 4413|       |     * enough codes to represent the offsets in the data.
 4414|       |     */
 4415|  4.35k|    if (zc->blockState.prevCBlock->entropy.fse.offcode_repeatMode == FSE_repeat_valid)
  ------------------
  |  Branch (4415:9): [True: 0, False: 4.35k]
  ------------------
 4416|      0|        zc->blockState.prevCBlock->entropy.fse.offcode_repeatMode = FSE_repeat_check;
 4417|       |
 4418|  4.35k|    return cSize;
 4419|  4.35k|}
zstd_compress.c:ZSTD_compressBegin_internal:
 5235|  4.36k|{
 5236|  4.36k|    size_t const dictContentSize = cdict ? cdict->dictContentSize : dictSize;
  ------------------
  |  Branch (5236:36): [True: 0, False: 4.36k]
  ------------------
 5237|  4.36k|#if ZSTD_TRACE
 5238|  4.36k|    cctx->traceCtx = (ZSTD_trace_compress_begin != NULL) ? ZSTD_trace_compress_begin(cctx) : 0;
  ------------------
  |  Branch (5238:22): [True: 0, False: 4.36k]
  ------------------
 5239|  4.36k|#endif
 5240|  4.36k|    DEBUGLOG(4, "ZSTD_compressBegin_internal: wlog=%u", params->cParams.windowLog);
  ------------------
  |  |  104|  4.36k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 4.36k]
  |  |  ------------------
  ------------------
 5241|       |    /* params are supposed to be fully validated at this point */
 5242|  4.36k|    assert(!ZSTD_isError(ZSTD_checkCParams(params->cParams)));
  ------------------
  |  |   70|  4.36k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 5243|  4.36k|    assert(!((dict) && (cdict)));  /* either dict or cdict, not both */
  ------------------
  |  |   70|  4.36k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 5244|  4.36k|    if ( (cdict)
  ------------------
  |  Branch (5244:10): [True: 0, False: 4.36k]
  ------------------
 5245|      0|      && (cdict->dictContentSize > 0)
  ------------------
  |  Branch (5245:10): [True: 0, False: 0]
  ------------------
 5246|      0|      && ( pledgedSrcSize < ZSTD_USE_CDICT_PARAMS_SRCSIZE_CUTOFF
  ------------------
  |  | 5222|      0|#define ZSTD_USE_CDICT_PARAMS_SRCSIZE_CUTOFF (128 KB)
  |  |  ------------------
  |  |  |  |   67|      0|#define KB *(1 <<10)
  |  |  ------------------
  ------------------
  |  Branch (5246:12): [True: 0, False: 0]
  ------------------
 5247|      0|        || pledgedSrcSize < cdict->dictContentSize * ZSTD_USE_CDICT_PARAMS_DICTSIZE_MULTIPLIER
  ------------------
  |  | 5223|      0|#define ZSTD_USE_CDICT_PARAMS_DICTSIZE_MULTIPLIER (6ULL)
  ------------------
  |  Branch (5247:12): [True: 0, False: 0]
  ------------------
 5248|      0|        || pledgedSrcSize == ZSTD_CONTENTSIZE_UNKNOWN
  ------------------
  |  |  203|      0|#define ZSTD_CONTENTSIZE_UNKNOWN (0ULL - 1)
  ------------------
  |  Branch (5248:12): [True: 0, False: 0]
  ------------------
 5249|      0|        || cdict->compressionLevel == 0)
  ------------------
  |  Branch (5249:12): [True: 0, False: 0]
  ------------------
 5250|      0|      && (params->attachDictPref != ZSTD_dictForceLoad) ) {
  ------------------
  |  Branch (5250:10): [True: 0, False: 0]
  ------------------
 5251|      0|        return ZSTD_resetCCtx_usingCDict(cctx, cdict, params, pledgedSrcSize, zbuff);
 5252|      0|    }
 5253|       |
 5254|  4.36k|    FORWARD_IF_ERROR( ZSTD_resetCCtx_internal(cctx, params, pledgedSrcSize,
  ------------------
  |  |  146|  4.36k|    do {                                                                           \
  |  |  147|  4.36k|        size_t const err_code = (err);                                             \
  |  |  148|  4.36k|        if (ERR_isError(err_code)) {                                               \
  |  |  ------------------
  |  |  |  Branch (148:13): [True: 0, False: 4.36k]
  |  |  ------------------
  |  |  149|      0|            RAWLOG(3, "%s:%d: ERROR!: forwarding error in %s: %s",                 \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  150|      0|                  __FILE__, __LINE__, ERR_QUOTE(err), ERR_getErrorName(err_code)); \
  |  |  151|      0|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                                 \
  |  |  ------------------
  |  |  |  |   98|      0|    do {                                           \
  |  |  |  |   99|      0|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  152|      0|            RAWLOG(3, ": " __VA_ARGS__);                                           \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  153|      0|            RAWLOG(3, "\n");                                                       \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  154|      0|            return err_code;                                                       \
  |  |  155|      0|        }                                                                          \
  |  |  156|  4.36k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (156:13): [Folded, False: 4.36k]
  |  |  ------------------
  ------------------
 5255|  4.36k|                                     dictContentSize,
 5256|  4.36k|                                     ZSTDcrp_makeClean, zbuff) , "");
 5257|  4.36k|    {   U32 dictID = 0;
 5258|  4.36k|        size_t const dictStatus = cdict ?
  ------------------
  |  Branch (5258:35): [True: 0, False: 4.36k]
  ------------------
 5259|      0|                ZSTD_compress_insertDictionary(
 5260|      0|                        cctx->blockState.prevCBlock, &cctx->blockState.matchState,
 5261|      0|                        &cctx->ldmState, &cctx->workspace, &cctx->appliedParams, cdict->dictContent,
 5262|      0|                        cdict->dictContentSize, cdict->dictContentType, dtlm,
 5263|      0|                        ZSTD_tfp_forCCtx, cctx->tmpWorkspace, &dictID)
 5264|  4.36k|              : ZSTD_compress_insertDictionary(
 5265|  4.36k|                        cctx->blockState.prevCBlock, &cctx->blockState.matchState,
 5266|  4.36k|                        &cctx->ldmState, &cctx->workspace, &cctx->appliedParams, dict, dictSize,
 5267|  4.36k|                        dictContentType, dtlm, ZSTD_tfp_forCCtx, cctx->tmpWorkspace, &dictID);
 5268|  4.36k|        FORWARD_IF_ERROR(dictStatus, "ZSTD_compress_insertDictionary failed");
  ------------------
  |  |  146|  4.36k|    do {                                                                           \
  |  |  147|  4.36k|        size_t const err_code = (err);                                             \
  |  |  148|  4.36k|        if (ERR_isError(err_code)) {                                               \
  |  |  ------------------
  |  |  |  Branch (148:13): [True: 0, False: 4.36k]
  |  |  ------------------
  |  |  149|      0|            RAWLOG(3, "%s:%d: ERROR!: forwarding error in %s: %s",                 \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  150|      0|                  __FILE__, __LINE__, ERR_QUOTE(err), ERR_getErrorName(err_code)); \
  |  |  151|      0|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                                 \
  |  |  ------------------
  |  |  |  |   98|      0|    do {                                           \
  |  |  |  |   99|      0|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  152|      0|            RAWLOG(3, ": " __VA_ARGS__);                                           \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  153|      0|            RAWLOG(3, "\n");                                                       \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  154|      0|            return err_code;                                                       \
  |  |  155|      0|        }                                                                          \
  |  |  156|  4.36k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (156:13): [Folded, False: 4.36k]
  |  |  ------------------
  ------------------
 5269|  4.36k|        cctx->dictID = dictID;
 5270|  4.36k|        cctx->dictContentSize = dictContentSize;
 5271|  4.36k|    }
 5272|      0|    return 0;
 5273|  4.36k|}
zstd_compress.c:ZSTD_resetCCtx_internal:
 2156|  4.36k|{
 2157|  4.36k|    ZSTD_cwksp* const ws = &zc->workspace;
 2158|  4.36k|    DEBUGLOG(4, "ZSTD_resetCCtx_internal: pledgedSrcSize=%u, wlog=%u, useRowMatchFinder=%d useBlockSplitter=%d",
  ------------------
  |  |  104|  4.36k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 4.36k]
  |  |  ------------------
  ------------------
 2159|  4.36k|                (U32)pledgedSrcSize, params->cParams.windowLog, (int)params->useRowMatchFinder, (int)params->postBlockSplitter);
 2160|  4.36k|    assert(!ZSTD_isError(ZSTD_checkCParams(params->cParams)));
  ------------------
  |  |   70|  4.36k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 2161|       |
 2162|  4.36k|    zc->isFirstBlock = 1;
 2163|       |
 2164|       |    /* Set applied params early so we can modify them for LDM,
 2165|       |     * and point params at the applied params.
 2166|       |     */
 2167|  4.36k|    zc->appliedParams = *params;
 2168|  4.36k|    params = &zc->appliedParams;
 2169|       |
 2170|  4.36k|    assert(params->useRowMatchFinder != ZSTD_ps_auto);
  ------------------
  |  |   70|  4.36k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 2171|  4.36k|    assert(params->postBlockSplitter != ZSTD_ps_auto);
  ------------------
  |  |   70|  4.36k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 2172|  4.36k|    assert(params->ldmParams.enableLdm != ZSTD_ps_auto);
  ------------------
  |  |   70|  4.36k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 2173|  4.36k|    assert(params->maxBlockSize != 0);
  ------------------
  |  |   70|  4.36k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 2174|  4.36k|    if (params->ldmParams.enableLdm == ZSTD_ps_enable) {
  ------------------
  |  Branch (2174:9): [True: 0, False: 4.36k]
  ------------------
 2175|       |        /* Adjust long distance matching parameters */
 2176|      0|        ZSTD_ldm_adjustParameters(&zc->appliedParams.ldmParams, &params->cParams);
 2177|      0|        assert(params->ldmParams.hashLog >= params->ldmParams.bucketSizeLog);
  ------------------
  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 2178|      0|        assert(params->ldmParams.hashRateLog < 32);
  ------------------
  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 2179|      0|    }
 2180|       |
 2181|  4.36k|    {   size_t const windowSize = MAX(1, (size_t)MIN(((U64)1 << params->cParams.windowLog), pledgedSrcSize));
  ------------------
  |  |   55|  8.72k|#define MAX(a,b) ((a)>(b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (55:19): [True: 0, False: 4.36k]
  |  |  |  Branch (55:24): [True: 0, False: 4.36k]
  |  |  |  Branch (55:36): [True: 0, False: 4.36k]
  |  |  ------------------
  ------------------
 2182|  4.36k|        size_t const blockSize = MIN(params->maxBlockSize, windowSize);
  ------------------
  |  |   54|  4.36k|#define MIN(a,b) ((a)<(b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (54:19): [True: 0, False: 4.36k]
  |  |  ------------------
  ------------------
 2183|  4.36k|        size_t const maxNbSeq = ZSTD_maxNbSeq(blockSize, params->cParams.minMatch, ZSTD_hasExtSeqProd(params));
 2184|  4.36k|        size_t const buffOutSize = (zbuff == ZSTDb_buffered && params->outBufferMode == ZSTD_bm_buffered)
  ------------------
  |  Branch (2184:37): [True: 0, False: 4.36k]
  |  Branch (2184:64): [True: 0, False: 0]
  ------------------
 2185|  4.36k|                ? ZSTD_compressBound(blockSize) + 1
 2186|  4.36k|                : 0;
 2187|  4.36k|        size_t const buffInSize = (zbuff == ZSTDb_buffered && params->inBufferMode == ZSTD_bm_buffered)
  ------------------
  |  Branch (2187:36): [True: 0, False: 4.36k]
  |  Branch (2187:63): [True: 0, False: 0]
  ------------------
 2188|  4.36k|                ? windowSize + blockSize
 2189|  4.36k|                : 0;
 2190|  4.36k|        size_t const maxNbLdmSeq = ZSTD_ldm_getMaxNbSeq(params->ldmParams, blockSize);
 2191|       |
 2192|  4.36k|        int const indexTooClose = ZSTD_indexTooCloseToMax(zc->blockState.matchState.window);
 2193|  4.36k|        int const dictTooBig = ZSTD_dictTooBig(loadedDictSize);
 2194|  4.36k|        ZSTD_indexResetPolicy_e needsIndexReset =
 2195|  4.36k|            (indexTooClose || dictTooBig || !zc->initialized) ? ZSTDirp_reset : ZSTDirp_continue;
  ------------------
  |  Branch (2195:14): [True: 0, False: 4.36k]
  |  Branch (2195:31): [True: 0, False: 4.36k]
  |  Branch (2195:45): [True: 28, False: 4.33k]
  ------------------
 2196|       |
 2197|  4.36k|        size_t const neededSpace =
 2198|  4.36k|            ZSTD_estimateCCtxSize_usingCCtxParams_internal(
 2199|  4.36k|                &params->cParams, &params->ldmParams, zc->staticSize != 0, params->useRowMatchFinder,
 2200|  4.36k|                buffInSize, buffOutSize, pledgedSrcSize, ZSTD_hasExtSeqProd(params), params->maxBlockSize);
 2201|       |
 2202|  4.36k|        FORWARD_IF_ERROR(neededSpace, "cctx size estimate failed!");
  ------------------
  |  |  146|  4.36k|    do {                                                                           \
  |  |  147|  4.36k|        size_t const err_code = (err);                                             \
  |  |  148|  4.36k|        if (ERR_isError(err_code)) {                                               \
  |  |  ------------------
  |  |  |  Branch (148:13): [True: 0, False: 4.36k]
  |  |  ------------------
  |  |  149|      0|            RAWLOG(3, "%s:%d: ERROR!: forwarding error in %s: %s",                 \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  150|      0|                  __FILE__, __LINE__, ERR_QUOTE(err), ERR_getErrorName(err_code)); \
  |  |  151|      0|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                                 \
  |  |  ------------------
  |  |  |  |   98|      0|    do {                                           \
  |  |  |  |   99|      0|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  152|      0|            RAWLOG(3, ": " __VA_ARGS__);                                           \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  153|      0|            RAWLOG(3, "\n");                                                       \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  154|      0|            return err_code;                                                       \
  |  |  155|      0|        }                                                                          \
  |  |  156|  4.36k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (156:13): [Folded, False: 4.36k]
  |  |  ------------------
  ------------------
 2203|       |
 2204|  4.36k|        if (!zc->staticSize) ZSTD_cwksp_bump_oversized_duration(ws, 0);
  ------------------
  |  Branch (2204:13): [True: 4.36k, False: 0]
  ------------------
 2205|       |
 2206|  4.36k|        {   /* Check if workspace is large enough, alloc a new one if needed */
 2207|  4.36k|            int const workspaceTooSmall = ZSTD_cwksp_sizeof(ws) < neededSpace;
 2208|  4.36k|            int const workspaceWasteful = ZSTD_cwksp_check_wasteful(ws, neededSpace);
 2209|  4.36k|            int resizeWorkspace = workspaceTooSmall || workspaceWasteful;
  ------------------
  |  Branch (2209:35): [True: 28, False: 4.33k]
  |  Branch (2209:56): [True: 0, False: 4.33k]
  ------------------
 2210|  4.36k|            DEBUGLOG(4, "Need %zu B workspace", neededSpace);
  ------------------
  |  |  104|  4.36k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 4.36k]
  |  |  ------------------
  ------------------
 2211|  4.36k|            DEBUGLOG(4, "windowSize: %zu - blockSize: %zu", windowSize, blockSize);
  ------------------
  |  |  104|  4.36k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 4.36k]
  |  |  ------------------
  ------------------
 2212|       |
 2213|  4.36k|            if (resizeWorkspace) {
  ------------------
  |  Branch (2213:17): [True: 28, False: 4.33k]
  ------------------
 2214|     28|                DEBUGLOG(4, "Resize workspaceSize from %zuKB to %zuKB",
  ------------------
  |  |  104|     28|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 28]
  |  |  ------------------
  ------------------
 2215|     28|                            ZSTD_cwksp_sizeof(ws) >> 10,
 2216|     28|                            neededSpace >> 10);
 2217|       |
 2218|     28|                RETURN_ERROR_IF(zc->staticSize, memory_allocation, "static cctx : no resize");
  ------------------
  |  |  114|     28|    do {                                                                       \
  |  |  115|     28|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 0, False: 28]
  |  |  ------------------
  |  |  116|      0|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|      0|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|      0|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|      0|    do {                                           \
  |  |  |  |   99|      0|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|      0|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|      0|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|      0|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|      0|        }                                                                      \
  |  |  123|     28|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 28]
  |  |  ------------------
  ------------------
 2219|       |
 2220|     28|                needsIndexReset = ZSTDirp_reset;
 2221|       |
 2222|     28|                ZSTD_cwksp_free(ws, zc->customMem);
 2223|     28|                FORWARD_IF_ERROR(ZSTD_cwksp_create(ws, neededSpace, zc->customMem), "");
  ------------------
  |  |  146|     28|    do {                                                                           \
  |  |  147|     28|        size_t const err_code = (err);                                             \
  |  |  148|     28|        if (ERR_isError(err_code)) {                                               \
  |  |  ------------------
  |  |  |  Branch (148:13): [True: 0, False: 28]
  |  |  ------------------
  |  |  149|      0|            RAWLOG(3, "%s:%d: ERROR!: forwarding error in %s: %s",                 \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  150|      0|                  __FILE__, __LINE__, ERR_QUOTE(err), ERR_getErrorName(err_code)); \
  |  |  151|      0|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                                 \
  |  |  ------------------
  |  |  |  |   98|      0|    do {                                           \
  |  |  |  |   99|      0|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  152|      0|            RAWLOG(3, ": " __VA_ARGS__);                                           \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  153|      0|            RAWLOG(3, "\n");                                                       \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  154|      0|            return err_code;                                                       \
  |  |  155|      0|        }                                                                          \
  |  |  156|     28|    } while(0)
  |  |  ------------------
  |  |  |  Branch (156:13): [Folded, False: 28]
  |  |  ------------------
  ------------------
 2224|       |
 2225|     28|                DEBUGLOG(5, "reserving object space");
  ------------------
  |  |  104|     28|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 28]
  |  |  ------------------
  ------------------
 2226|       |                /* Statically sized space.
 2227|       |                 * tmpWorkspace never moves,
 2228|       |                 * though prev/next block swap places */
 2229|     28|                assert(ZSTD_cwksp_check_available(ws, 2 * sizeof(ZSTD_compressedBlockState_t)));
  ------------------
  |  |   70|     28|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 2230|     28|                zc->blockState.prevCBlock = (ZSTD_compressedBlockState_t*) ZSTD_cwksp_reserve_object(ws, sizeof(ZSTD_compressedBlockState_t));
 2231|     28|                RETURN_ERROR_IF(zc->blockState.prevCBlock == NULL, memory_allocation, "couldn't allocate prevCBlock");
  ------------------
  |  |  114|     28|    do {                                                                       \
  |  |  115|     28|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 0, False: 28]
  |  |  ------------------
  |  |  116|      0|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|      0|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|      0|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|      0|    do {                                           \
  |  |  |  |   99|      0|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|      0|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|      0|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|      0|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|      0|        }                                                                      \
  |  |  123|     28|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 28]
  |  |  ------------------
  ------------------
 2232|     28|                zc->blockState.nextCBlock = (ZSTD_compressedBlockState_t*) ZSTD_cwksp_reserve_object(ws, sizeof(ZSTD_compressedBlockState_t));
 2233|     28|                RETURN_ERROR_IF(zc->blockState.nextCBlock == NULL, memory_allocation, "couldn't allocate nextCBlock");
  ------------------
  |  |  114|     28|    do {                                                                       \
  |  |  115|     28|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 0, False: 28]
  |  |  ------------------
  |  |  116|      0|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|      0|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|      0|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|      0|    do {                                           \
  |  |  |  |   99|      0|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|      0|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|      0|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|      0|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|      0|        }                                                                      \
  |  |  123|     28|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 28]
  |  |  ------------------
  ------------------
 2234|     28|                zc->tmpWorkspace = ZSTD_cwksp_reserve_object(ws, TMP_WORKSPACE_SIZE);
  ------------------
  |  |  448|     28|#define TMP_WORKSPACE_SIZE (MAX(ENTROPY_WORKSPACE_SIZE, ZSTD_SLIPBLOCK_WORKSPACESIZE))
  |  |  ------------------
  |  |  |  |   55|     56|#define MAX(a,b) ((a)>(b) ? (a) : (b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (55:19): [True: 28, Folded]
  |  |  |  |  |  Branch (55:20): [Folded, False: 28]
  |  |  |  |  |  Branch (55:30): [Folded, False: 28]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2235|     28|                RETURN_ERROR_IF(zc->tmpWorkspace == NULL, memory_allocation, "couldn't allocate tmpWorkspace");
  ------------------
  |  |  114|     28|    do {                                                                       \
  |  |  115|     28|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 0, False: 28]
  |  |  ------------------
  |  |  116|      0|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|      0|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|      0|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|      0|    do {                                           \
  |  |  |  |   99|      0|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|      0|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|      0|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|      0|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|      0|        }                                                                      \
  |  |  123|     28|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 28]
  |  |  ------------------
  ------------------
 2236|     28|                zc->tmpWkspSize = TMP_WORKSPACE_SIZE;
  ------------------
  |  |  448|     28|#define TMP_WORKSPACE_SIZE (MAX(ENTROPY_WORKSPACE_SIZE, ZSTD_SLIPBLOCK_WORKSPACESIZE))
  |  |  ------------------
  |  |  |  |   55|     56|#define MAX(a,b) ((a)>(b) ? (a) : (b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (55:19): [True: 28, Folded]
  |  |  |  |  |  Branch (55:20): [Folded, False: 28]
  |  |  |  |  |  Branch (55:30): [Folded, False: 28]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2237|     28|        }   }
 2238|       |
 2239|  4.36k|        ZSTD_cwksp_clear(ws);
 2240|       |
 2241|       |        /* init params */
 2242|  4.36k|        zc->blockState.matchState.cParams = params->cParams;
 2243|  4.36k|        zc->blockState.matchState.prefetchCDictTables = params->prefetchCDictTables == ZSTD_ps_enable;
 2244|  4.36k|        zc->pledgedSrcSizePlusOne = pledgedSrcSize+1;
 2245|  4.36k|        zc->consumedSrcSize = 0;
 2246|  4.36k|        zc->producedCSize = 0;
 2247|  4.36k|        if (pledgedSrcSize == ZSTD_CONTENTSIZE_UNKNOWN)
  ------------------
  |  |  203|  4.36k|#define ZSTD_CONTENTSIZE_UNKNOWN (0ULL - 1)
  ------------------
  |  Branch (2247:13): [True: 0, False: 4.36k]
  ------------------
 2248|      0|            zc->appliedParams.fParams.contentSizeFlag = 0;
 2249|  4.36k|        DEBUGLOG(4, "pledged content size : %u ; flag : %u",
  ------------------
  |  |  104|  4.36k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 4.36k]
  |  |  ------------------
  ------------------
 2250|  4.36k|            (unsigned)pledgedSrcSize, zc->appliedParams.fParams.contentSizeFlag);
 2251|  4.36k|        zc->blockSizeMax = blockSize;
 2252|       |
 2253|  4.36k|        XXH64_reset(&zc->xxhState, 0);
  ------------------
  |  |  459|  4.36k|#  define XXH64_reset XXH_NAME2(XXH_NAMESPACE, XXH64_reset)
  |  |  ------------------
  |  |  |  |  443|  4.36k|#  define XXH_NAME2(A,B) XXH_CAT(A,B)
  |  |  |  |  ------------------
  |  |  |  |  |  |  442|  4.36k|#  define XXH_CAT(A,B) A##B
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2254|  4.36k|        zc->stage = ZSTDcs_init;
 2255|  4.36k|        zc->dictID = 0;
 2256|  4.36k|        zc->dictContentSize = 0;
 2257|       |
 2258|  4.36k|        ZSTD_reset_compressedBlockState(zc->blockState.prevCBlock);
 2259|       |
 2260|  4.36k|        FORWARD_IF_ERROR(ZSTD_reset_matchState(
  ------------------
  |  |  146|  4.36k|    do {                                                                           \
  |  |  147|  4.36k|        size_t const err_code = (err);                                             \
  |  |  148|  4.36k|        if (ERR_isError(err_code)) {                                               \
  |  |  ------------------
  |  |  |  Branch (148:13): [True: 0, False: 4.36k]
  |  |  ------------------
  |  |  149|      0|            RAWLOG(3, "%s:%d: ERROR!: forwarding error in %s: %s",                 \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  150|      0|                  __FILE__, __LINE__, ERR_QUOTE(err), ERR_getErrorName(err_code)); \
  |  |  151|      0|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                                 \
  |  |  ------------------
  |  |  |  |   98|      0|    do {                                           \
  |  |  |  |   99|      0|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  152|      0|            RAWLOG(3, ": " __VA_ARGS__);                                           \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  153|      0|            RAWLOG(3, "\n");                                                       \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  154|      0|            return err_code;                                                       \
  |  |  155|      0|        }                                                                          \
  |  |  156|  4.36k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (156:13): [Folded, False: 4.36k]
  |  |  ------------------
  ------------------
 2261|  4.36k|                &zc->blockState.matchState,
 2262|  4.36k|                ws,
 2263|  4.36k|                &params->cParams,
 2264|  4.36k|                params->useRowMatchFinder,
 2265|  4.36k|                crp,
 2266|  4.36k|                needsIndexReset,
 2267|  4.36k|                ZSTD_resetTarget_CCtx), "");
 2268|       |
 2269|  4.36k|        zc->seqStore.sequencesStart = (SeqDef*)ZSTD_cwksp_reserve_aligned64(ws, maxNbSeq * sizeof(SeqDef));
 2270|       |
 2271|       |        /* ldm hash table */
 2272|  4.36k|        if (params->ldmParams.enableLdm == ZSTD_ps_enable) {
  ------------------
  |  Branch (2272:13): [True: 0, False: 4.36k]
  ------------------
 2273|       |            /* TODO: avoid memset? */
 2274|      0|            size_t const ldmHSize = ((size_t)1) << params->ldmParams.hashLog;
 2275|      0|            zc->ldmState.hashTable = (ldmEntry_t*)ZSTD_cwksp_reserve_aligned64(ws, ldmHSize * sizeof(ldmEntry_t));
 2276|      0|            ZSTD_memset(zc->ldmState.hashTable, 0, ldmHSize * sizeof(ldmEntry_t));
  ------------------
  |  |   46|      0|# define ZSTD_memset(p,v,l) __builtin_memset((p),(v),(l))
  ------------------
 2277|      0|            zc->ldmSequences = (rawSeq*)ZSTD_cwksp_reserve_aligned64(ws, maxNbLdmSeq * sizeof(rawSeq));
 2278|      0|            zc->maxNbLdmSequences = maxNbLdmSeq;
 2279|       |
 2280|      0|            ZSTD_window_init(&zc->ldmState.window);
 2281|      0|            zc->ldmState.loadedDictEnd = 0;
 2282|      0|        }
 2283|       |
 2284|       |        /* reserve space for block-level external sequences */
 2285|  4.36k|        if (ZSTD_hasExtSeqProd(params)) {
  ------------------
  |  Branch (2285:13): [True: 0, False: 4.36k]
  ------------------
 2286|      0|            size_t const maxNbExternalSeq = ZSTD_sequenceBound(blockSize);
 2287|      0|            zc->extSeqBufCapacity = maxNbExternalSeq;
 2288|      0|            zc->extSeqBuf =
 2289|      0|                (ZSTD_Sequence*)ZSTD_cwksp_reserve_aligned64(ws, maxNbExternalSeq * sizeof(ZSTD_Sequence));
 2290|      0|        }
 2291|       |
 2292|       |        /* buffers */
 2293|       |
 2294|       |        /* ZSTD_wildcopy() is used to copy into the literals buffer,
 2295|       |         * so we have to oversize the buffer by WILDCOPY_OVERLENGTH bytes.
 2296|       |         */
 2297|  4.36k|        zc->seqStore.litStart = ZSTD_cwksp_reserve_buffer(ws, blockSize + WILDCOPY_OVERLENGTH);
  ------------------
  |  |  201|  4.36k|#define WILDCOPY_OVERLENGTH 32
  ------------------
 2298|  4.36k|        zc->seqStore.maxNbLit = blockSize;
 2299|       |
 2300|  4.36k|        zc->bufferedPolicy = zbuff;
 2301|  4.36k|        zc->inBuffSize = buffInSize;
 2302|  4.36k|        zc->inBuff = (char*)ZSTD_cwksp_reserve_buffer(ws, buffInSize);
 2303|  4.36k|        zc->outBuffSize = buffOutSize;
 2304|  4.36k|        zc->outBuff = (char*)ZSTD_cwksp_reserve_buffer(ws, buffOutSize);
 2305|       |
 2306|       |        /* ldm bucketOffsets table */
 2307|  4.36k|        if (params->ldmParams.enableLdm == ZSTD_ps_enable) {
  ------------------
  |  Branch (2307:13): [True: 0, False: 4.36k]
  ------------------
 2308|       |            /* TODO: avoid memset? */
 2309|      0|            size_t const numBuckets =
 2310|      0|                  ((size_t)1) << (params->ldmParams.hashLog -
 2311|      0|                                  params->ldmParams.bucketSizeLog);
 2312|      0|            zc->ldmState.bucketOffsets = ZSTD_cwksp_reserve_buffer(ws, numBuckets);
 2313|      0|            ZSTD_memset(zc->ldmState.bucketOffsets, 0, numBuckets);
  ------------------
  |  |   46|      0|# define ZSTD_memset(p,v,l) __builtin_memset((p),(v),(l))
  ------------------
 2314|      0|        }
 2315|       |
 2316|       |        /* sequences storage */
 2317|  4.36k|        ZSTD_referenceExternalSequences(zc, NULL, 0);
 2318|  4.36k|        zc->seqStore.maxNbSeq = maxNbSeq;
 2319|  4.36k|        zc->seqStore.llCode = ZSTD_cwksp_reserve_buffer(ws, maxNbSeq * sizeof(BYTE));
 2320|  4.36k|        zc->seqStore.mlCode = ZSTD_cwksp_reserve_buffer(ws, maxNbSeq * sizeof(BYTE));
 2321|  4.36k|        zc->seqStore.ofCode = ZSTD_cwksp_reserve_buffer(ws, maxNbSeq * sizeof(BYTE));
 2322|       |
 2323|  4.36k|        DEBUGLOG(3, "wksp: finished allocating, %zd bytes remain available", ZSTD_cwksp_available_space(ws));
  ------------------
  |  |  104|  4.36k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 4.36k]
  |  |  ------------------
  ------------------
 2324|  4.36k|        assert(ZSTD_cwksp_estimated_space_within_bounds(ws, neededSpace));
  ------------------
  |  |   70|  4.36k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 2325|       |
 2326|  4.36k|        zc->initialized = 1;
 2327|       |
 2328|  4.36k|        return 0;
 2329|  4.36k|    }
 2330|  4.36k|}
zstd_compress.c:ZSTD_indexTooCloseToMax:
 2130|  4.36k|{
 2131|  4.36k|    return (size_t)(w.nextSrc - w.base) > (ZSTD_CURRENT_MAX - ZSTD_INDEXOVERFLOW_MARGIN);
  ------------------
  |  | 1060|  4.36k|#define ZSTD_CURRENT_MAX (MEM_64bits() ? 3500U MB : 2000U MB)
  |  |  ------------------
  |  |  |  |   68|  4.36k|#define MB *(1 <<20)
  |  |  ------------------
  |  |               #define ZSTD_CURRENT_MAX (MEM_64bits() ? 3500U MB : 2000U MB)
  |  |  ------------------
  |  |  |  |   68|      0|#define MB *(1 <<20)
  |  |  ------------------
  |  |  |  Branch (1060:27): [True: 4.36k, False: 0]
  |  |  ------------------
  ------------------
                  return (size_t)(w.nextSrc - w.base) > (ZSTD_CURRENT_MAX - ZSTD_INDEXOVERFLOW_MARGIN);
  ------------------
  |  | 2128|  4.36k|#define ZSTD_INDEXOVERFLOW_MARGIN (16 MB)
  |  |  ------------------
  |  |  |  |   68|  4.36k|#define MB *(1 <<20)
  |  |  ------------------
  ------------------
 2132|  4.36k|}
zstd_compress.c:ZSTD_dictTooBig:
 2140|  4.36k|{
 2141|  4.36k|    return loadedDictSize > ZSTD_CHUNKSIZE_MAX;
  ------------------
  |  | 1063|  4.36k|    ( ((U32)-1)                  /* Maximum ending current index */            \
  |  | 1064|  4.36k|    - ZSTD_CURRENT_MAX)          /* Maximum beginning lowLimit */
  |  |  ------------------
  |  |  |  | 1060|  4.36k|#define ZSTD_CURRENT_MAX (MEM_64bits() ? 3500U MB : 2000U MB)
  |  |  |  |  ------------------
  |  |  |  |  |  |   68|  4.36k|#define MB *(1 <<20)
  |  |  |  |  ------------------
  |  |  |  |               #define ZSTD_CURRENT_MAX (MEM_64bits() ? 3500U MB : 2000U MB)
  |  |  |  |  ------------------
  |  |  |  |  |  |   68|      0|#define MB *(1 <<20)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1060:27): [True: 4.36k, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2142|  4.36k|}
zstd_compress.c:ZSTD_reset_matchState:
 2042|  4.36k|{
 2043|       |    /* disable chain table allocation for fast or row-based strategies */
 2044|  4.36k|    size_t const chainSize = ZSTD_allocateChainTable(cParams->strategy, useRowMatchFinder,
  ------------------
  |  Branch (2044:30): [True: 4.36k, False: 0]
  ------------------
 2045|  4.36k|                                                     ms->dedicatedDictSearch && (forWho == ZSTD_resetTarget_CDict))
  ------------------
  |  Branch (2045:54): [True: 0, False: 4.36k]
  |  Branch (2045:81): [True: 0, False: 0]
  ------------------
 2046|  4.36k|                                ? ((size_t)1 << cParams->chainLog)
 2047|  4.36k|                                : 0;
 2048|  4.36k|    size_t const hSize = ((size_t)1) << cParams->hashLog;
 2049|  4.36k|    U32    const hashLog3 = ((forWho == ZSTD_resetTarget_CCtx) && cParams->minMatch==3) ? MIN(ZSTD_HASHLOG3_MAX, cParams->windowLog) : 0;
  ------------------
  |  |   54|  1.54k|#define MIN(a,b) ((a)<(b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (54:19): [True: 0, False: 1.54k]
  |  |  ------------------
  ------------------
  |  Branch (2049:30): [True: 4.36k, False: 0]
  |  Branch (2049:67): [True: 1.54k, False: 2.82k]
  ------------------
 2050|  4.36k|    size_t const h3Size = hashLog3 ? ((size_t)1) << hashLog3 : 0;
  ------------------
  |  Branch (2050:27): [True: 1.54k, False: 2.82k]
  ------------------
 2051|       |
 2052|  4.36k|    DEBUGLOG(4, "reset indices : %u", forceResetIndex == ZSTDirp_reset);
  ------------------
  |  |  104|  4.36k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 4.36k]
  |  |  ------------------
  ------------------
 2053|  4.36k|    assert(useRowMatchFinder != ZSTD_ps_auto);
  ------------------
  |  |   70|  4.36k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 2054|  4.36k|    if (forceResetIndex == ZSTDirp_reset) {
  ------------------
  |  Branch (2054:9): [True: 28, False: 4.33k]
  ------------------
 2055|     28|        ZSTD_window_init(&ms->window);
 2056|     28|        ZSTD_cwksp_mark_tables_dirty(ws);
 2057|     28|    }
 2058|       |
 2059|  4.36k|    ms->hashLog3 = hashLog3;
 2060|  4.36k|    ms->lazySkipping = 0;
 2061|       |
 2062|  4.36k|    ZSTD_invalidateMatchState(ms);
 2063|       |
 2064|  4.36k|    assert(!ZSTD_cwksp_reserve_failed(ws)); /* check that allocation hasn't already failed */
  ------------------
  |  |   70|  4.36k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 2065|       |
 2066|  4.36k|    ZSTD_cwksp_clear_tables(ws);
 2067|       |
 2068|  4.36k|    DEBUGLOG(5, "reserving table space");
  ------------------
  |  |  104|  4.36k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 4.36k]
  |  |  ------------------
  ------------------
 2069|       |    /* table Space */
 2070|  4.36k|    ms->hashTable = (U32*)ZSTD_cwksp_reserve_table(ws, hSize * sizeof(U32));
 2071|  4.36k|    ms->chainTable = (U32*)ZSTD_cwksp_reserve_table(ws, chainSize * sizeof(U32));
 2072|  4.36k|    ms->hashTable3 = (U32*)ZSTD_cwksp_reserve_table(ws, h3Size * sizeof(U32));
 2073|  4.36k|    RETURN_ERROR_IF(ZSTD_cwksp_reserve_failed(ws), memory_allocation,
  ------------------
  |  |  114|  4.36k|    do {                                                                       \
  |  |  115|  4.36k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 0, False: 4.36k]
  |  |  ------------------
  |  |  116|      0|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|      0|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|      0|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|      0|    do {                                           \
  |  |  |  |   99|      0|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|      0|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|      0|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|      0|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|      0|        }                                                                      \
  |  |  123|  4.36k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 4.36k]
  |  |  ------------------
  ------------------
 2074|  4.36k|                    "failed a workspace allocation in ZSTD_reset_matchState");
 2075|       |
 2076|  4.36k|    DEBUGLOG(4, "reset table : %u", crp!=ZSTDcrp_leaveDirty);
  ------------------
  |  |  104|  4.36k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 4.36k]
  |  |  ------------------
  ------------------
 2077|  4.36k|    if (crp!=ZSTDcrp_leaveDirty) {
  ------------------
  |  Branch (2077:9): [True: 4.36k, False: 0]
  ------------------
 2078|       |        /* reset tables only */
 2079|  4.36k|        ZSTD_cwksp_clean_tables(ws);
 2080|  4.36k|    }
 2081|       |
 2082|  4.36k|    if (ZSTD_rowMatchFinderUsed(cParams->strategy, useRowMatchFinder)) {
  ------------------
  |  Branch (2082:9): [True: 0, False: 4.36k]
  ------------------
 2083|       |        /* Row match finder needs an additional table of hashes ("tags") */
 2084|      0|        size_t const tagTableSize = hSize;
 2085|       |        /* We want to generate a new salt in case we reset a Cctx, but we always want to use
 2086|       |         * 0 when we reset a Cdict */
 2087|      0|        if(forWho == ZSTD_resetTarget_CCtx) {
  ------------------
  |  Branch (2087:12): [True: 0, False: 0]
  ------------------
 2088|      0|            ms->tagTable = (BYTE*) ZSTD_cwksp_reserve_aligned_init_once(ws, tagTableSize);
 2089|      0|            ZSTD_advanceHashSalt(ms);
 2090|      0|        } else {
 2091|       |            /* When we are not salting we want to always memset the memory */
 2092|      0|            ms->tagTable = (BYTE*) ZSTD_cwksp_reserve_aligned64(ws, tagTableSize);
 2093|      0|            ZSTD_memset(ms->tagTable, 0, tagTableSize);
  ------------------
  |  |   46|      0|# define ZSTD_memset(p,v,l) __builtin_memset((p),(v),(l))
  ------------------
 2094|      0|            ms->hashSalt = 0;
 2095|      0|        }
 2096|      0|        {   /* Switch to 32-entry rows if searchLog is 5 (or more) */
 2097|      0|            U32 const rowLog = BOUNDED(4, cParams->searchLog, 6);
  ------------------
  |  |   56|      0|#define BOUNDED(min,val,max) (MAX(min,MIN(val,max)))
  |  |  ------------------
  |  |  |  |   55|      0|#define MAX(a,b) ((a)>(b) ? (a) : (b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (55:19): [True: 0, False: 0]
  |  |  |  |  |  Branch (55:24): [True: 0, False: 0]
  |  |  |  |  |  Branch (55:36): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2098|      0|            assert(cParams->hashLog >= rowLog);
  ------------------
  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 2099|      0|            ms->rowHashLog = cParams->hashLog - rowLog;
 2100|      0|        }
 2101|      0|    }
 2102|       |
 2103|       |    /* opt parser space */
 2104|  4.36k|    if ((forWho == ZSTD_resetTarget_CCtx) && (cParams->strategy >= ZSTD_btopt)) {
  ------------------
  |  Branch (2104:9): [True: 4.36k, False: 0]
  |  Branch (2104:46): [True: 1.80k, False: 2.56k]
  ------------------
 2105|  1.80k|        DEBUGLOG(4, "reserving optimal parser space");
  ------------------
  |  |  104|  1.80k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 1.80k]
  |  |  ------------------
  ------------------
 2106|  1.80k|        ms->opt.litFreq = (unsigned*)ZSTD_cwksp_reserve_aligned64(ws, (1<<Litbits) * sizeof(unsigned));
  ------------------
  |  |  100|  1.80k|#define Litbits  8
  ------------------
 2107|  1.80k|        ms->opt.litLengthFreq = (unsigned*)ZSTD_cwksp_reserve_aligned64(ws, (MaxLL+1) * sizeof(unsigned));
  ------------------
  |  |  104|  1.80k|#define MaxLL   35
  ------------------
 2108|  1.80k|        ms->opt.matchLengthFreq = (unsigned*)ZSTD_cwksp_reserve_aligned64(ws, (MaxML+1) * sizeof(unsigned));
  ------------------
  |  |  103|  1.80k|#define MaxML   52
  ------------------
 2109|  1.80k|        ms->opt.offCodeFreq = (unsigned*)ZSTD_cwksp_reserve_aligned64(ws, (MaxOff+1) * sizeof(unsigned));
  ------------------
  |  |  106|  1.80k|#define MaxOff  31
  ------------------
 2110|  1.80k|        ms->opt.matchTable = (ZSTD_match_t*)ZSTD_cwksp_reserve_aligned64(ws, ZSTD_OPT_SIZE * sizeof(ZSTD_match_t));
  ------------------
  |  |  230|  1.80k|#define ZSTD_OPT_SIZE (ZSTD_OPT_NUM+3)
  |  |  ------------------
  |  |  |  |   62|  1.80k|#define ZSTD_OPT_NUM    (1<<12)
  |  |  ------------------
  ------------------
 2111|  1.80k|        ms->opt.priceTable = (ZSTD_optimal_t*)ZSTD_cwksp_reserve_aligned64(ws, ZSTD_OPT_SIZE * sizeof(ZSTD_optimal_t));
  ------------------
  |  |  230|  1.80k|#define ZSTD_OPT_SIZE (ZSTD_OPT_NUM+3)
  |  |  ------------------
  |  |  |  |   62|  1.80k|#define ZSTD_OPT_NUM    (1<<12)
  |  |  ------------------
  ------------------
 2112|  1.80k|    }
 2113|       |
 2114|  4.36k|    ms->cParams = *cParams;
 2115|       |
 2116|  4.36k|    RETURN_ERROR_IF(ZSTD_cwksp_reserve_failed(ws), memory_allocation,
  ------------------
  |  |  114|  4.36k|    do {                                                                       \
  |  |  115|  4.36k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 0, False: 4.36k]
  |  |  ------------------
  |  |  116|      0|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|      0|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|      0|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|      0|    do {                                           \
  |  |  |  |   99|      0|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|      0|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|      0|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|      0|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|      0|        }                                                                      \
  |  |  123|  4.36k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 4.36k]
  |  |  ------------------
  ------------------
 2117|  4.36k|                    "failed a workspace allocation in ZSTD_reset_matchState");
 2118|  4.36k|    return 0;
 2119|  4.36k|}
zstd_compress.c:ZSTD_invalidateMatchState:
 1984|  4.36k|{
 1985|  4.36k|    ZSTD_window_clear(&ms->window);
 1986|       |
 1987|  4.36k|    ms->nextToUpdate = ms->window.dictLimit;
 1988|  4.36k|    ms->loadedDictEnd = 0;
 1989|  4.36k|    ms->opt.litLengthSum = 0;  /* force reset of btopt stats */
 1990|       |    ms->dictMatchState = NULL;
 1991|  4.36k|}
zstd_compress.c:ZSTD_compress_insertDictionary:
 5193|  4.36k|{
 5194|  4.36k|    DEBUGLOG(4, "ZSTD_compress_insertDictionary (dictSize=%u)", (U32)dictSize);
  ------------------
  |  |  104|  4.36k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 4.36k]
  |  |  ------------------
  ------------------
 5195|  4.36k|    *dictIDPtr = 0;
 5196|  4.36k|    if ((dict==NULL) || (dictSize<8)) {
  ------------------
  |  Branch (5196:9): [True: 4.36k, False: 0]
  |  Branch (5196:25): [True: 0, False: 0]
  ------------------
 5197|  4.36k|        RETURN_ERROR_IF(dictContentType == ZSTD_dct_fullDict, dictionary_wrong, "");
  ------------------
  |  |  114|  4.36k|    do {                                                                       \
  |  |  115|  4.36k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 0, False: 4.36k]
  |  |  ------------------
  |  |  116|      0|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|      0|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|      0|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|      0|    do {                                           \
  |  |  |  |   99|      0|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|      0|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|      0|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|      0|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|      0|        }                                                                      \
  |  |  123|  4.36k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 4.36k]
  |  |  ------------------
  ------------------
 5198|  4.36k|        return 0;
 5199|  4.36k|    }
 5200|       |
 5201|      0|    ZSTD_reset_compressedBlockState(bs);
 5202|       |
 5203|       |    /* dict restricted modes */
 5204|      0|    if (dictContentType == ZSTD_dct_rawContent)
  ------------------
  |  Branch (5204:9): [True: 0, False: 0]
  ------------------
 5205|      0|        return ZSTD_loadDictionaryContent(ms, ls, ws, params, dict, dictSize, dtlm, tfp);
 5206|       |
 5207|      0|    if (MEM_readLE32(dict) != ZSTD_MAGIC_DICTIONARY) {
  ------------------
  |  |  143|      0|#define ZSTD_MAGIC_DICTIONARY       0xEC30A437    /* valid since v0.7.0 */
  ------------------
  |  Branch (5207:9): [True: 0, False: 0]
  ------------------
 5208|      0|        if (dictContentType == ZSTD_dct_auto) {
  ------------------
  |  Branch (5208:13): [True: 0, False: 0]
  ------------------
 5209|      0|            DEBUGLOG(4, "raw content dictionary detected");
  ------------------
  |  |  104|      0|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 0]
  |  |  ------------------
  ------------------
 5210|      0|            return ZSTD_loadDictionaryContent(
 5211|      0|                ms, ls, ws, params, dict, dictSize, dtlm, tfp);
 5212|      0|        }
 5213|      0|        RETURN_ERROR_IF(dictContentType == ZSTD_dct_fullDict, dictionary_wrong, "");
  ------------------
  |  |  114|      0|    do {                                                                       \
  |  |  115|      0|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 0, False: 0]
  |  |  ------------------
  |  |  116|      0|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|      0|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|      0|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|      0|    do {                                           \
  |  |  |  |   99|      0|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|      0|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|      0|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|      0|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|      0|        }                                                                      \
  |  |  123|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
 5214|      0|        assert(0);   /* impossible */
  ------------------
  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 5215|      0|    }
 5216|       |
 5217|       |    /* dict as full zstd dictionary */
 5218|      0|    return ZSTD_loadZstdDictionary(
 5219|      0|        bs, ms, ws, params, dict, dictSize, dtlm, tfp, workspace, dictIDPtr);
 5220|      0|}
zstd_compress.c:ZSTD_writeEpilogue:
 5335|  2.90k|{
 5336|  2.90k|    BYTE* const ostart = (BYTE*)dst;
 5337|  2.90k|    BYTE* op = ostart;
 5338|       |
 5339|  2.90k|    DEBUGLOG(4, "ZSTD_writeEpilogue");
  ------------------
  |  |  104|  2.90k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 2.90k]
  |  |  ------------------
  ------------------
 5340|  2.90k|    RETURN_ERROR_IF(cctx->stage == ZSTDcs_created, stage_wrong, "init missing");
  ------------------
  |  |  114|  2.90k|    do {                                                                       \
  |  |  115|  2.90k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 0, False: 2.90k]
  |  |  ------------------
  |  |  116|      0|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|      0|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|      0|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|      0|    do {                                           \
  |  |  |  |   99|      0|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|      0|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|      0|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|      0|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|      0|        }                                                                      \
  |  |  123|  2.90k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 2.90k]
  |  |  ------------------
  ------------------
 5341|       |
 5342|       |    /* special case : empty frame */
 5343|  2.90k|    if (cctx->stage == ZSTDcs_init) {
  ------------------
  |  Branch (5343:9): [True: 0, False: 2.90k]
  ------------------
 5344|      0|        size_t fhSize = ZSTD_writeFrameHeader(dst, dstCapacity, &cctx->appliedParams, 0, 0);
 5345|      0|        FORWARD_IF_ERROR(fhSize, "ZSTD_writeFrameHeader failed");
  ------------------
  |  |  146|      0|    do {                                                                           \
  |  |  147|      0|        size_t const err_code = (err);                                             \
  |  |  148|      0|        if (ERR_isError(err_code)) {                                               \
  |  |  ------------------
  |  |  |  Branch (148:13): [True: 0, False: 0]
  |  |  ------------------
  |  |  149|      0|            RAWLOG(3, "%s:%d: ERROR!: forwarding error in %s: %s",                 \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  150|      0|                  __FILE__, __LINE__, ERR_QUOTE(err), ERR_getErrorName(err_code)); \
  |  |  151|      0|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                                 \
  |  |  ------------------
  |  |  |  |   98|      0|    do {                                           \
  |  |  |  |   99|      0|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  152|      0|            RAWLOG(3, ": " __VA_ARGS__);                                           \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  153|      0|            RAWLOG(3, "\n");                                                       \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  154|      0|            return err_code;                                                       \
  |  |  155|      0|        }                                                                          \
  |  |  156|      0|    } while(0)
  |  |  ------------------
  |  |  |  Branch (156:13): [Folded, False: 0]
  |  |  ------------------
  ------------------
 5346|      0|        dstCapacity -= fhSize;
 5347|      0|        op += fhSize;
 5348|      0|        cctx->stage = ZSTDcs_ongoing;
 5349|      0|    }
 5350|       |
 5351|  2.90k|    if (cctx->stage != ZSTDcs_ending) {
  ------------------
  |  Branch (5351:9): [True: 0, False: 2.90k]
  ------------------
 5352|       |        /* write one last empty block, make it the "last" block */
 5353|      0|        U32 const cBlockHeader24 = 1 /* last block */ + (((U32)bt_raw)<<1) + 0;
 5354|      0|        ZSTD_STATIC_ASSERT(ZSTD_BLOCKHEADERSIZE == 3);
  ------------------
  |  |   43|      0|#define ZSTD_STATIC_ASSERT(c) DEBUG_STATIC_ASSERT(c)
  |  |  ------------------
  |  |  |  |   39|      0|#define DEBUG_STATIC_ASSERT(c) (void)sizeof(char[(c) ? 1 : -1])
  |  |  ------------------
  ------------------
 5355|      0|        RETURN_ERROR_IF(dstCapacity<3, dstSize_tooSmall, "no room for epilogue");
  ------------------
  |  |  114|      0|    do {                                                                       \
  |  |  115|      0|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 0, False: 0]
  |  |  ------------------
  |  |  116|      0|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|      0|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|      0|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|      0|    do {                                           \
  |  |  |  |   99|      0|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|      0|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|      0|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|      0|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|      0|        }                                                                      \
  |  |  123|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
 5356|      0|        MEM_writeLE24(op, cBlockHeader24);
 5357|      0|        op += ZSTD_blockHeaderSize;
 5358|      0|        dstCapacity -= ZSTD_blockHeaderSize;
 5359|      0|    }
 5360|       |
 5361|  2.90k|    if (cctx->appliedParams.fParams.checksumFlag) {
  ------------------
  |  Branch (5361:9): [True: 0, False: 2.90k]
  ------------------
 5362|      0|        U32 const checksum = (U32) XXH64_digest(&cctx->xxhState);
  ------------------
  |  |  461|      0|#  define XXH64_digest XXH_NAME2(XXH_NAMESPACE, XXH64_digest)
  |  |  ------------------
  |  |  |  |  443|      0|#  define XXH_NAME2(A,B) XXH_CAT(A,B)
  |  |  |  |  ------------------
  |  |  |  |  |  |  442|      0|#  define XXH_CAT(A,B) A##B
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 5363|      0|        RETURN_ERROR_IF(dstCapacity<4, dstSize_tooSmall, "no room for checksum");
  ------------------
  |  |  114|      0|    do {                                                                       \
  |  |  115|      0|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 0, False: 0]
  |  |  ------------------
  |  |  116|      0|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|      0|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|      0|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|      0|    do {                                           \
  |  |  |  |   99|      0|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|      0|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|      0|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|      0|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|      0|        }                                                                      \
  |  |  123|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
 5364|      0|        DEBUGLOG(4, "ZSTD_writeEpilogue: write checksum : %08X", (unsigned)checksum);
  ------------------
  |  |  104|      0|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 0]
  |  |  ------------------
  ------------------
 5365|      0|        MEM_writeLE32(op, checksum);
 5366|      0|        op += 4;
 5367|      0|    }
 5368|       |
 5369|  2.90k|    cctx->stage = ZSTDcs_created;  /* return to "created but no init" status */
 5370|  2.90k|    return (size_t)(op-ostart);
 5371|  2.90k|}
zstd_compress.c:ZSTD_sizeof_matchState:
 1700|  4.36k|{
 1701|       |    /* chain table size should be 0 for fast or row-hash strategies */
 1702|  4.36k|    size_t const chainSize = ZSTD_allocateChainTable(cParams->strategy, useRowMatchFinder, enableDedicatedDictSearch && !forCCtx)
  ------------------
  |  Branch (1702:30): [True: 4.36k, False: 0]
  |  Branch (1702:92): [True: 0, False: 4.36k]
  |  Branch (1702:121): [True: 0, False: 0]
  ------------------
 1703|  4.36k|                                ? ((size_t)1 << cParams->chainLog)
 1704|  4.36k|                                : 0;
 1705|  4.36k|    size_t const hSize = ((size_t)1) << cParams->hashLog;
 1706|  4.36k|    U32    const hashLog3 = (forCCtx && cParams->minMatch==3) ? MIN(ZSTD_HASHLOG3_MAX, cParams->windowLog) : 0;
  ------------------
  |  |   54|  1.54k|#define MIN(a,b) ((a)<(b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (54:19): [True: 0, False: 1.54k]
  |  |  ------------------
  ------------------
  |  Branch (1706:30): [True: 4.36k, False: 0]
  |  Branch (1706:41): [True: 1.54k, False: 2.82k]
  ------------------
 1707|  4.36k|    size_t const h3Size = hashLog3 ? ((size_t)1) << hashLog3 : 0;
  ------------------
  |  Branch (1707:27): [True: 1.54k, False: 2.82k]
  ------------------
 1708|       |    /* We don't use ZSTD_cwksp_alloc_size() here because the tables aren't
 1709|       |     * surrounded by redzones in ASAN. */
 1710|  4.36k|    size_t const tableSpace = chainSize * sizeof(U32)
 1711|  4.36k|                            + hSize * sizeof(U32)
 1712|  4.36k|                            + h3Size * sizeof(U32);
 1713|  4.36k|    size_t const optPotentialSpace =
 1714|  4.36k|        ZSTD_cwksp_aligned64_alloc_size((MaxML+1) * sizeof(U32))
  ------------------
  |  |  103|  4.36k|#define MaxML   52
  ------------------
 1715|  4.36k|      + ZSTD_cwksp_aligned64_alloc_size((MaxLL+1) * sizeof(U32))
  ------------------
  |  |  104|  4.36k|#define MaxLL   35
  ------------------
 1716|  4.36k|      + ZSTD_cwksp_aligned64_alloc_size((MaxOff+1) * sizeof(U32))
  ------------------
  |  |  106|  4.36k|#define MaxOff  31
  ------------------
 1717|  4.36k|      + ZSTD_cwksp_aligned64_alloc_size((1<<Litbits) * sizeof(U32))
  ------------------
  |  |  100|  4.36k|#define Litbits  8
  ------------------
 1718|  4.36k|      + ZSTD_cwksp_aligned64_alloc_size(ZSTD_OPT_SIZE * sizeof(ZSTD_match_t))
  ------------------
  |  |  230|  4.36k|#define ZSTD_OPT_SIZE (ZSTD_OPT_NUM+3)
  |  |  ------------------
  |  |  |  |   62|  4.36k|#define ZSTD_OPT_NUM    (1<<12)
  |  |  ------------------
  ------------------
 1719|  4.36k|      + ZSTD_cwksp_aligned64_alloc_size(ZSTD_OPT_SIZE * sizeof(ZSTD_optimal_t));
  ------------------
  |  |  230|  4.36k|#define ZSTD_OPT_SIZE (ZSTD_OPT_NUM+3)
  |  |  ------------------
  |  |  |  |   62|  4.36k|#define ZSTD_OPT_NUM    (1<<12)
  |  |  ------------------
  ------------------
 1720|  4.36k|    size_t const lazyAdditionalSpace = ZSTD_rowMatchFinderUsed(cParams->strategy, useRowMatchFinder)
  ------------------
  |  Branch (1720:40): [True: 0, False: 4.36k]
  ------------------
 1721|  4.36k|                                            ? ZSTD_cwksp_aligned64_alloc_size(hSize)
 1722|  4.36k|                                            : 0;
 1723|  4.36k|    size_t const optSpace = (forCCtx && (cParams->strategy >= ZSTD_btopt))
  ------------------
  |  Branch (1723:30): [True: 4.36k, False: 0]
  |  Branch (1723:41): [True: 1.80k, False: 2.56k]
  ------------------
 1724|  4.36k|                                ? optPotentialSpace
 1725|  4.36k|                                : 0;
 1726|  4.36k|    size_t const slackSpace = ZSTD_cwksp_slack_space_required();
 1727|       |
 1728|       |    /* tables are guaranteed to be sized in multiples of 64 bytes (or 16 uint32_t) */
 1729|  4.36k|    ZSTD_STATIC_ASSERT(ZSTD_HASHLOG_MIN >= 4 && ZSTD_WINDOWLOG_MIN >= 4 && ZSTD_CHAINLOG_MIN >= 4);
  ------------------
  |  |   43|  4.36k|#define ZSTD_STATIC_ASSERT(c) DEBUG_STATIC_ASSERT(c)
  |  |  ------------------
  |  |  |  |   39|  4.36k|#define DEBUG_STATIC_ASSERT(c) (void)sizeof(char[(c) ? 1 : -1])
  |  |  ------------------
  ------------------
 1730|  4.36k|    assert(useRowMatchFinder != ZSTD_ps_auto);
  ------------------
  |  |   70|  4.36k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1731|       |
 1732|  4.36k|    DEBUGLOG(4, "chainSize: %u - hSize: %u - h3Size: %u",
  ------------------
  |  |  104|  4.36k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 4.36k]
  |  |  ------------------
  ------------------
 1733|  4.36k|                (U32)chainSize, (U32)hSize, (U32)h3Size);
 1734|  4.36k|    return tableSpace + optSpace + slackSpace + lazyAdditionalSpace;
 1735|  4.36k|}
zstd_compress.c:ZSTD_writeFrameHeader:
 4669|  4.36k|{
 4670|  4.36k|    BYTE* const op = (BYTE*)dst;
 4671|  4.36k|    U32   const dictIDSizeCodeLength = (dictID>0) + (dictID>=256) + (dictID>=65536);   /* 0-3 */
 4672|  4.36k|    U32   const dictIDSizeCode = params->fParams.noDictIDFlag ? 0 : dictIDSizeCodeLength;   /* 0-3 */
  ------------------
  |  Branch (4672:34): [True: 0, False: 4.36k]
  ------------------
 4673|  4.36k|    U32   const checksumFlag = params->fParams.checksumFlag>0;
 4674|  4.36k|    U32   const windowSize = (U32)1 << params->cParams.windowLog;
 4675|  4.36k|    U32   const singleSegment = params->fParams.contentSizeFlag && (windowSize >= pledgedSrcSize);
  ------------------
  |  Branch (4675:33): [True: 4.36k, False: 0]
  |  Branch (4675:68): [True: 4.36k, False: 0]
  ------------------
 4676|  4.36k|    BYTE  const windowLogByte = (BYTE)((params->cParams.windowLog - ZSTD_WINDOWLOG_ABSOLUTEMIN) << 3);
  ------------------
  |  |   78|  4.36k|#define ZSTD_WINDOWLOG_ABSOLUTEMIN 10
  ------------------
 4677|  4.36k|    U32   const fcsCode = params->fParams.contentSizeFlag ?
  ------------------
  |  Branch (4677:27): [True: 4.36k, False: 0]
  ------------------
 4678|  4.36k|                     (pledgedSrcSize>=256) + (pledgedSrcSize>=65536+256) + (pledgedSrcSize>=0xFFFFFFFFU) : 0;  /* 0-3 */
 4679|  4.36k|    BYTE  const frameHeaderDescriptionByte = (BYTE)(dictIDSizeCode + (checksumFlag<<2) + (singleSegment<<5) + (fcsCode<<6) );
 4680|  4.36k|    size_t pos=0;
 4681|       |
 4682|  4.36k|    assert(!(params->fParams.contentSizeFlag && pledgedSrcSize == ZSTD_CONTENTSIZE_UNKNOWN));
  ------------------
  |  |   70|  4.36k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 4683|  4.36k|    RETURN_ERROR_IF(dstCapacity < ZSTD_FRAMEHEADERSIZE_MAX, dstSize_tooSmall,
  ------------------
  |  |  114|  4.36k|    do {                                                                       \
  |  |  115|  4.36k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 12, False: 4.35k]
  |  |  ------------------
  |  |  116|     12|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|     12|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 12]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|     12|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|     12|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|     12|    do {                                           \
  |  |  |  |   99|     12|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 12]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|     12|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 12]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|     12|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|     12|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 12]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|     12|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|     12|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 12]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|     12|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|     12|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|     12|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|     12|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|     12|        }                                                                      \
  |  |  123|  4.36k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 4.35k]
  |  |  ------------------
  ------------------
 4684|  4.36k|                    "dst buf is too small to fit worst-case frame header size.");
 4685|  4.35k|    DEBUGLOG(4, "ZSTD_writeFrameHeader : dictIDFlag : %u ; dictID : %u ; dictIDSizeCode : %u",
  ------------------
  |  |  104|  4.35k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 4.35k]
  |  |  ------------------
  ------------------
 4686|  4.35k|                !params->fParams.noDictIDFlag, (unsigned)dictID, (unsigned)dictIDSizeCode);
 4687|  4.35k|    if (params->format == ZSTD_f_zstd1) {
  ------------------
  |  Branch (4687:9): [True: 4.35k, False: 0]
  ------------------
 4688|  4.35k|        MEM_writeLE32(dst, ZSTD_MAGICNUMBER);
  ------------------
  |  |  142|  4.35k|#define ZSTD_MAGICNUMBER            0xFD2FB528    /* valid since v0.8.0 */
  ------------------
 4689|  4.35k|        pos = 4;
 4690|  4.35k|    }
 4691|  4.35k|    op[pos++] = frameHeaderDescriptionByte;
 4692|  4.35k|    if (!singleSegment) op[pos++] = windowLogByte;
  ------------------
  |  Branch (4692:9): [True: 0, False: 4.35k]
  ------------------
 4693|  4.35k|    switch(dictIDSizeCode)
 4694|  4.35k|    {
 4695|      0|        default:
  ------------------
  |  Branch (4695:9): [True: 0, False: 4.35k]
  ------------------
 4696|      0|            assert(0); /* impossible */
  ------------------
  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 4697|      0|            ZSTD_FALLTHROUGH;
  ------------------
  |  |  288|      0|#  define ZSTD_FALLTHROUGH ; __attribute__((__fallthrough__))
  ------------------
 4698|  4.35k|        case 0 : break;
  ------------------
  |  Branch (4698:9): [True: 4.35k, False: 0]
  ------------------
 4699|      0|        case 1 : op[pos] = (BYTE)(dictID); pos++; break;
  ------------------
  |  Branch (4699:9): [True: 0, False: 4.35k]
  ------------------
 4700|      0|        case 2 : MEM_writeLE16(op+pos, (U16)dictID); pos+=2; break;
  ------------------
  |  Branch (4700:9): [True: 0, False: 4.35k]
  ------------------
 4701|      0|        case 3 : MEM_writeLE32(op+pos, dictID); pos+=4; break;
  ------------------
  |  Branch (4701:9): [True: 0, False: 4.35k]
  ------------------
 4702|  4.35k|    }
 4703|  4.35k|    switch(fcsCode)
 4704|  4.35k|    {
 4705|      0|        default:
  ------------------
  |  Branch (4705:9): [True: 0, False: 4.35k]
  ------------------
 4706|      0|            assert(0); /* impossible */
  ------------------
  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 4707|      0|            ZSTD_FALLTHROUGH;
  ------------------
  |  |  288|      0|#  define ZSTD_FALLTHROUGH ; __attribute__((__fallthrough__))
  ------------------
 4708|  4.35k|        case 0 : if (singleSegment) op[pos++] = (BYTE)(pledgedSrcSize); break;
  ------------------
  |  Branch (4708:9): [True: 4.35k, False: 0]
  |  Branch (4708:22): [True: 4.35k, False: 0]
  ------------------
 4709|      0|        case 1 : MEM_writeLE16(op+pos, (U16)(pledgedSrcSize-256)); pos+=2; break;
  ------------------
  |  Branch (4709:9): [True: 0, False: 4.35k]
  ------------------
 4710|      0|        case 2 : MEM_writeLE32(op+pos, (U32)(pledgedSrcSize)); pos+=4; break;
  ------------------
  |  Branch (4710:9): [True: 0, False: 4.35k]
  ------------------
 4711|      0|        case 3 : MEM_writeLE64(op+pos, (U64)(pledgedSrcSize)); pos+=8; break;
  ------------------
  |  Branch (4711:9): [True: 0, False: 4.35k]
  ------------------
 4712|  4.35k|    }
 4713|  4.35k|    return pos;
 4714|  4.35k|}
zstd_compress.c:ZSTD_getCParams_internal:
 8321|  4.36k|{
 8322|  4.36k|    U64 const rSize = ZSTD_getCParamRowSize(srcSizeHint, dictSize, mode);
 8323|  4.36k|    U32 const tableID = (rSize <= 256 KB) + (rSize <= 128 KB) + (rSize <= 16 KB);
  ------------------
  |  |   67|  4.36k|#define KB *(1 <<10)
  ------------------
                  U32 const tableID = (rSize <= 256 KB) + (rSize <= 128 KB) + (rSize <= 16 KB);
  ------------------
  |  |   67|  4.36k|#define KB *(1 <<10)
  ------------------
                  U32 const tableID = (rSize <= 256 KB) + (rSize <= 128 KB) + (rSize <= 16 KB);
  ------------------
  |  |   67|  4.36k|#define KB *(1 <<10)
  ------------------
 8324|  4.36k|    int row;
 8325|  4.36k|    DEBUGLOG(5, "ZSTD_getCParams_internal (cLevel=%i)", compressionLevel);
  ------------------
  |  |  104|  4.36k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 4.36k]
  |  |  ------------------
  ------------------
 8326|       |
 8327|       |    /* row */
 8328|  4.36k|    if (compressionLevel == 0) row = ZSTD_CLEVEL_DEFAULT;   /* 0 == default */
  ------------------
  |  |  134|      0|#  define ZSTD_CLEVEL_DEFAULT 3
  ------------------
  |  Branch (8328:9): [True: 0, False: 4.36k]
  ------------------
 8329|  4.36k|    else if (compressionLevel < 0) row = 0;   /* entry 0 is baseline for fast mode */
  ------------------
  |  Branch (8329:14): [True: 0, False: 4.36k]
  ------------------
 8330|  4.36k|    else if (compressionLevel > ZSTD_MAX_CLEVEL) row = ZSTD_MAX_CLEVEL;
  ------------------
  |  |   19|  4.36k|#define ZSTD_MAX_CLEVEL     22
  ------------------
                  else if (compressionLevel > ZSTD_MAX_CLEVEL) row = ZSTD_MAX_CLEVEL;
  ------------------
  |  |   19|      0|#define ZSTD_MAX_CLEVEL     22
  ------------------
  |  Branch (8330:14): [True: 0, False: 4.36k]
  ------------------
 8331|  4.36k|    else row = compressionLevel;
 8332|       |
 8333|  4.36k|    {   ZSTD_compressionParameters cp = ZSTD_defaultCParameters[tableID][row];
 8334|  4.36k|        DEBUGLOG(5, "ZSTD_getCParams_internal selected tableID: %u row: %u strat: %u", tableID, row, (U32)cp.strategy);
  ------------------
  |  |  104|  4.36k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 4.36k]
  |  |  ------------------
  ------------------
 8335|       |        /* acceleration factor */
 8336|  4.36k|        if (compressionLevel < 0) {
  ------------------
  |  Branch (8336:13): [True: 0, False: 4.36k]
  ------------------
 8337|      0|            int const clampedCompressionLevel = MAX(ZSTD_minCLevel(), compressionLevel);
  ------------------
  |  |   55|      0|#define MAX(a,b) ((a)>(b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (55:19): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 8338|      0|            cp.targetLength = (unsigned)(-clampedCompressionLevel);
 8339|      0|        }
 8340|       |        /* refine parameters based on srcSize & dictSize */
 8341|  4.36k|        return ZSTD_adjustCParams_internal(cp, srcSizeHint, dictSize, mode, ZSTD_ps_auto);
 8342|  4.36k|    }
 8343|  4.36k|}
zstd_compress.c:ZSTD_getCParamRowSize:
 8296|  4.36k|{
 8297|  4.36k|    switch (mode) {
 8298|      0|    case ZSTD_cpm_unknown:
  ------------------
  |  Branch (8298:5): [True: 0, False: 4.36k]
  ------------------
 8299|  4.36k|    case ZSTD_cpm_noAttachDict:
  ------------------
  |  Branch (8299:5): [True: 4.36k, False: 0]
  ------------------
 8300|  4.36k|    case ZSTD_cpm_createCDict:
  ------------------
  |  Branch (8300:5): [True: 0, False: 4.36k]
  ------------------
 8301|  4.36k|        break;
 8302|      0|    case ZSTD_cpm_attachDict:
  ------------------
  |  Branch (8302:5): [True: 0, False: 4.36k]
  ------------------
 8303|      0|        dictSize = 0;
 8304|      0|        break;
 8305|      0|    default:
  ------------------
  |  Branch (8305:5): [True: 0, False: 4.36k]
  ------------------
 8306|      0|        assert(0);
  ------------------
  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 8307|      0|        break;
 8308|  4.36k|    }
 8309|  4.36k|    {   int const unknown = srcSizeHint == ZSTD_CONTENTSIZE_UNKNOWN;
  ------------------
  |  |  203|  4.36k|#define ZSTD_CONTENTSIZE_UNKNOWN (0ULL - 1)
  ------------------
 8310|  4.36k|        size_t const addedSize = unknown && dictSize > 0 ? 500 : 0;
  ------------------
  |  Branch (8310:34): [True: 0, False: 4.36k]
  |  Branch (8310:45): [True: 0, False: 0]
  ------------------
 8311|  4.36k|        return unknown && dictSize == 0 ? ZSTD_CONTENTSIZE_UNKNOWN : srcSizeHint+dictSize+addedSize;
  ------------------
  |  |  203|      0|#define ZSTD_CONTENTSIZE_UNKNOWN (0ULL - 1)
  ------------------
  |  Branch (8311:16): [True: 0, False: 4.36k]
  |  Branch (8311:27): [True: 0, False: 0]
  ------------------
 8312|  4.36k|    }
 8313|  4.36k|}
zstd_compress.c:ZSTD_getParams_internal:
 8360|  4.36k|{
 8361|  4.36k|    ZSTD_parameters params;
 8362|  4.36k|    ZSTD_compressionParameters const cParams = ZSTD_getCParams_internal(compressionLevel, srcSizeHint, dictSize, mode);
 8363|  4.36k|    DEBUGLOG(5, "ZSTD_getParams (cLevel=%i)", compressionLevel);
  ------------------
  |  |  104|  4.36k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 4.36k]
  |  |  ------------------
  ------------------
 8364|  4.36k|    ZSTD_memset(&params, 0, sizeof(params));
  ------------------
  |  |   46|  4.36k|# define ZSTD_memset(p,v,l) __builtin_memset((p),(v),(l))
  ------------------
 8365|  4.36k|    params.cParams = cParams;
 8366|  4.36k|    params.fParams.contentSizeFlag = 1;
 8367|  4.36k|    return params;
 8368|  4.36k|}

zstd_compress.c:ZSTD_hasExtSeqProd:
 1642|  17.4k|MEM_STATIC int ZSTD_hasExtSeqProd(const ZSTD_CCtx_params* params) {
 1643|       |    return params->extSeqProdFunc != NULL;
 1644|  17.4k|}
zstd_compress.c:ZSTD_LLcode:
  614|  13.0k|{
  615|  13.0k|    static const BYTE LL_Code[64] = {  0,  1,  2,  3,  4,  5,  6,  7,
  616|  13.0k|                                       8,  9, 10, 11, 12, 13, 14, 15,
  617|  13.0k|                                      16, 16, 17, 17, 18, 18, 19, 19,
  618|  13.0k|                                      20, 20, 20, 20, 21, 21, 21, 21,
  619|  13.0k|                                      22, 22, 22, 22, 22, 22, 22, 22,
  620|  13.0k|                                      23, 23, 23, 23, 23, 23, 23, 23,
  621|  13.0k|                                      24, 24, 24, 24, 24, 24, 24, 24,
  622|  13.0k|                                      24, 24, 24, 24, 24, 24, 24, 24 };
  623|  13.0k|    static const U32 LL_deltaCode = 19;
  624|  13.0k|    return (litLength > 63) ? ZSTD_highbit32(litLength) + LL_deltaCode : LL_Code[litLength];
  ------------------
  |  Branch (624:12): [True: 515, False: 12.4k]
  ------------------
  625|  13.0k|}
zstd_compress.c:ZSTD_MLcode:
  631|  13.0k|{
  632|  13.0k|    static const BYTE ML_Code[128] = { 0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14, 15,
  633|  13.0k|                                      16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
  634|  13.0k|                                      32, 32, 33, 33, 34, 34, 35, 35, 36, 36, 36, 36, 37, 37, 37, 37,
  635|  13.0k|                                      38, 38, 38, 38, 38, 38, 38, 38, 39, 39, 39, 39, 39, 39, 39, 39,
  636|  13.0k|                                      40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
  637|  13.0k|                                      41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41,
  638|  13.0k|                                      42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42,
  639|  13.0k|                                      42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42 };
  640|  13.0k|    static const U32 ML_deltaCode = 36;
  641|  13.0k|    return (mlBase > 127) ? ZSTD_highbit32(mlBase) + ML_deltaCode : ML_Code[mlBase];
  ------------------
  |  Branch (641:12): [True: 0, False: 13.0k]
  ------------------
  642|  13.0k|}
zstd_compress.c:ZSTD_literalsCompressionIsDisabled:
  715|  4.35k|{
  716|  4.35k|    switch (cctxParams->literalCompressionMode) {
  717|      0|    case ZSTD_ps_enable:
  ------------------
  |  Branch (717:5): [True: 0, False: 4.35k]
  ------------------
  718|      0|        return 0;
  719|      0|    case ZSTD_ps_disable:
  ------------------
  |  Branch (719:5): [True: 0, False: 4.35k]
  ------------------
  720|      0|        return 1;
  721|      0|    default:
  ------------------
  |  Branch (721:5): [True: 0, False: 4.35k]
  ------------------
  722|      0|        assert(0 /* impossible: pre-validated */);
  ------------------
  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  723|      0|        ZSTD_FALLTHROUGH;
  ------------------
  |  |  288|      0|#  define ZSTD_FALLTHROUGH ; __attribute__((__fallthrough__))
  ------------------
  724|  4.35k|    case ZSTD_ps_auto:
  ------------------
  |  Branch (724:5): [True: 4.35k, False: 0]
  ------------------
  725|  4.35k|        return (cctxParams->cParams.strategy == ZSTD_fast) && (cctxParams->cParams.targetLength > 0);
  ------------------
  |  Branch (725:16): [True: 0, False: 4.35k]
  |  Branch (725:63): [True: 0, False: 0]
  ------------------
  726|  4.35k|    }
  727|  4.35k|}
zstd_compress.c:ZSTD_window_update:
 1386|  4.35k|{
 1387|  4.35k|    BYTE const* const ip = (BYTE const*)src;
 1388|  4.35k|    U32 contiguous = 1;
 1389|  4.35k|    DEBUGLOG(5, "ZSTD_window_update");
  ------------------
  |  |  104|  4.35k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 4.35k]
  |  |  ------------------
  ------------------
 1390|  4.35k|    if (srcSize == 0)
  ------------------
  |  Branch (1390:9): [True: 0, False: 4.35k]
  ------------------
 1391|      0|        return contiguous;
 1392|  4.35k|    assert(window->base != NULL);
  ------------------
  |  |   70|  4.35k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1393|  4.35k|    assert(window->dictBase != NULL);
  ------------------
  |  |   70|  4.35k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1394|       |    /* Check if blocks follow each other */
 1395|  4.35k|    if (src != window->nextSrc || forceNonContiguous) {
  ------------------
  |  Branch (1395:9): [True: 4.35k, False: 0]
  |  Branch (1395:35): [True: 0, False: 0]
  ------------------
 1396|       |        /* not contiguous */
 1397|  4.35k|        size_t const distanceFromBase = (size_t)(window->nextSrc - window->base);
 1398|  4.35k|        DEBUGLOG(5, "Non contiguous blocks, new segment starts at %u", window->dictLimit);
  ------------------
  |  |  104|  4.35k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 4.35k]
  |  |  ------------------
  ------------------
 1399|  4.35k|        window->lowLimit = window->dictLimit;
 1400|  4.35k|        assert(distanceFromBase == (size_t)(U32)distanceFromBase);  /* should never overflow */
  ------------------
  |  |   70|  4.35k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1401|  4.35k|        window->dictLimit = (U32)distanceFromBase;
 1402|  4.35k|        window->dictBase = window->base;
 1403|  4.35k|        window->base = ip - distanceFromBase;
 1404|       |        /* ms->nextToUpdate = window->dictLimit; */
 1405|  4.35k|        if (window->dictLimit - window->lowLimit < HASH_READ_SIZE) window->lowLimit = window->dictLimit;   /* too small extDict */
  ------------------
  |  |   33|  4.35k|#define HASH_READ_SIZE       8
  ------------------
  |  Branch (1405:13): [True: 4.35k, False: 0]
  ------------------
 1406|  4.35k|        contiguous = 0;
 1407|  4.35k|    }
 1408|  4.35k|    window->nextSrc = ip + srcSize;
 1409|       |    /* if input and dictionary overlap : reduce dictionary (area presumed modified by input) */
 1410|  4.35k|    if ( (ip+srcSize > window->dictBase + window->lowLimit)
  ------------------
  |  Branch (1410:10): [True: 0, False: 4.35k]
  ------------------
 1411|  4.35k|       & (ip < window->dictBase + window->dictLimit)) {
 1412|      0|        size_t const highInputIdx = (size_t)((ip + srcSize) - window->dictBase);
 1413|      0|        U32 const lowLimitMax = (highInputIdx > (size_t)window->dictLimit) ? window->dictLimit : (U32)highInputIdx;
  ------------------
  |  Branch (1413:33): [True: 0, False: 0]
  ------------------
 1414|      0|        assert(highInputIdx < UINT_MAX);
  ------------------
  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1415|      0|        window->lowLimit = lowLimitMax;
 1416|      0|        DEBUGLOG(5, "Overlapping extDict and input : new lowLimit = %u", window->lowLimit);
  ------------------
  |  |  104|      0|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1417|      0|    }
 1418|  4.35k|    return contiguous;
 1419|  4.35k|}
zstd_compress.c:ZSTD_window_needOverflowCorrection:
 1167|  4.35k|{
 1168|  4.35k|    U32 const curr = (U32)((BYTE const*)srcEnd - window.base);
 1169|  4.35k|    if (ZSTD_WINDOW_OVERFLOW_CORRECT_FREQUENTLY) {
  ------------------
  |  | 1115|  4.35k|#    define ZSTD_WINDOW_OVERFLOW_CORRECT_FREQUENTLY 1
  |  |  ------------------
  |  |  |  Branch (1115:53): [True: 4.35k, Folded]
  |  |  ------------------
  ------------------
 1170|  4.35k|        if (ZSTD_window_canOverflowCorrect(window, cycleLog, maxDist, loadedDictEnd, src)) {
  ------------------
  |  Branch (1170:13): [True: 133, False: 4.21k]
  ------------------
 1171|    133|            return 1;
 1172|    133|        }
 1173|  4.35k|    }
 1174|  4.21k|    return curr > ZSTD_CURRENT_MAX;
  ------------------
  |  | 1060|  4.21k|#define ZSTD_CURRENT_MAX (MEM_64bits() ? 3500U MB : 2000U MB)
  |  |  ------------------
  |  |  |  |   68|  4.21k|#define MB *(1 <<20)
  |  |  ------------------
  |  |               #define ZSTD_CURRENT_MAX (MEM_64bits() ? 3500U MB : 2000U MB)
  |  |  ------------------
  |  |  |  |   68|      0|#define MB *(1 <<20)
  |  |  ------------------
  |  |  |  Branch (1060:27): [True: 4.21k, False: 0]
  |  |  ------------------
  ------------------
 1175|  4.35k|}
zstd_compress.c:ZSTD_window_canOverflowCorrect:
 1131|  4.35k|{
 1132|  4.35k|    U32 const cycleSize = 1u << cycleLog;
 1133|  4.35k|    U32 const curr = (U32)((BYTE const*)src - window.base);
 1134|  4.35k|    U32 const minIndexToOverflowCorrect = cycleSize
 1135|  4.35k|                                        + MAX(maxDist, cycleSize)
  ------------------
  |  |   55|  4.35k|#define MAX(a,b) ((a)>(b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (55:19): [True: 4.35k, False: 0]
  |  |  ------------------
  ------------------
 1136|  4.35k|                                        + ZSTD_WINDOW_START_INDEX;
  ------------------
  |  |  270|  4.35k|#define ZSTD_WINDOW_START_INDEX 2
  ------------------
 1137|       |
 1138|       |    /* Adjust the min index to backoff the overflow correction frequency,
 1139|       |     * so we don't waste too much CPU in overflow correction. If this
 1140|       |     * computation overflows we don't really care, we just need to make
 1141|       |     * sure it is at least minIndexToOverflowCorrect.
 1142|       |     */
 1143|  4.35k|    U32 const adjustment = window.nbOverflowCorrections + 1;
 1144|  4.35k|    U32 const adjustedIndex = MAX(minIndexToOverflowCorrect * adjustment,
  ------------------
  |  |   55|  4.35k|#define MAX(a,b) ((a)>(b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (55:19): [True: 4.03k, False: 320]
  |  |  ------------------
  ------------------
 1145|  4.35k|                                  minIndexToOverflowCorrect);
 1146|  4.35k|    U32 const indexLargeEnough = curr > adjustedIndex;
 1147|       |
 1148|       |    /* Only overflow correct early if the dictionary is invalidated already,
 1149|       |     * so we don't hurt compression ratio.
 1150|       |     */
 1151|  4.35k|    U32 const dictionaryInvalidated = curr > maxDist + loadedDictEnd;
 1152|       |
 1153|  4.35k|    return indexLargeEnough && dictionaryInvalidated;
  ------------------
  |  Branch (1153:12): [True: 133, False: 4.21k]
  |  Branch (1153:32): [True: 133, False: 0]
  ------------------
 1154|  4.35k|}
zstd_compress.c:ZSTD_window_correctOverflow:
 1190|    133|{
 1191|       |    /* preemptive overflow correction:
 1192|       |     * 1. correction is large enough:
 1193|       |     *    lowLimit > (3<<29) ==> current > 3<<29 + 1<<windowLog
 1194|       |     *    1<<windowLog <= newCurrent < 1<<chainLog + 1<<windowLog
 1195|       |     *
 1196|       |     *    current - newCurrent
 1197|       |     *    > (3<<29 + 1<<windowLog) - (1<<windowLog + 1<<chainLog)
 1198|       |     *    > (3<<29) - (1<<chainLog)
 1199|       |     *    > (3<<29) - (1<<30)             (NOTE: chainLog <= 30)
 1200|       |     *    > 1<<29
 1201|       |     *
 1202|       |     * 2. (ip+ZSTD_CHUNKSIZE_MAX - cctx->base) doesn't overflow:
 1203|       |     *    After correction, current is less than (1<<chainLog + 1<<windowLog).
 1204|       |     *    In 64-bit mode we are safe, because we have 64-bit ptrdiff_t.
 1205|       |     *    In 32-bit mode we are safe, because (chainLog <= 29), so
 1206|       |     *    ip+ZSTD_CHUNKSIZE_MAX - cctx->base < 1<<32.
 1207|       |     * 3. (cctx->lowLimit + 1<<windowLog) < 1<<32:
 1208|       |     *    windowLog <= 31 ==> 3<<29 + 1<<windowLog < 7<<29 < 1<<32.
 1209|       |     */
 1210|    133|    U32 const cycleSize = 1u << cycleLog;
 1211|    133|    U32 const cycleMask = cycleSize - 1;
 1212|    133|    U32 const curr = (U32)((BYTE const*)src - window->base);
 1213|    133|    U32 const currentCycle = curr & cycleMask;
 1214|       |    /* Ensure newCurrent - maxDist >= ZSTD_WINDOW_START_INDEX. */
 1215|    133|    U32 const currentCycleCorrection = currentCycle < ZSTD_WINDOW_START_INDEX
  ------------------
  |  |  270|    133|#define ZSTD_WINDOW_START_INDEX 2
  ------------------
  |  Branch (1215:40): [True: 0, False: 133]
  ------------------
 1216|    133|                                     ? MAX(cycleSize, ZSTD_WINDOW_START_INDEX)
  ------------------
  |  |   55|      0|#define MAX(a,b) ((a)>(b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (55:19): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1217|    133|                                     : 0;
 1218|    133|    U32 const newCurrent = currentCycle
 1219|    133|                         + currentCycleCorrection
 1220|    133|                         + MAX(maxDist, cycleSize);
  ------------------
  |  |   55|    133|#define MAX(a,b) ((a)>(b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (55:19): [True: 133, False: 0]
  |  |  ------------------
  ------------------
 1221|    133|    U32 const correction = curr - newCurrent;
 1222|       |    /* maxDist must be a power of two so that:
 1223|       |     *   (newCurrent & cycleMask) == (curr & cycleMask)
 1224|       |     * This is required to not corrupt the chains / binary tree.
 1225|       |     */
 1226|    133|    assert((maxDist & (maxDist - 1)) == 0);
  ------------------
  |  |   70|    133|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1227|    133|    assert((curr & cycleMask) == (newCurrent & cycleMask));
  ------------------
  |  |   70|    133|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1228|    133|    assert(curr > newCurrent);
  ------------------
  |  |   70|    133|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1229|    133|    if (!ZSTD_WINDOW_OVERFLOW_CORRECT_FREQUENTLY) {
  ------------------
  |  | 1115|    133|#    define ZSTD_WINDOW_OVERFLOW_CORRECT_FREQUENTLY 1
  ------------------
  |  Branch (1229:9): [Folded, False: 133]
  ------------------
 1230|       |        /* Loose bound, should be around 1<<29 (see above) */
 1231|      0|        assert(correction > 1<<28);
  ------------------
  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1232|      0|    }
 1233|       |
 1234|    133|    window->base += correction;
 1235|    133|    window->dictBase += correction;
 1236|    133|    if (window->lowLimit < correction + ZSTD_WINDOW_START_INDEX) {
  ------------------
  |  |  270|    133|#define ZSTD_WINDOW_START_INDEX 2
  ------------------
  |  Branch (1236:9): [True: 0, False: 133]
  ------------------
 1237|      0|        window->lowLimit = ZSTD_WINDOW_START_INDEX;
  ------------------
  |  |  270|      0|#define ZSTD_WINDOW_START_INDEX 2
  ------------------
 1238|    133|    } else {
 1239|    133|        window->lowLimit -= correction;
 1240|    133|    }
 1241|    133|    if (window->dictLimit < correction + ZSTD_WINDOW_START_INDEX) {
  ------------------
  |  |  270|    133|#define ZSTD_WINDOW_START_INDEX 2
  ------------------
  |  Branch (1241:9): [True: 0, False: 133]
  ------------------
 1242|      0|        window->dictLimit = ZSTD_WINDOW_START_INDEX;
  ------------------
  |  |  270|      0|#define ZSTD_WINDOW_START_INDEX 2
  ------------------
 1243|    133|    } else {
 1244|    133|        window->dictLimit -= correction;
 1245|    133|    }
 1246|       |
 1247|       |    /* Ensure we can still reference the full window. */
 1248|    133|    assert(newCurrent >= maxDist);
  ------------------
  |  |   70|    133|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1249|    133|    assert(newCurrent - maxDist >= ZSTD_WINDOW_START_INDEX);
  ------------------
  |  |   70|    133|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1250|       |    /* Ensure that lowLimit and dictLimit didn't underflow. */
 1251|    133|    assert(window->lowLimit <= newCurrent);
  ------------------
  |  |   70|    133|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1252|    133|    assert(window->dictLimit <= newCurrent);
  ------------------
  |  |   70|    133|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1253|       |
 1254|    133|    ++window->nbOverflowCorrections;
 1255|       |
 1256|    133|    DEBUGLOG(4, "Correction of 0x%x bytes to lowLimit=0x%x", correction,
  ------------------
  |  |  104|    133|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 133]
  |  |  ------------------
  ------------------
 1257|    133|             window->lowLimit);
 1258|    133|    return correction;
 1259|    133|}
zstd_compress.c:ZSTD_checkDictValidity:
 1335|  4.35k|{
 1336|  4.35k|    assert(loadedDictEndPtr != NULL);
  ------------------
  |  |   70|  4.35k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1337|  4.35k|    assert(dictMatchStatePtr != NULL);
  ------------------
  |  |   70|  4.35k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1338|  4.35k|    {   U32 const blockEndIdx = (U32)((BYTE const*)blockEnd - window->base);
 1339|  4.35k|        U32 const loadedDictEnd = *loadedDictEndPtr;
 1340|  4.35k|        DEBUGLOG(5, "ZSTD_checkDictValidity: blockEndIdx=%u, maxDist=%u, loadedDictEnd=%u",
  ------------------
  |  |  104|  4.35k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 4.35k]
  |  |  ------------------
  ------------------
 1341|  4.35k|                    (unsigned)blockEndIdx, (unsigned)maxDist, (unsigned)loadedDictEnd);
 1342|  4.35k|        assert(blockEndIdx >= loadedDictEnd);
  ------------------
  |  |   70|  4.35k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1343|       |
 1344|  4.35k|        if (blockEndIdx > loadedDictEnd + maxDist || loadedDictEnd != window->dictLimit) {
  ------------------
  |  Branch (1344:13): [True: 4.11k, False: 232]
  |  Branch (1344:54): [True: 232, False: 0]
  ------------------
 1345|       |            /* On reaching window size, dictionaries are invalidated.
 1346|       |             * For simplification, if window size is reached anywhere within next block,
 1347|       |             * the dictionary is invalidated for the full block.
 1348|       |             *
 1349|       |             * We also have to invalidate the dictionary if ZSTD_window_update() has detected
 1350|       |             * non-contiguous segments, which means that loadedDictEnd != window->dictLimit.
 1351|       |             * loadedDictEnd may be 0, if forceWindow is true, but in that case we never use
 1352|       |             * dictMatchState, so setting it to NULL is not a problem.
 1353|       |             */
 1354|  4.35k|            DEBUGLOG(6, "invalidating dictionary for current block (distance > windowSize)");
  ------------------
  |  |  104|  4.35k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 4.35k]
  |  |  ------------------
  ------------------
 1355|  4.35k|            *loadedDictEndPtr = 0;
 1356|  4.35k|            *dictMatchStatePtr = NULL;
 1357|  4.35k|        } else {
 1358|      0|            if (*loadedDictEndPtr != 0) {
  ------------------
  |  Branch (1358:17): [True: 0, False: 0]
  ------------------
 1359|      0|                DEBUGLOG(6, "dictionary considered valid for current block");
  ------------------
  |  |  104|      0|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1360|      0|    }   }   }
 1361|  4.35k|}
zstd_compress.c:ZSTD_window_enforceMaxDist:
 1290|  4.35k|{
 1291|  4.35k|    U32 const blockEndIdx = (U32)((BYTE const*)blockEnd - window->base);
 1292|  4.35k|    U32 const loadedDictEnd = (loadedDictEndPtr != NULL) ? *loadedDictEndPtr : 0;
  ------------------
  |  Branch (1292:31): [True: 4.35k, False: 0]
  ------------------
 1293|  4.35k|    DEBUGLOG(5, "ZSTD_window_enforceMaxDist: blockEndIdx=%u, maxDist=%u, loadedDictEnd=%u",
  ------------------
  |  |  104|  4.35k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 4.35k]
  |  |  ------------------
  ------------------
 1294|  4.35k|                (unsigned)blockEndIdx, (unsigned)maxDist, (unsigned)loadedDictEnd);
 1295|       |
 1296|       |    /* - When there is no dictionary : loadedDictEnd == 0.
 1297|       |         In which case, the test (blockEndIdx > maxDist) is merely to avoid
 1298|       |         overflowing next operation `newLowLimit = blockEndIdx - maxDist`.
 1299|       |       - When there is a standard dictionary :
 1300|       |         Index referential is copied from the dictionary,
 1301|       |         which means it starts from 0.
 1302|       |         In which case, loadedDictEnd == dictSize,
 1303|       |         and it makes sense to compare `blockEndIdx > maxDist + dictSize`
 1304|       |         since `blockEndIdx` also starts from zero.
 1305|       |       - When there is an attached dictionary :
 1306|       |         loadedDictEnd is expressed within the referential of the context,
 1307|       |         so it can be directly compared against blockEndIdx.
 1308|       |    */
 1309|  4.35k|    if (blockEndIdx > maxDist + loadedDictEnd) {
  ------------------
  |  Branch (1309:9): [True: 4.09k, False: 253]
  ------------------
 1310|  4.09k|        U32 const newLowLimit = blockEndIdx - maxDist;
 1311|  4.09k|        if (window->lowLimit < newLowLimit) window->lowLimit = newLowLimit;
  ------------------
  |  Branch (1311:13): [True: 0, False: 4.09k]
  ------------------
 1312|  4.09k|        if (window->dictLimit < window->lowLimit) {
  ------------------
  |  Branch (1312:13): [True: 0, False: 4.09k]
  ------------------
 1313|      0|            DEBUGLOG(5, "Update dictLimit to match lowLimit, from %u to %u",
  ------------------
  |  |  104|      0|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1314|      0|                        (unsigned)window->dictLimit, (unsigned)window->lowLimit);
 1315|      0|            window->dictLimit = window->lowLimit;
 1316|      0|        }
 1317|       |        /* On reaching window size, dictionaries are invalidated */
 1318|  4.09k|        if (loadedDictEndPtr) *loadedDictEndPtr = 0;
  ------------------
  |  Branch (1318:13): [True: 4.09k, False: 0]
  ------------------
 1319|  4.09k|        if (dictMatchStatePtr) *dictMatchStatePtr = NULL;
  ------------------
  |  Branch (1319:13): [True: 4.09k, False: 0]
  ------------------
 1320|  4.09k|    }
 1321|  4.35k|}
zstd_compress.c:ZSTD_matchState_dictMode:
 1101|  4.35k|{
 1102|  4.35k|    return ZSTD_window_hasExtDict(ms->window) ?
  ------------------
  |  Branch (1102:12): [True: 0, False: 4.35k]
  ------------------
 1103|      0|        ZSTD_extDict :
 1104|  4.35k|        ms->dictMatchState != NULL ?
  ------------------
  |  Branch (1104:9): [True: 0, False: 4.35k]
  ------------------
 1105|      0|            (ms->dictMatchState->dedicatedDictSearch ? ZSTD_dedicatedDictSearch : ZSTD_dictMatchState) :
  ------------------
  |  Branch (1105:14): [True: 0, False: 0]
  ------------------
 1106|  4.35k|            ZSTD_noDict;
 1107|  4.35k|}
zstd_compress.c:ZSTD_window_hasExtDict:
 1091|  4.35k|{
 1092|  4.35k|    return window.lowLimit < window.dictLimit;
 1093|  4.35k|}
zstd_compress.c:ZSTD_minGain:
  707|  2.90k|{
  708|  2.90k|    U32 const minlog = (strat>=ZSTD_btultra) ? (U32)(strat) - 1 : 6;
  ------------------
  |  Branch (708:24): [True: 1.29k, False: 1.60k]
  ------------------
  709|  2.90k|    ZSTD_STATIC_ASSERT(ZSTD_btultra == 8);
  ------------------
  |  |   43|  2.90k|#define ZSTD_STATIC_ASSERT(c) DEBUG_STATIC_ASSERT(c)
  |  |  ------------------
  |  |  |  |   39|  2.90k|#define DEBUG_STATIC_ASSERT(c) (void)sizeof(char[(c) ? 1 : -1])
  |  |  ------------------
  ------------------
  710|  2.90k|    assert(ZSTD_cParam_withinBounds(ZSTD_c_strategy, (int)strat));
  ------------------
  |  |   70|  2.90k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  711|  2.90k|    return (srcSize >> minlog) + 2;
  712|  2.90k|}
zstd_compress.c:ZSTD_CCtx_get_bmi2:
  568|  4.35k|MEM_STATIC int ZSTD_CCtx_get_bmi2(const struct ZSTD_CCtx_s* cctx) {
  569|  4.35k|#if DYNAMIC_BMI2
  570|  4.35k|    return cctx->bmi2;
  571|       |#else
  572|       |    (void)cctx;
  573|       |    return 0;
  574|       |#endif
  575|  4.35k|}
zstd_compress.c:ZSTD_window_clear:
 1071|  4.36k|{
 1072|  4.36k|    size_t const endT = (size_t)(window->nextSrc - window->base);
 1073|  4.36k|    U32 const end = (U32)endT;
 1074|       |
 1075|  4.36k|    window->lowLimit = end;
 1076|  4.36k|    window->dictLimit = end;
 1077|  4.36k|}
zstd_compress.c:ZSTD_window_init:
 1363|     28|MEM_STATIC void ZSTD_window_init(ZSTD_window_t* window) {
 1364|     28|    ZSTD_memset(window, 0, sizeof(*window));
  ------------------
  |  |   46|     28|# define ZSTD_memset(p,v,l) __builtin_memset((p),(v),(l))
  ------------------
 1365|     28|    window->base = (BYTE const*)" ";
 1366|     28|    window->dictBase = (BYTE const*)" ";
 1367|     28|    ZSTD_STATIC_ASSERT(ZSTD_DUBT_UNSORTED_MARK < ZSTD_WINDOW_START_INDEX); /* Start above ZSTD_DUBT_UNSORTED_MARK */
  ------------------
  |  |   43|     28|#define ZSTD_STATIC_ASSERT(c) DEBUG_STATIC_ASSERT(c)
  |  |  ------------------
  |  |  |  |   39|     28|#define DEBUG_STATIC_ASSERT(c) (void)sizeof(char[(c) ? 1 : -1])
  |  |  ------------------
  ------------------
 1368|     28|    window->dictLimit = ZSTD_WINDOW_START_INDEX;    /* start from >0, so that 1st position is valid */
  ------------------
  |  |  270|     28|#define ZSTD_WINDOW_START_INDEX 2
  ------------------
 1369|     28|    window->lowLimit = ZSTD_WINDOW_START_INDEX;     /* it ensures first and later CCtx usages compress the same */
  ------------------
  |  |  270|     28|#define ZSTD_WINDOW_START_INDEX 2
  ------------------
 1370|     28|    window->nextSrc = window->base + ZSTD_WINDOW_START_INDEX;   /* see issue #1241 */
  ------------------
  |  |  270|     28|#define ZSTD_WINDOW_START_INDEX 2
  ------------------
 1371|     28|    window->nbOverflowCorrections = 0;
 1372|     28|}
zstd_compress_literals.c:ZSTD_minGain:
  707|  3.13k|{
  708|  3.13k|    U32 const minlog = (strat>=ZSTD_btultra) ? (U32)(strat) - 1 : 6;
  ------------------
  |  Branch (708:24): [True: 1.37k, False: 1.76k]
  ------------------
  709|  3.13k|    ZSTD_STATIC_ASSERT(ZSTD_btultra == 8);
  ------------------
  |  |   43|  3.13k|#define ZSTD_STATIC_ASSERT(c) DEBUG_STATIC_ASSERT(c)
  |  |  ------------------
  |  |  |  |   39|  3.13k|#define DEBUG_STATIC_ASSERT(c) (void)sizeof(char[(c) ? 1 : -1])
  |  |  ------------------
  ------------------
  710|  3.13k|    assert(ZSTD_cParam_withinBounds(ZSTD_c_strategy, (int)strat));
  ------------------
  |  |   70|  3.13k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  711|  3.13k|    return (srcSize >> minlog) + 2;
  712|  3.13k|}
zstd_double_fast.c:ZSTD_hashPtr:
  960|  44.3k|{
  961|       |    /* Although some of these hashes do support hBits up to 64, some do not.
  962|       |     * To be on the safe side, always avoid hBits > 32. */
  963|  44.3k|    assert(hBits <= 32);
  ------------------
  |  |   70|  44.3k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  964|       |
  965|  44.3k|    switch(mls)
  966|  44.3k|    {
  967|      0|    default:
  ------------------
  |  Branch (967:5): [True: 0, False: 44.3k]
  ------------------
  968|  21.9k|    case 4: return ZSTD_hash4Ptr(p, hBits);
  ------------------
  |  Branch (968:5): [True: 21.9k, False: 22.4k]
  ------------------
  969|      0|    case 5: return ZSTD_hash5Ptr(p, hBits);
  ------------------
  |  Branch (969:5): [True: 0, False: 44.3k]
  ------------------
  970|      0|    case 6: return ZSTD_hash6Ptr(p, hBits);
  ------------------
  |  Branch (970:5): [True: 0, False: 44.3k]
  ------------------
  971|      0|    case 7: return ZSTD_hash7Ptr(p, hBits);
  ------------------
  |  Branch (971:5): [True: 0, False: 44.3k]
  ------------------
  972|  22.4k|    case 8: return ZSTD_hash8Ptr(p, hBits);
  ------------------
  |  Branch (972:5): [True: 22.4k, False: 21.9k]
  ------------------
  973|  44.3k|    }
  974|  44.3k|}
zstd_double_fast.c:ZSTD_hash4Ptr:
  934|  21.9k|static size_t ZSTD_hash4Ptr(const void* ptr, U32 h) { return ZSTD_hash4(MEM_readLE32(ptr), h, 0); }
zstd_double_fast.c:ZSTD_hash4:
  933|  21.9k|static U32    ZSTD_hash4(U32 u, U32 h, U32 s) { assert(h <= 32); return ((u * prime4bytes) ^ s) >> (32-h) ; }
  ------------------
  |  |   70|  21.9k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
zstd_double_fast.c:ZSTD_hash8Ptr:
  954|  22.4k|static size_t ZSTD_hash8Ptr(const void* p, U32 h) { return ZSTD_hash8(MEM_readLE64(p), h, 0); }
zstd_double_fast.c:ZSTD_hash8:
  953|  22.4k|static size_t ZSTD_hash8(U64 u, U32 h, U64 s) { assert(h <= 64); return (size_t)((((u) * prime8bytes)  ^ s) >> (64-h)) ; }
  ------------------
  |  |   70|  22.4k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
zstd_double_fast.c:ZSTD_getLowestPrefixIndex:
 1442|    384|{
 1443|    384|    U32    const maxDistance = 1U << windowLog;
 1444|    384|    U32    const lowestValid = ms->window.dictLimit;
 1445|    384|    U32    const withinWindow = (curr - lowestValid > maxDistance) ? curr - maxDistance : lowestValid;
  ------------------
  |  Branch (1445:33): [True: 0, False: 384]
  ------------------
 1446|    384|    U32    const isDictionary = (ms->loadedDictEnd != 0);
 1447|       |    /* When computing the lowest prefix index we need to take the dictionary into account to handle
 1448|       |     * the edge case where the dictionary and the source are contiguous in memory.
 1449|       |     */
 1450|    384|    U32    const matchLowest = isDictionary ? lowestValid : withinWindow;
  ------------------
  |  Branch (1450:32): [True: 0, False: 384]
  ------------------
 1451|    384|    return matchLowest;
 1452|    384|}
zstd_double_fast.c:ZSTD_count:
  884|    435|{
  885|    435|    const BYTE* const pStart = pIn;
  886|    435|    const BYTE* const pInLoopLimit = pInLimit - (sizeof(size_t)-1);
  887|       |
  888|    435|    if (pIn < pInLoopLimit) {
  ------------------
  |  Branch (888:9): [True: 387, False: 48]
  ------------------
  889|    387|        { size_t const diff = MEM_readST(pMatch) ^ MEM_readST(pIn);
  890|    387|          if (diff) return ZSTD_NbCommonBytes(diff); }
  ------------------
  |  Branch (890:15): [True: 381, False: 6]
  ------------------
  891|      6|        pIn+=sizeof(size_t); pMatch+=sizeof(size_t);
  892|      7|        while (pIn < pInLoopLimit) {
  ------------------
  |  Branch (892:16): [True: 4, False: 3]
  ------------------
  893|      4|            size_t const diff = MEM_readST(pMatch) ^ MEM_readST(pIn);
  894|      4|            if (!diff) { pIn+=sizeof(size_t); pMatch+=sizeof(size_t); continue; }
  ------------------
  |  Branch (894:17): [True: 1, False: 3]
  ------------------
  895|      3|            pIn += ZSTD_NbCommonBytes(diff);
  896|      3|            return (size_t)(pIn - pStart);
  897|      4|    }   }
  898|     51|    if (MEM_64bits() && (pIn<(pInLimit-3)) && (MEM_read32(pMatch) == MEM_read32(pIn))) { pIn+=4; pMatch+=4; }
  ------------------
  |  Branch (898:9): [True: 51, False: 0]
  |  Branch (898:25): [True: 44, False: 7]
  |  Branch (898:47): [True: 5, False: 39]
  ------------------
  899|     51|    if ((pIn<(pInLimit-1)) && (MEM_read16(pMatch) == MEM_read16(pIn))) { pIn+=2; pMatch+=2; }
  ------------------
  |  Branch (899:9): [True: 44, False: 7]
  |  Branch (899:31): [True: 10, False: 34]
  ------------------
  900|     51|    if ((pIn<pInLimit) && (*pMatch == *pIn)) pIn++;
  ------------------
  |  Branch (900:9): [True: 42, False: 9]
  |  Branch (900:27): [True: 7, False: 35]
  ------------------
  901|     51|    return (size_t)(pIn - pStart);
  902|    435|}
zstd_double_fast.c:ZSTD_storeSeq:
  809|    423|{
  810|    423|    BYTE const* const litLimit_w = litLimit - WILDCOPY_OVERLENGTH;
  ------------------
  |  |  201|    423|#define WILDCOPY_OVERLENGTH 32
  ------------------
  811|    423|    BYTE const* const litEnd = literals + litLength;
  812|       |#if defined(DEBUGLEVEL) && (DEBUGLEVEL >= 6)
  813|       |    static const BYTE* g_start = NULL;
  814|       |    if (g_start==NULL) g_start = (const BYTE*)literals;  /* note : index only works for compression within a single segment */
  815|       |    {   U32 const pos = (U32)((const BYTE*)literals - g_start);
  816|       |        DEBUGLOG(6, "Cpos%7u :%3u literals, match%4u bytes at offBase%7u",
  817|       |               pos, (U32)litLength, (U32)matchLength, (U32)offBase);
  818|       |    }
  819|       |#endif
  820|    423|    assert((size_t)(seqStorePtr->sequences - seqStorePtr->sequencesStart) < seqStorePtr->maxNbSeq);
  ------------------
  |  |   70|    423|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  821|       |    /* copy Literals */
  822|    423|    assert(seqStorePtr->maxNbLit <= 128 KB);
  ------------------
  |  |   70|    423|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  823|    423|    assert(seqStorePtr->lit + litLength <= seqStorePtr->litStart + seqStorePtr->maxNbLit);
  ------------------
  |  |   70|    423|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  824|    423|    assert(literals + litLength <= litLimit);
  ------------------
  |  |   70|    423|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  825|    423|    if (litEnd <= litLimit_w) {
  ------------------
  |  Branch (825:9): [True: 236, False: 187]
  ------------------
  826|       |        /* Common case we can use wildcopy.
  827|       |         * First copy 16 bytes, because literals are likely short.
  828|       |         */
  829|    236|        ZSTD_STATIC_ASSERT(WILDCOPY_OVERLENGTH >= 16);
  ------------------
  |  |   43|    236|#define ZSTD_STATIC_ASSERT(c) DEBUG_STATIC_ASSERT(c)
  |  |  ------------------
  |  |  |  |   39|    236|#define DEBUG_STATIC_ASSERT(c) (void)sizeof(char[(c) ? 1 : -1])
  |  |  ------------------
  ------------------
  830|    236|        ZSTD_copy16(seqStorePtr->lit, literals);
  831|    236|        if (litLength > 16) {
  ------------------
  |  Branch (831:13): [True: 130, False: 106]
  ------------------
  832|    130|            ZSTD_wildcopy(seqStorePtr->lit+16, literals+16, litLength-16, ZSTD_no_overlap);
  833|    130|        }
  834|    236|    } else {
  835|    187|        ZSTD_safecopyLiterals(seqStorePtr->lit, literals, litEnd, litLimit_w);
  836|    187|    }
  837|    423|    seqStorePtr->lit += litLength;
  838|       |
  839|    423|    ZSTD_storeSeqOnly(seqStorePtr, litLength, offBase, matchLength);
  840|    423|}
zstd_double_fast.c:ZSTD_safecopyLiterals:
  736|    187|{
  737|    187|    assert(iend > ilimit_w);
  ------------------
  |  |   70|    187|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  738|    187|    if (ip <= ilimit_w) {
  ------------------
  |  Branch (738:9): [True: 70, False: 117]
  ------------------
  739|     70|        ZSTD_wildcopy(op, ip, (size_t)(ilimit_w - ip), ZSTD_no_overlap);
  740|     70|        op += ilimit_w - ip;
  741|     70|        ip = ilimit_w;
  742|     70|    }
  743|  1.32k|    while (ip < iend) *op++ = *ip++;
  ------------------
  |  Branch (743:12): [True: 1.14k, False: 187]
  ------------------
  744|    187|}
zstd_double_fast.c:ZSTD_storeSeqOnly:
  768|    423|{
  769|    423|    assert((size_t)(seqStorePtr->sequences - seqStorePtr->sequencesStart) < seqStorePtr->maxNbSeq);
  ------------------
  |  |   70|    423|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  770|       |
  771|       |    /* literal Length */
  772|    423|    assert(litLength <= ZSTD_BLOCKSIZE_MAX);
  ------------------
  |  |   70|    423|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  773|    423|    if (UNLIKELY(litLength>0xFFFF)) {
  ------------------
  |  |  196|    423|#define UNLIKELY(x) (__builtin_expect((x), 0))
  |  |  ------------------
  |  |  |  Branch (196:21): [True: 0, False: 423]
  |  |  ------------------
  ------------------
  774|      0|        assert(seqStorePtr->longLengthType == ZSTD_llt_none); /* there can only be a single long length */
  ------------------
  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  775|      0|        seqStorePtr->longLengthType = ZSTD_llt_literalLength;
  776|      0|        seqStorePtr->longLengthPos = (U32)(seqStorePtr->sequences - seqStorePtr->sequencesStart);
  777|      0|    }
  778|    423|    seqStorePtr->sequences[0].litLength = (U16)litLength;
  779|       |
  780|       |    /* match offset */
  781|    423|    seqStorePtr->sequences[0].offBase = offBase;
  782|       |
  783|       |    /* match Length */
  784|    423|    assert(matchLength <= ZSTD_BLOCKSIZE_MAX);
  ------------------
  |  |   70|    423|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  785|    423|    assert(matchLength >= MINMATCH);
  ------------------
  |  |   70|    423|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  786|    423|    {   size_t const mlBase = matchLength - MINMATCH;
  ------------------
  |  |   98|    423|#define MINMATCH 3
  ------------------
  787|    423|        if (UNLIKELY(mlBase>0xFFFF)) {
  ------------------
  |  |  196|    423|#define UNLIKELY(x) (__builtin_expect((x), 0))
  |  |  ------------------
  |  |  |  Branch (196:21): [True: 0, False: 423]
  |  |  ------------------
  ------------------
  788|      0|            assert(seqStorePtr->longLengthType == ZSTD_llt_none); /* there can only be a single long length */
  ------------------
  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  789|      0|            seqStorePtr->longLengthType = ZSTD_llt_matchLength;
  790|      0|            seqStorePtr->longLengthPos = (U32)(seqStorePtr->sequences - seqStorePtr->sequencesStart);
  791|      0|        }
  792|    423|        seqStorePtr->sequences[0].mlBase = (U16)mlBase;
  793|    423|    }
  794|       |
  795|    423|    seqStorePtr->sequences++;
  796|    423|}
zstd_double_fast.c:ZSTD_selectAddr:
  661|  42.2k|{
  662|  42.2k|#if defined(__GNUC__) && defined(__x86_64__)
  663|  42.2k|    __asm__ (
  664|  42.2k|        "cmp %1, %2\n"
  665|  42.2k|        "cmova %3, %0\n"
  666|  42.2k|        : "+r"(candidate)
  667|  42.2k|        : "r"(index), "r"(lowLimit), "r"(backup)
  668|  42.2k|        );
  669|  42.2k|    return candidate;
  670|       |#else
  671|       |    return index >= lowLimit ? candidate : backup;
  672|       |#endif
  673|  42.2k|}
zstd_lazy.c:ZSTD_hashPtr:
  960|   420k|{
  961|       |    /* Although some of these hashes do support hBits up to 64, some do not.
  962|       |     * To be on the safe side, always avoid hBits > 32. */
  963|   420k|    assert(hBits <= 32);
  ------------------
  |  |   70|   420k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  964|       |
  965|   420k|    switch(mls)
  966|   420k|    {
  967|      0|    default:
  ------------------
  |  Branch (967:5): [True: 0, False: 420k]
  ------------------
  968|   420k|    case 4: return ZSTD_hash4Ptr(p, hBits);
  ------------------
  |  Branch (968:5): [True: 420k, False: 0]
  ------------------
  969|      0|    case 5: return ZSTD_hash5Ptr(p, hBits);
  ------------------
  |  Branch (969:5): [True: 0, False: 420k]
  ------------------
  970|      0|    case 6: return ZSTD_hash6Ptr(p, hBits);
  ------------------
  |  Branch (970:5): [True: 0, False: 420k]
  ------------------
  971|      0|    case 7: return ZSTD_hash7Ptr(p, hBits);
  ------------------
  |  Branch (971:5): [True: 0, False: 420k]
  ------------------
  972|      0|    case 8: return ZSTD_hash8Ptr(p, hBits);
  ------------------
  |  Branch (972:5): [True: 0, False: 420k]
  ------------------
  973|   420k|    }
  974|   420k|}
zstd_lazy.c:ZSTD_hash4Ptr:
  934|   420k|static size_t ZSTD_hash4Ptr(const void* ptr, U32 h) { return ZSTD_hash4(MEM_readLE32(ptr), h, 0); }
zstd_lazy.c:ZSTD_hash4:
  933|   420k|static U32    ZSTD_hash4(U32 u, U32 h, U32 s) { assert(h <= 32); return ((u * prime4bytes) ^ s) >> (32-h) ; }
  ------------------
  |  |   70|   420k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
zstd_lazy.c:ZSTD_getLowestPrefixIndex:
 1442|  2.36k|{
 1443|  2.36k|    U32    const maxDistance = 1U << windowLog;
 1444|  2.36k|    U32    const lowestValid = ms->window.dictLimit;
 1445|  2.36k|    U32    const withinWindow = (curr - lowestValid > maxDistance) ? curr - maxDistance : lowestValid;
  ------------------
  |  Branch (1445:33): [True: 0, False: 2.36k]
  ------------------
 1446|  2.36k|    U32    const isDictionary = (ms->loadedDictEnd != 0);
 1447|       |    /* When computing the lowest prefix index we need to take the dictionary into account to handle
 1448|       |     * the edge case where the dictionary and the source are contiguous in memory.
 1449|       |     */
 1450|  2.36k|    U32    const matchLowest = isDictionary ? lowestValid : withinWindow;
  ------------------
  |  Branch (1450:32): [True: 0, False: 2.36k]
  ------------------
 1451|  2.36k|    return matchLowest;
 1452|  2.36k|}
zstd_lazy.c:ZSTD_count:
  884|   102k|{
  885|   102k|    const BYTE* const pStart = pIn;
  886|   102k|    const BYTE* const pInLoopLimit = pInLimit - (sizeof(size_t)-1);
  887|       |
  888|   102k|    if (pIn < pInLoopLimit) {
  ------------------
  |  Branch (888:9): [True: 101k, False: 743]
  ------------------
  889|   101k|        { size_t const diff = MEM_readST(pMatch) ^ MEM_readST(pIn);
  890|   101k|          if (diff) return ZSTD_NbCommonBytes(diff); }
  ------------------
  |  Branch (890:15): [True: 80.6k, False: 21.0k]
  ------------------
  891|  21.0k|        pIn+=sizeof(size_t); pMatch+=sizeof(size_t);
  892|  31.9k|        while (pIn < pInLoopLimit) {
  ------------------
  |  Branch (892:16): [True: 30.0k, False: 1.88k]
  ------------------
  893|  30.0k|            size_t const diff = MEM_readST(pMatch) ^ MEM_readST(pIn);
  894|  30.0k|            if (!diff) { pIn+=sizeof(size_t); pMatch+=sizeof(size_t); continue; }
  ------------------
  |  Branch (894:17): [True: 10.8k, False: 19.1k]
  ------------------
  895|  19.1k|            pIn += ZSTD_NbCommonBytes(diff);
  896|  19.1k|            return (size_t)(pIn - pStart);
  897|  30.0k|    }   }
  898|  2.62k|    if (MEM_64bits() && (pIn<(pInLimit-3)) && (MEM_read32(pMatch) == MEM_read32(pIn))) { pIn+=4; pMatch+=4; }
  ------------------
  |  Branch (898:9): [True: 2.62k, False: 0]
  |  Branch (898:25): [True: 1.35k, False: 1.27k]
  |  Branch (898:47): [True: 715, False: 635]
  ------------------
  899|  2.62k|    if ((pIn<(pInLimit-1)) && (MEM_read16(pMatch) == MEM_read16(pIn))) { pIn+=2; pMatch+=2; }
  ------------------
  |  Branch (899:9): [True: 1.59k, False: 1.03k]
  |  Branch (899:31): [True: 822, False: 773]
  ------------------
  900|  2.62k|    if ((pIn<pInLimit) && (*pMatch == *pIn)) pIn++;
  ------------------
  |  Branch (900:9): [True: 1.90k, False: 718]
  |  Branch (900:27): [True: 1.33k, False: 576]
  ------------------
  901|  2.62k|    return (size_t)(pIn - pStart);
  902|   102k|}
zstd_lazy.c:ZSTD_getLowestMatchIndex:
 1425|  30.7k|{
 1426|  30.7k|    U32 const maxDistance = 1U << windowLog;
 1427|  30.7k|    U32 const lowestValid = ms->window.lowLimit;
 1428|  30.7k|    U32 const withinWindow = (curr - lowestValid > maxDistance) ? curr - maxDistance : lowestValid;
  ------------------
  |  Branch (1428:30): [True: 0, False: 30.7k]
  ------------------
 1429|  30.7k|    U32 const isDictionary = (ms->loadedDictEnd != 0);
 1430|       |    /* When using a dictionary the entire dictionary is valid if a single byte of the dictionary
 1431|       |     * is within the window. We invalidate the dictionary (and set loadedDictEnd to 0) when it isn't
 1432|       |     * valid for the entire block. So this check is sufficient to find the lowest valid match index.
 1433|       |     */
 1434|  30.7k|    U32 const matchLowest = isDictionary ? lowestValid : withinWindow;
  ------------------
  |  Branch (1434:29): [True: 0, False: 30.7k]
  ------------------
 1435|  30.7k|    return matchLowest;
 1436|  30.7k|}
zstd_lazy.c:ZSTD_storeSeq:
  809|  9.48k|{
  810|  9.48k|    BYTE const* const litLimit_w = litLimit - WILDCOPY_OVERLENGTH;
  ------------------
  |  |  201|  9.48k|#define WILDCOPY_OVERLENGTH 32
  ------------------
  811|  9.48k|    BYTE const* const litEnd = literals + litLength;
  812|       |#if defined(DEBUGLEVEL) && (DEBUGLEVEL >= 6)
  813|       |    static const BYTE* g_start = NULL;
  814|       |    if (g_start==NULL) g_start = (const BYTE*)literals;  /* note : index only works for compression within a single segment */
  815|       |    {   U32 const pos = (U32)((const BYTE*)literals - g_start);
  816|       |        DEBUGLOG(6, "Cpos%7u :%3u literals, match%4u bytes at offBase%7u",
  817|       |               pos, (U32)litLength, (U32)matchLength, (U32)offBase);
  818|       |    }
  819|       |#endif
  820|  9.48k|    assert((size_t)(seqStorePtr->sequences - seqStorePtr->sequencesStart) < seqStorePtr->maxNbSeq);
  ------------------
  |  |   70|  9.48k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  821|       |    /* copy Literals */
  822|  9.48k|    assert(seqStorePtr->maxNbLit <= 128 KB);
  ------------------
  |  |   70|  9.48k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  823|  9.48k|    assert(seqStorePtr->lit + litLength <= seqStorePtr->litStart + seqStorePtr->maxNbLit);
  ------------------
  |  |   70|  9.48k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  824|  9.48k|    assert(literals + litLength <= litLimit);
  ------------------
  |  |   70|  9.48k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  825|  9.48k|    if (litEnd <= litLimit_w) {
  ------------------
  |  Branch (825:9): [True: 7.35k, False: 2.13k]
  ------------------
  826|       |        /* Common case we can use wildcopy.
  827|       |         * First copy 16 bytes, because literals are likely short.
  828|       |         */
  829|  7.35k|        ZSTD_STATIC_ASSERT(WILDCOPY_OVERLENGTH >= 16);
  ------------------
  |  |   43|  7.35k|#define ZSTD_STATIC_ASSERT(c) DEBUG_STATIC_ASSERT(c)
  |  |  ------------------
  |  |  |  |   39|  7.35k|#define DEBUG_STATIC_ASSERT(c) (void)sizeof(char[(c) ? 1 : -1])
  |  |  ------------------
  ------------------
  830|  7.35k|        ZSTD_copy16(seqStorePtr->lit, literals);
  831|  7.35k|        if (litLength > 16) {
  ------------------
  |  Branch (831:13): [True: 1.90k, False: 5.45k]
  ------------------
  832|  1.90k|            ZSTD_wildcopy(seqStorePtr->lit+16, literals+16, litLength-16, ZSTD_no_overlap);
  833|  1.90k|        }
  834|  7.35k|    } else {
  835|  2.13k|        ZSTD_safecopyLiterals(seqStorePtr->lit, literals, litEnd, litLimit_w);
  836|  2.13k|    }
  837|  9.48k|    seqStorePtr->lit += litLength;
  838|       |
  839|  9.48k|    ZSTD_storeSeqOnly(seqStorePtr, litLength, offBase, matchLength);
  840|  9.48k|}
zstd_lazy.c:ZSTD_safecopyLiterals:
  736|  2.13k|{
  737|  2.13k|    assert(iend > ilimit_w);
  ------------------
  |  |   70|  2.13k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  738|  2.13k|    if (ip <= ilimit_w) {
  ------------------
  |  Branch (738:9): [True: 886, False: 1.24k]
  ------------------
  739|    886|        ZSTD_wildcopy(op, ip, (size_t)(ilimit_w - ip), ZSTD_no_overlap);
  740|    886|        op += ilimit_w - ip;
  741|    886|        ip = ilimit_w;
  742|    886|    }
  743|  12.7k|    while (ip < iend) *op++ = *ip++;
  ------------------
  |  Branch (743:12): [True: 10.5k, False: 2.13k]
  ------------------
  744|  2.13k|}
zstd_lazy.c:ZSTD_storeSeqOnly:
  768|  9.48k|{
  769|  9.48k|    assert((size_t)(seqStorePtr->sequences - seqStorePtr->sequencesStart) < seqStorePtr->maxNbSeq);
  ------------------
  |  |   70|  9.48k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  770|       |
  771|       |    /* literal Length */
  772|  9.48k|    assert(litLength <= ZSTD_BLOCKSIZE_MAX);
  ------------------
  |  |   70|  9.48k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  773|  9.48k|    if (UNLIKELY(litLength>0xFFFF)) {
  ------------------
  |  |  196|  9.48k|#define UNLIKELY(x) (__builtin_expect((x), 0))
  |  |  ------------------
  |  |  |  Branch (196:21): [True: 0, False: 9.48k]
  |  |  ------------------
  ------------------
  774|      0|        assert(seqStorePtr->longLengthType == ZSTD_llt_none); /* there can only be a single long length */
  ------------------
  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  775|      0|        seqStorePtr->longLengthType = ZSTD_llt_literalLength;
  776|      0|        seqStorePtr->longLengthPos = (U32)(seqStorePtr->sequences - seqStorePtr->sequencesStart);
  777|      0|    }
  778|  9.48k|    seqStorePtr->sequences[0].litLength = (U16)litLength;
  779|       |
  780|       |    /* match offset */
  781|  9.48k|    seqStorePtr->sequences[0].offBase = offBase;
  782|       |
  783|       |    /* match Length */
  784|  9.48k|    assert(matchLength <= ZSTD_BLOCKSIZE_MAX);
  ------------------
  |  |   70|  9.48k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  785|  9.48k|    assert(matchLength >= MINMATCH);
  ------------------
  |  |   70|  9.48k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  786|  9.48k|    {   size_t const mlBase = matchLength - MINMATCH;
  ------------------
  |  |   98|  9.48k|#define MINMATCH 3
  ------------------
  787|  9.48k|        if (UNLIKELY(mlBase>0xFFFF)) {
  ------------------
  |  |  196|  9.48k|#define UNLIKELY(x) (__builtin_expect((x), 0))
  |  |  ------------------
  |  |  |  Branch (196:21): [True: 0, False: 9.48k]
  |  |  ------------------
  ------------------
  788|      0|            assert(seqStorePtr->longLengthType == ZSTD_llt_none); /* there can only be a single long length */
  ------------------
  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  789|      0|            seqStorePtr->longLengthType = ZSTD_llt_matchLength;
  790|      0|            seqStorePtr->longLengthPos = (U32)(seqStorePtr->sequences - seqStorePtr->sequencesStart);
  791|      0|        }
  792|  9.48k|        seqStorePtr->sequences[0].mlBase = (U16)mlBase;
  793|  9.48k|    }
  794|       |
  795|  9.48k|    seqStorePtr->sequences++;
  796|  9.48k|}
zstd_opt.c:ZSTD_hashPtr:
  960|   222k|{
  961|       |    /* Although some of these hashes do support hBits up to 64, some do not.
  962|       |     * To be on the safe side, always avoid hBits > 32. */
  963|   222k|    assert(hBits <= 32);
  ------------------
  |  |   70|   222k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  964|       |
  965|   222k|    switch(mls)
  966|   222k|    {
  967|   215k|    default:
  ------------------
  |  Branch (967:5): [True: 215k, False: 6.93k]
  ------------------
  968|   222k|    case 4: return ZSTD_hash4Ptr(p, hBits);
  ------------------
  |  Branch (968:5): [True: 6.93k, False: 215k]
  ------------------
  969|      0|    case 5: return ZSTD_hash5Ptr(p, hBits);
  ------------------
  |  Branch (969:5): [True: 0, False: 222k]
  ------------------
  970|      0|    case 6: return ZSTD_hash6Ptr(p, hBits);
  ------------------
  |  Branch (970:5): [True: 0, False: 222k]
  ------------------
  971|      0|    case 7: return ZSTD_hash7Ptr(p, hBits);
  ------------------
  |  Branch (971:5): [True: 0, False: 222k]
  ------------------
  972|      0|    case 8: return ZSTD_hash8Ptr(p, hBits);
  ------------------
  |  Branch (972:5): [True: 0, False: 222k]
  ------------------
  973|   222k|    }
  974|   222k|}
zstd_opt.c:ZSTD_hash4Ptr:
  934|   222k|static size_t ZSTD_hash4Ptr(const void* ptr, U32 h) { return ZSTD_hash4(MEM_readLE32(ptr), h, 0); }
zstd_opt.c:ZSTD_hash4:
  933|   222k|static U32    ZSTD_hash4(U32 u, U32 h, U32 s) { assert(h <= 32); return ((u * prime4bytes) ^ s) >> (32-h) ; }
  ------------------
  |  |   70|   222k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
zstd_opt.c:ZSTD_getLowestMatchIndex:
 1425|   222k|{
 1426|   222k|    U32 const maxDistance = 1U << windowLog;
 1427|   222k|    U32 const lowestValid = ms->window.lowLimit;
 1428|   222k|    U32 const withinWindow = (curr - lowestValid > maxDistance) ? curr - maxDistance : lowestValid;
  ------------------
  |  Branch (1428:30): [True: 0, False: 222k]
  ------------------
 1429|   222k|    U32 const isDictionary = (ms->loadedDictEnd != 0);
 1430|       |    /* When using a dictionary the entire dictionary is valid if a single byte of the dictionary
 1431|       |     * is within the window. We invalidate the dictionary (and set loadedDictEnd to 0) when it isn't
 1432|       |     * valid for the entire block. So this check is sufficient to find the lowest valid match index.
 1433|       |     */
 1434|   222k|    U32 const matchLowest = isDictionary ? lowestValid : withinWindow;
  ------------------
  |  Branch (1434:29): [True: 0, False: 222k]
  ------------------
 1435|   222k|    return matchLowest;
 1436|   222k|}
zstd_opt.c:ZSTD_count:
  884|   212k|{
  885|   212k|    const BYTE* const pStart = pIn;
  886|   212k|    const BYTE* const pInLoopLimit = pInLimit - (sizeof(size_t)-1);
  887|       |
  888|   212k|    if (pIn < pInLoopLimit) {
  ------------------
  |  Branch (888:9): [True: 210k, False: 1.20k]
  ------------------
  889|   210k|        { size_t const diff = MEM_readST(pMatch) ^ MEM_readST(pIn);
  890|   210k|          if (diff) return ZSTD_NbCommonBytes(diff); }
  ------------------
  |  Branch (890:15): [True: 172k, False: 38.6k]
  ------------------
  891|  38.6k|        pIn+=sizeof(size_t); pMatch+=sizeof(size_t);
  892|  60.4k|        while (pIn < pInLoopLimit) {
  ------------------
  |  Branch (892:16): [True: 58.0k, False: 2.35k]
  ------------------
  893|  58.0k|            size_t const diff = MEM_readST(pMatch) ^ MEM_readST(pIn);
  894|  58.0k|            if (!diff) { pIn+=sizeof(size_t); pMatch+=sizeof(size_t); continue; }
  ------------------
  |  Branch (894:17): [True: 21.7k, False: 36.3k]
  ------------------
  895|  36.3k|            pIn += ZSTD_NbCommonBytes(diff);
  896|  36.3k|            return (size_t)(pIn - pStart);
  897|  58.0k|    }   }
  898|  3.56k|    if (MEM_64bits() && (pIn<(pInLimit-3)) && (MEM_read32(pMatch) == MEM_read32(pIn))) { pIn+=4; pMatch+=4; }
  ------------------
  |  Branch (898:9): [True: 3.56k, False: 0]
  |  Branch (898:25): [True: 2.67k, False: 887]
  |  Branch (898:47): [True: 1.60k, False: 1.07k]
  ------------------
  899|  3.56k|    if ((pIn<(pInLimit-1)) && (MEM_read16(pMatch) == MEM_read16(pIn))) { pIn+=2; pMatch+=2; }
  ------------------
  |  Branch (899:9): [True: 2.82k, False: 736]
  |  Branch (899:31): [True: 1.55k, False: 1.26k]
  ------------------
  900|  3.56k|    if ((pIn<pInLimit) && (*pMatch == *pIn)) pIn++;
  ------------------
  |  Branch (900:9): [True: 3.04k, False: 514]
  |  Branch (900:27): [True: 1.38k, False: 1.66k]
  ------------------
  901|  3.56k|    return (size_t)(pIn - pStart);
  902|   212k|}
zstd_opt.c:ZSTD_hash3Ptr:
  929|   399k|MEM_STATIC size_t ZSTD_hash3Ptr(const void* ptr, U32 h) { return ZSTD_hash3(MEM_readLE32(ptr), h, 0); } /* only in zstd_opt.h */
zstd_opt.c:ZSTD_hash3:
  928|   399k|static U32    ZSTD_hash3(U32 u, U32 h, U32 s) { assert(h <= 32); return (((u << (32-24)) * prime3bytes) ^ s)  >> (32-h) ; }
  ------------------
  |  |   70|   399k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
zstd_opt.c:ZSTD_LLcode:
  614|   340k|{
  615|   340k|    static const BYTE LL_Code[64] = {  0,  1,  2,  3,  4,  5,  6,  7,
  616|   340k|                                       8,  9, 10, 11, 12, 13, 14, 15,
  617|   340k|                                      16, 16, 17, 17, 18, 18, 19, 19,
  618|   340k|                                      20, 20, 20, 20, 21, 21, 21, 21,
  619|   340k|                                      22, 22, 22, 22, 22, 22, 22, 22,
  620|   340k|                                      23, 23, 23, 23, 23, 23, 23, 23,
  621|   340k|                                      24, 24, 24, 24, 24, 24, 24, 24,
  622|   340k|                                      24, 24, 24, 24, 24, 24, 24, 24 };
  623|   340k|    static const U32 LL_deltaCode = 19;
  624|   340k|    return (litLength > 63) ? ZSTD_highbit32(litLength) + LL_deltaCode : LL_Code[litLength];
  ------------------
  |  Branch (624:12): [True: 32.3k, False: 307k]
  ------------------
  625|   340k|}
zstd_opt.c:ZSTD_MLcode:
  631|   296k|{
  632|   296k|    static const BYTE ML_Code[128] = { 0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14, 15,
  633|   296k|                                      16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
  634|   296k|                                      32, 32, 33, 33, 34, 34, 35, 35, 36, 36, 36, 36, 37, 37, 37, 37,
  635|   296k|                                      38, 38, 38, 38, 38, 38, 38, 38, 39, 39, 39, 39, 39, 39, 39, 39,
  636|   296k|                                      40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
  637|   296k|                                      41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41,
  638|   296k|                                      42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42,
  639|   296k|                                      42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42 };
  640|   296k|    static const U32 ML_deltaCode = 36;
  641|   296k|    return (mlBase > 127) ? ZSTD_highbit32(mlBase) + ML_deltaCode : ML_Code[mlBase];
  ------------------
  |  Branch (641:12): [True: 0, False: 296k]
  ------------------
  642|   296k|}
zstd_opt.c:ZSTD_newRep:
  872|  24.8k|{
  873|  24.8k|    Repcodes_t newReps;
  874|  24.8k|    ZSTD_memcpy(&newReps, rep, sizeof(newReps));
  ------------------
  |  |   44|  24.8k|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  ------------------
  875|  24.8k|    ZSTD_updateRep(newReps.rep, offBase, ll0);
  876|  24.8k|    return newReps;
  877|  24.8k|}
zstd_opt.c:ZSTD_updateRep:
  848|  24.8k|{
  849|  24.8k|    if (OFFBASE_IS_OFFSET(offBase)) {  /* full offset */
  ------------------
  |  |  752|  24.8k|#define OFFBASE_IS_OFFSET(o)  ((o) > ZSTD_REP_NUM)
  |  |  ------------------
  |  |  |  |   64|  24.8k|#define ZSTD_REP_NUM      3                 /* number of repcodes */
  |  |  ------------------
  |  |  |  Branch (752:31): [True: 8.97k, False: 15.8k]
  |  |  ------------------
  ------------------
  850|  8.97k|        rep[2] = rep[1];
  851|  8.97k|        rep[1] = rep[0];
  852|  8.97k|        rep[0] = OFFBASE_TO_OFFSET(offBase);
  ------------------
  |  |  754|  8.97k|#define OFFBASE_TO_OFFSET(o)  (assert(OFFBASE_IS_OFFSET(o)), (o) - ZSTD_REP_NUM)
  |  |  ------------------
  |  |  |  |   70|  8.97k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  |  |  ------------------
  |  |               #define OFFBASE_TO_OFFSET(o)  (assert(OFFBASE_IS_OFFSET(o)), (o) - ZSTD_REP_NUM)
  |  |  ------------------
  |  |  |  |   64|  8.97k|#define ZSTD_REP_NUM      3                 /* number of repcodes */
  |  |  ------------------
  ------------------
  853|  15.8k|    } else {   /* repcode */
  854|  15.8k|        U32 const repCode = OFFBASE_TO_REPCODE(offBase) - 1 + ll0;
  ------------------
  |  |  755|  15.8k|#define OFFBASE_TO_REPCODE(o) (assert(OFFBASE_IS_REPCODE(o)), (o))  /* returns ID 1,2,3 */
  |  |  ------------------
  |  |  |  |   70|  15.8k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  |  |  ------------------
  ------------------
  855|  15.8k|        if (repCode > 0) {  /* note : if repCode==0, no change */
  ------------------
  |  Branch (855:13): [True: 4.43k, False: 11.4k]
  ------------------
  856|  4.43k|            U32 const currentOffset = (repCode==ZSTD_REP_NUM) ? (rep[0] - 1) : rep[repCode];
  ------------------
  |  |   64|  4.43k|#define ZSTD_REP_NUM      3                 /* number of repcodes */
  ------------------
  |  Branch (856:39): [True: 78, False: 4.35k]
  ------------------
  857|  4.43k|            rep[2] = (repCode >= 2) ? rep[1] : rep[2];
  ------------------
  |  Branch (857:22): [True: 1.70k, False: 2.73k]
  ------------------
  858|  4.43k|            rep[1] = rep[0];
  859|  4.43k|            rep[0] = currentOffset;
  860|  11.4k|        } else {   /* repCode == 0 */
  861|       |            /* nothing to do */
  862|  11.4k|        }
  863|  15.8k|    }
  864|  24.8k|}
zstd_opt.c:ZSTD_storeSeq:
  809|  4.59k|{
  810|  4.59k|    BYTE const* const litLimit_w = litLimit - WILDCOPY_OVERLENGTH;
  ------------------
  |  |  201|  4.59k|#define WILDCOPY_OVERLENGTH 32
  ------------------
  811|  4.59k|    BYTE const* const litEnd = literals + litLength;
  812|       |#if defined(DEBUGLEVEL) && (DEBUGLEVEL >= 6)
  813|       |    static const BYTE* g_start = NULL;
  814|       |    if (g_start==NULL) g_start = (const BYTE*)literals;  /* note : index only works for compression within a single segment */
  815|       |    {   U32 const pos = (U32)((const BYTE*)literals - g_start);
  816|       |        DEBUGLOG(6, "Cpos%7u :%3u literals, match%4u bytes at offBase%7u",
  817|       |               pos, (U32)litLength, (U32)matchLength, (U32)offBase);
  818|       |    }
  819|       |#endif
  820|  4.59k|    assert((size_t)(seqStorePtr->sequences - seqStorePtr->sequencesStart) < seqStorePtr->maxNbSeq);
  ------------------
  |  |   70|  4.59k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  821|       |    /* copy Literals */
  822|  4.59k|    assert(seqStorePtr->maxNbLit <= 128 KB);
  ------------------
  |  |   70|  4.59k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  823|  4.59k|    assert(seqStorePtr->lit + litLength <= seqStorePtr->litStart + seqStorePtr->maxNbLit);
  ------------------
  |  |   70|  4.59k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  824|  4.59k|    assert(literals + litLength <= litLimit);
  ------------------
  |  |   70|  4.59k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  825|  4.59k|    if (litEnd <= litLimit_w) {
  ------------------
  |  Branch (825:9): [True: 3.53k, False: 1.05k]
  ------------------
  826|       |        /* Common case we can use wildcopy.
  827|       |         * First copy 16 bytes, because literals are likely short.
  828|       |         */
  829|  3.53k|        ZSTD_STATIC_ASSERT(WILDCOPY_OVERLENGTH >= 16);
  ------------------
  |  |   43|  3.53k|#define ZSTD_STATIC_ASSERT(c) DEBUG_STATIC_ASSERT(c)
  |  |  ------------------
  |  |  |  |   39|  3.53k|#define DEBUG_STATIC_ASSERT(c) (void)sizeof(char[(c) ? 1 : -1])
  |  |  ------------------
  ------------------
  830|  3.53k|        ZSTD_copy16(seqStorePtr->lit, literals);
  831|  3.53k|        if (litLength > 16) {
  ------------------
  |  Branch (831:13): [True: 962, False: 2.57k]
  ------------------
  832|    962|            ZSTD_wildcopy(seqStorePtr->lit+16, literals+16, litLength-16, ZSTD_no_overlap);
  833|    962|        }
  834|  3.53k|    } else {
  835|  1.05k|        ZSTD_safecopyLiterals(seqStorePtr->lit, literals, litEnd, litLimit_w);
  836|  1.05k|    }
  837|  4.59k|    seqStorePtr->lit += litLength;
  838|       |
  839|  4.59k|    ZSTD_storeSeqOnly(seqStorePtr, litLength, offBase, matchLength);
  840|  4.59k|}
zstd_opt.c:ZSTD_safecopyLiterals:
  736|  1.05k|{
  737|  1.05k|    assert(iend > ilimit_w);
  ------------------
  |  |   70|  1.05k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  738|  1.05k|    if (ip <= ilimit_w) {
  ------------------
  |  Branch (738:9): [True: 531, False: 528]
  ------------------
  739|    531|        ZSTD_wildcopy(op, ip, (size_t)(ilimit_w - ip), ZSTD_no_overlap);
  740|    531|        op += ilimit_w - ip;
  741|    531|        ip = ilimit_w;
  742|    531|    }
  743|  8.00k|    while (ip < iend) *op++ = *ip++;
  ------------------
  |  Branch (743:12): [True: 6.94k, False: 1.05k]
  ------------------
  744|  1.05k|}
zstd_opt.c:ZSTD_storeSeqOnly:
  768|  4.59k|{
  769|  4.59k|    assert((size_t)(seqStorePtr->sequences - seqStorePtr->sequencesStart) < seqStorePtr->maxNbSeq);
  ------------------
  |  |   70|  4.59k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  770|       |
  771|       |    /* literal Length */
  772|  4.59k|    assert(litLength <= ZSTD_BLOCKSIZE_MAX);
  ------------------
  |  |   70|  4.59k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  773|  4.59k|    if (UNLIKELY(litLength>0xFFFF)) {
  ------------------
  |  |  196|  4.59k|#define UNLIKELY(x) (__builtin_expect((x), 0))
  |  |  ------------------
  |  |  |  Branch (196:21): [True: 0, False: 4.59k]
  |  |  ------------------
  ------------------
  774|      0|        assert(seqStorePtr->longLengthType == ZSTD_llt_none); /* there can only be a single long length */
  ------------------
  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  775|      0|        seqStorePtr->longLengthType = ZSTD_llt_literalLength;
  776|      0|        seqStorePtr->longLengthPos = (U32)(seqStorePtr->sequences - seqStorePtr->sequencesStart);
  777|      0|    }
  778|  4.59k|    seqStorePtr->sequences[0].litLength = (U16)litLength;
  779|       |
  780|       |    /* match offset */
  781|  4.59k|    seqStorePtr->sequences[0].offBase = offBase;
  782|       |
  783|       |    /* match Length */
  784|  4.59k|    assert(matchLength <= ZSTD_BLOCKSIZE_MAX);
  ------------------
  |  |   70|  4.59k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  785|  4.59k|    assert(matchLength >= MINMATCH);
  ------------------
  |  |   70|  4.59k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  786|  4.59k|    {   size_t const mlBase = matchLength - MINMATCH;
  ------------------
  |  |   98|  4.59k|#define MINMATCH 3
  ------------------
  787|  4.59k|        if (UNLIKELY(mlBase>0xFFFF)) {
  ------------------
  |  |  196|  4.59k|#define UNLIKELY(x) (__builtin_expect((x), 0))
  |  |  ------------------
  |  |  |  Branch (196:21): [True: 0, False: 4.59k]
  |  |  ------------------
  ------------------
  788|      0|            assert(seqStorePtr->longLengthType == ZSTD_llt_none); /* there can only be a single long length */
  ------------------
  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  789|      0|            seqStorePtr->longLengthType = ZSTD_llt_matchLength;
  790|      0|            seqStorePtr->longLengthPos = (U32)(seqStorePtr->sequences - seqStorePtr->sequencesStart);
  791|      0|        }
  792|  4.59k|        seqStorePtr->sequences[0].mlBase = (U16)mlBase;
  793|  4.59k|    }
  794|       |
  795|  4.59k|    seqStorePtr->sequences++;
  796|  4.59k|}

ZSTD_noCompressLiterals:
   40|  2.50k|{
   41|  2.50k|    BYTE* const ostart = (BYTE*)dst;
   42|  2.50k|    U32   const flSize = 1 + (srcSize>31) + (srcSize>4095);
   43|       |
   44|  2.50k|    DEBUGLOG(5, "ZSTD_noCompressLiterals: srcSize=%zu, dstCapacity=%zu", srcSize, dstCapacity);
  ------------------
  |  |  104|  2.50k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 2.50k]
  |  |  ------------------
  ------------------
   45|       |
   46|  2.50k|    RETURN_ERROR_IF(srcSize + flSize > dstCapacity, dstSize_tooSmall, "");
  ------------------
  |  |  114|  2.50k|    do {                                                                       \
  |  |  115|  2.50k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 961, False: 1.54k]
  |  |  ------------------
  |  |  116|    961|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|    961|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 961]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|    961|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|    961|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|    961|    do {                                           \
  |  |  |  |   99|    961|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 961]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|    961|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 961]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|    961|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|    961|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 961]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|    961|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|    961|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 961]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|    961|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|    961|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|    961|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|    961|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|    961|        }                                                                      \
  |  |  123|  2.50k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 1.54k]
  |  |  ------------------
  ------------------
   47|       |
   48|  1.54k|    switch(flSize)
   49|  1.54k|    {
   50|    878|        case 1: /* 2 - 1 - 5 */
  ------------------
  |  Branch (50:9): [True: 878, False: 669]
  ------------------
   51|    878|            ostart[0] = (BYTE)((U32)set_basic + (srcSize<<3));
   52|    878|            break;
   53|    669|        case 2: /* 2 - 2 - 12 */
  ------------------
  |  Branch (53:9): [True: 669, False: 878]
  ------------------
   54|    669|            MEM_writeLE16(ostart, (U16)((U32)set_basic + (1<<2) + (srcSize<<4)));
   55|    669|            break;
   56|      0|        case 3: /* 2 - 2 - 20 */
  ------------------
  |  Branch (56:9): [True: 0, False: 1.54k]
  ------------------
   57|      0|            MEM_writeLE32(ostart, (U32)((U32)set_basic + (3<<2) + (srcSize<<4)));
   58|      0|            break;
   59|      0|        default:   /* not necessary : flSize is {1,2,3} */
  ------------------
  |  Branch (59:9): [True: 0, False: 1.54k]
  ------------------
   60|      0|            assert(0);
  ------------------
  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
   61|  1.54k|    }
   62|       |
   63|  1.54k|    ZSTD_memcpy(ostart + flSize, src, srcSize);
  ------------------
  |  |   44|  1.54k|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  ------------------
   64|  1.54k|    DEBUGLOG(5, "Raw (uncompressed) literals: %u -> %u", (U32)srcSize, (U32)(srcSize + flSize));
  ------------------
  |  |  104|  1.54k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 1.54k]
  |  |  ------------------
  ------------------
   65|  1.54k|    return srcSize + flSize;
   66|  1.54k|}
ZSTD_compressLiterals:
  139|  4.35k|{
  140|  4.35k|    size_t const lhSize = 3 + (srcSize >= 1 KB) + (srcSize >= 16 KB);
  ------------------
  |  |   67|  4.35k|#define KB *(1 <<10)
  ------------------
                  size_t const lhSize = 3 + (srcSize >= 1 KB) + (srcSize >= 16 KB);
  ------------------
  |  |   67|  4.35k|#define KB *(1 <<10)
  ------------------
  141|  4.35k|    BYTE*  const ostart = (BYTE*)dst;
  142|  4.35k|    U32 singleStream = srcSize < 256;
  143|  4.35k|    SymbolEncodingType_e hType = set_compressed;
  144|  4.35k|    size_t cLitSize;
  145|       |
  146|  4.35k|    DEBUGLOG(5,"ZSTD_compressLiterals (disableLiteralCompression=%i, srcSize=%u, dstCapacity=%zu)",
  ------------------
  |  |  104|  4.35k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 4.35k]
  |  |  ------------------
  ------------------
  147|  4.35k|                disableLiteralCompression, (U32)srcSize, dstCapacity);
  148|       |
  149|  4.35k|    DEBUGLOG(6, "Completed literals listing (%zu bytes)", showHexa(src, srcSize));
  ------------------
  |  |  104|  4.35k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 4.35k]
  |  |  ------------------
  ------------------
  150|       |
  151|       |    /* Prepare nextEntropy assuming reusing the existing table */
  152|  4.35k|    ZSTD_memcpy(nextHuf, prevHuf, sizeof(*prevHuf));
  ------------------
  |  |   44|  4.35k|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  ------------------
  153|       |
  154|  4.35k|    if (disableLiteralCompression)
  ------------------
  |  Branch (154:9): [True: 0, False: 4.35k]
  ------------------
  155|      0|        return ZSTD_noCompressLiterals(dst, dstCapacity, src, srcSize);
  156|       |
  157|       |    /* if too small, don't even attempt compression (speed opt) */
  158|  4.35k|    if (srcSize < ZSTD_minLiteralsToCompress(strategy, prevHuf->repeatMode))
  ------------------
  |  Branch (158:9): [True: 1.21k, False: 3.13k]
  ------------------
  159|  1.21k|        return ZSTD_noCompressLiterals(dst, dstCapacity, src, srcSize);
  160|       |
  161|  3.13k|    RETURN_ERROR_IF(dstCapacity < lhSize+1, dstSize_tooSmall, "not enough space for compression");
  ------------------
  |  |  114|  3.13k|    do {                                                                       \
  |  |  115|  3.13k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 0, False: 3.13k]
  |  |  ------------------
  |  |  116|      0|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|      0|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|      0|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|      0|    do {                                           \
  |  |  |  |   99|      0|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|      0|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|      0|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|      0|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|      0|        }                                                                      \
  |  |  123|  3.13k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 3.13k]
  |  |  ------------------
  ------------------
  162|  3.13k|    {   HUF_repeat repeat = prevHuf->repeatMode;
  163|  3.13k|        int const flags = 0
  164|  3.13k|            | (bmi2 ? HUF_flags_bmi2 : 0)
  ------------------
  |  Branch (164:16): [True: 3.13k, False: 0]
  ------------------
  165|  3.13k|            | (strategy < ZSTD_lazy && srcSize <= 1024 ? HUF_flags_preferRepeat : 0)
  ------------------
  |  Branch (165:16): [True: 192, False: 2.94k]
  |  Branch (165:40): [True: 192, False: 0]
  ------------------
  166|  3.13k|            | (strategy >= HUF_OPTIMAL_DEPTH_THRESHOLD ? HUF_flags_optimalDepth : 0)
  ------------------
  |  |  117|  3.13k|#define HUF_OPTIMAL_DEPTH_THRESHOLD ZSTD_btultra
  ------------------
  |  Branch (166:16): [True: 1.37k, False: 1.76k]
  ------------------
  167|  3.13k|            | (suspectUncompressible ? HUF_flags_suspectUncompressible : 0);
  ------------------
  |  Branch (167:16): [True: 2.55k, False: 584]
  ------------------
  168|       |
  169|  3.13k|        typedef size_t (*huf_compress_f)(void*, size_t, const void*, size_t, unsigned, unsigned, void*, size_t, HUF_CElt*, HUF_repeat*, int);
  170|  3.13k|        huf_compress_f huf_compress;
  171|  3.13k|        if (repeat == HUF_repeat_valid && lhSize == 3) singleStream = 1;
  ------------------
  |  Branch (171:13): [True: 0, False: 3.13k]
  |  Branch (171:43): [True: 0, False: 0]
  ------------------
  172|  3.13k|        huf_compress = singleStream ? HUF_compress1X_repeat : HUF_compress4X_repeat;
  ------------------
  |  Branch (172:24): [True: 3.13k, False: 0]
  ------------------
  173|  3.13k|        cLitSize = huf_compress(ostart+lhSize, dstCapacity-lhSize,
  174|  3.13k|                                src, srcSize,
  175|  3.13k|                                HUF_SYMBOLVALUE_MAX, LitHufLog,
  ------------------
  |  |   39|  3.13k|#define HUF_SYMBOLVALUE_MAX  255
  ------------------
                                              HUF_SYMBOLVALUE_MAX, LitHufLog,
  ------------------
  |  |  101|  3.13k|#define LitHufLog 11
  ------------------
  176|  3.13k|                                entropyWorkspace, entropyWorkspaceSize,
  177|  3.13k|                                (HUF_CElt*)nextHuf->CTable,
  178|  3.13k|                                &repeat, flags);
  179|  3.13k|        DEBUGLOG(5, "%zu literals compressed into %zu bytes (before header)", srcSize, cLitSize);
  ------------------
  |  |  104|  3.13k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 3.13k]
  |  |  ------------------
  ------------------
  180|  3.13k|        if (repeat != HUF_repeat_none) {
  ------------------
  |  Branch (180:13): [True: 0, False: 3.13k]
  ------------------
  181|       |            /* reused the existing table */
  182|      0|            DEBUGLOG(5, "reusing statistics from previous huffman block");
  ------------------
  |  |  104|      0|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 0]
  |  |  ------------------
  ------------------
  183|      0|            hType = set_repeat;
  184|      0|        }
  185|  3.13k|    }
  186|       |
  187|  3.13k|    {   size_t const minGain = ZSTD_minGain(srcSize, strategy);
  188|  3.13k|        if ((cLitSize==0) || (cLitSize >= srcSize - minGain) || ERR_isError(cLitSize)) {
  ------------------
  |  Branch (188:13): [True: 1.25k, False: 1.88k]
  |  Branch (188:30): [True: 37, False: 1.84k]
  |  Branch (188:65): [True: 0, False: 1.84k]
  ------------------
  189|  1.29k|            ZSTD_memcpy(nextHuf, prevHuf, sizeof(*prevHuf));
  ------------------
  |  |   44|  1.29k|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  ------------------
  190|  1.29k|            return ZSTD_noCompressLiterals(dst, dstCapacity, src, srcSize);
  191|  1.29k|    }   }
  192|  1.84k|    if (cLitSize==1) {
  ------------------
  |  Branch (192:9): [True: 0, False: 1.84k]
  ------------------
  193|       |        /* A return value of 1 signals that the alphabet consists of a single symbol.
  194|       |         * However, in some rare circumstances, it could be the compressed size (a single byte).
  195|       |         * For that outcome to have a chance to happen, it's necessary that `srcSize < 8`.
  196|       |         * (it's also necessary to not generate statistics).
  197|       |         * Therefore, in such a case, actively check that all bytes are identical. */
  198|      0|        if ((srcSize >= 8) || allBytesIdentical(src, srcSize)) {
  ------------------
  |  Branch (198:13): [True: 0, False: 0]
  |  Branch (198:31): [True: 0, False: 0]
  ------------------
  199|      0|            ZSTD_memcpy(nextHuf, prevHuf, sizeof(*prevHuf));
  ------------------
  |  |   44|      0|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  ------------------
  200|      0|            return ZSTD_compressRleLiteralsBlock(dst, dstCapacity, src, srcSize);
  201|      0|    }   }
  202|       |
  203|  1.84k|    if (hType == set_compressed) {
  ------------------
  |  Branch (203:9): [True: 1.84k, False: 0]
  ------------------
  204|       |        /* using a newly constructed table */
  205|  1.84k|        nextHuf->repeatMode = HUF_repeat_check;
  206|  1.84k|    }
  207|       |
  208|       |    /* Build header */
  209|  1.84k|    switch(lhSize)
  210|  1.84k|    {
  211|  1.84k|    case 3: /* 2 - 2 - 10 - 10 */
  ------------------
  |  Branch (211:5): [True: 1.84k, False: 0]
  ------------------
  212|  1.84k|        if (!singleStream) assert(srcSize >= MIN_LITERALS_FOR_4_STREAMS);
  ------------------
  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  |  Branch (212:13): [True: 0, False: 1.84k]
  ------------------
  213|  1.84k|        {   U32 const lhc = hType + ((U32)(!singleStream) << 2) + ((U32)srcSize<<4) + ((U32)cLitSize<<14);
  214|  1.84k|            MEM_writeLE24(ostart, lhc);
  215|  1.84k|            break;
  216|      0|        }
  217|      0|    case 4: /* 2 - 2 - 14 - 14 */
  ------------------
  |  Branch (217:5): [True: 0, False: 1.84k]
  ------------------
  218|      0|        assert(srcSize >= MIN_LITERALS_FOR_4_STREAMS);
  ------------------
  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  219|      0|        {   U32 const lhc = hType + (2 << 2) + ((U32)srcSize<<4) + ((U32)cLitSize<<18);
  220|      0|            MEM_writeLE32(ostart, lhc);
  221|      0|            break;
  222|      0|        }
  223|      0|    case 5: /* 2 - 2 - 18 - 18 */
  ------------------
  |  Branch (223:5): [True: 0, False: 1.84k]
  ------------------
  224|      0|        assert(srcSize >= MIN_LITERALS_FOR_4_STREAMS);
  ------------------
  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  225|      0|        {   U32 const lhc = hType + (3 << 2) + ((U32)srcSize<<4) + ((U32)cLitSize<<22);
  226|      0|            MEM_writeLE32(ostart, lhc);
  227|      0|            ostart[4] = (BYTE)(cLitSize >> 10);
  228|      0|            break;
  229|      0|        }
  230|      0|    default:  /* not possible : lhSize is {3,4,5} */
  ------------------
  |  Branch (230:5): [True: 0, False: 1.84k]
  ------------------
  231|      0|        assert(0);
  ------------------
  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  232|  1.84k|    }
  233|  1.84k|    DEBUGLOG(5, "Compressed literals: %u -> %u", (U32)srcSize, (U32)(lhSize+cLitSize));
  ------------------
  |  |  104|  1.84k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 1.84k]
  |  |  ------------------
  ------------------
  234|  1.84k|    return lhSize+cLitSize;
  235|  1.84k|}
zstd_compress_literals.c:ZSTD_minLiteralsToCompress:
  116|  4.35k|{
  117|  4.35k|    assert((int)strategy >= 0);
  ------------------
  |  |   70|  4.35k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  118|  4.35k|    assert((int)strategy <= 9);
  ------------------
  |  |   70|  4.35k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  119|       |    /* btultra2 : min 8 bytes;
  120|       |     * then 2x larger for each successive compression strategy
  121|       |     * max threshold 64 bytes */
  122|  4.35k|    {   int const shift = MIN(9-(int)strategy, 3);
  ------------------
  |  |   54|  4.35k|#define MIN(a,b) ((a)<(b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (54:19): [True: 1.79k, False: 2.55k]
  |  |  ------------------
  ------------------
  123|  4.35k|        size_t const mintc = (huf_repeat == HUF_repeat_valid) ? 6 : (size_t)8 << shift;
  ------------------
  |  Branch (123:30): [True: 0, False: 4.35k]
  ------------------
  124|  4.35k|        DEBUGLOG(7, "minLiteralsToCompress = %zu", mintc);
  ------------------
  |  |  104|  4.35k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 4.35k]
  |  |  ------------------
  ------------------
  125|  4.35k|        return mintc;
  126|  4.35k|    }
  127|  4.35k|}

ZSTD_crossEntropyCost:
  142|  6.68k|{
  143|  6.68k|    unsigned const shift = 8 - accuracyLog;
  144|  6.68k|    size_t cost = 0;
  145|  6.68k|    unsigned s;
  146|  6.68k|    assert(accuracyLog <= 8);
  ------------------
  |  |   70|  6.68k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  147|  98.9k|    for (s = 0; s <= max; ++s) {
  ------------------
  |  Branch (147:17): [True: 92.3k, False: 6.68k]
  ------------------
  148|  92.3k|        unsigned const normAcc = (norm[s] != -1) ? (unsigned)norm[s] : 1;
  ------------------
  |  Branch (148:34): [True: 92.3k, False: 0]
  ------------------
  149|  92.3k|        unsigned const norm256 = normAcc << shift;
  150|  92.3k|        assert(norm256 > 0);
  ------------------
  |  |   70|  92.3k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  151|  92.3k|        assert(norm256 < 256);
  ------------------
  |  |   70|  92.3k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  152|  92.3k|        cost += count[s] * kInverseProbabilityLog256[norm256];
  153|  92.3k|    }
  154|  6.68k|    return cost >> 8;
  155|  6.68k|}
ZSTD_selectEncodingType:
  165|  8.44k|{
  166|  8.44k|    ZSTD_STATIC_ASSERT(ZSTD_defaultDisallowed == 0 && ZSTD_defaultAllowed != 0);
  ------------------
  |  |   43|  8.44k|#define ZSTD_STATIC_ASSERT(c) DEBUG_STATIC_ASSERT(c)
  |  |  ------------------
  |  |  |  |   39|  8.44k|#define DEBUG_STATIC_ASSERT(c) (void)sizeof(char[(c) ? 1 : -1])
  |  |  ------------------
  ------------------
  167|  8.44k|    if (mostFrequent == nbSeq) {
  ------------------
  |  Branch (167:9): [True: 1.54k, False: 6.89k]
  ------------------
  168|  1.54k|        *repeatMode = FSE_repeat_none;
  169|  1.54k|        if (isDefaultAllowed && nbSeq <= 2) {
  ------------------
  |  Branch (169:13): [True: 1.54k, False: 0]
  |  Branch (169:33): [True: 1.29k, False: 257]
  ------------------
  170|       |            /* Prefer set_basic over set_rle when there are 2 or fewer symbols,
  171|       |             * since RLE uses 1 byte, but set_basic uses 5-6 bits per symbol.
  172|       |             * If basic encoding isn't possible, always choose RLE.
  173|       |             */
  174|  1.29k|            DEBUGLOG(5, "Selected set_basic");
  ------------------
  |  |  104|  1.29k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 1.29k]
  |  |  ------------------
  ------------------
  175|  1.29k|            return set_basic;
  176|  1.29k|        }
  177|    257|        DEBUGLOG(5, "Selected set_rle");
  ------------------
  |  |  104|    257|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 257]
  |  |  ------------------
  ------------------
  178|    257|        return set_rle;
  179|  1.54k|    }
  180|  6.89k|    if (strategy < ZSTD_lazy) {
  ------------------
  |  Branch (180:9): [True: 215, False: 6.68k]
  ------------------
  181|    215|        if (isDefaultAllowed) {
  ------------------
  |  Branch (181:13): [True: 215, False: 0]
  ------------------
  182|    215|            size_t const staticFse_nbSeq_max = 1000;
  183|    215|            size_t const mult = 10 - strategy;
  184|    215|            size_t const baseLog = 3;
  185|    215|            size_t const dynamicFse_nbSeq_min = (((size_t)1 << defaultNormLog) * mult) >> baseLog;  /* 28-36 for offset, 56-72 for lengths */
  186|    215|            assert(defaultNormLog >= 5 && defaultNormLog <= 6);  /* xx_DEFAULTNORMLOG */
  ------------------
  |  |   70|    215|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  187|    215|            assert(mult <= 9 && mult >= 7);
  ------------------
  |  |   70|    215|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  188|    215|            if ( (*repeatMode == FSE_repeat_valid)
  ------------------
  |  Branch (188:18): [True: 0, False: 215]
  ------------------
  189|      0|              && (nbSeq < staticFse_nbSeq_max) ) {
  ------------------
  |  Branch (189:18): [True: 0, False: 0]
  ------------------
  190|      0|                DEBUGLOG(5, "Selected set_repeat");
  ------------------
  |  |  104|      0|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 0]
  |  |  ------------------
  ------------------
  191|      0|                return set_repeat;
  192|      0|            }
  193|    215|            if ( (nbSeq < dynamicFse_nbSeq_min)
  ------------------
  |  Branch (193:18): [True: 215, False: 0]
  ------------------
  194|    215|              || (mostFrequent < (nbSeq >> (defaultNormLog-1))) ) {
  ------------------
  |  Branch (194:18): [True: 0, False: 0]
  ------------------
  195|    215|                DEBUGLOG(5, "Selected set_basic");
  ------------------
  |  |  104|    215|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 215]
  |  |  ------------------
  ------------------
  196|       |                /* The format allows default tables to be repeated, but it isn't useful.
  197|       |                 * When using simple heuristics to select encoding type, we don't want
  198|       |                 * to confuse these tables with dictionaries. When running more careful
  199|       |                 * analysis, we don't need to waste time checking both repeating tables
  200|       |                 * and default tables.
  201|       |                 */
  202|    215|                *repeatMode = FSE_repeat_none;
  203|    215|                return set_basic;
  204|    215|            }
  205|    215|        }
  206|  6.68k|    } else {
  207|  6.68k|        size_t const basicCost = isDefaultAllowed ? ZSTD_crossEntropyCost(defaultNorm, defaultNormLog, count, max) : ERROR(GENERIC);
  ------------------
  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (207:34): [True: 6.68k, False: 0]
  ------------------
  208|  6.68k|        size_t const repeatCost = *repeatMode != FSE_repeat_none ? ZSTD_fseBitCost(prevCTable, count, max) : ERROR(GENERIC);
  ------------------
  |  |   49|  6.68k|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|  6.68k|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|  6.68k|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (208:35): [True: 0, False: 6.68k]
  ------------------
  209|  6.68k|        size_t const NCountCost = ZSTD_NCountCost(count, max, nbSeq, FSELog);
  210|  6.68k|        size_t const compressedCost = (NCountCost << 3) + ZSTD_entropyCost(count, max, nbSeq);
  211|       |
  212|  6.68k|        if (isDefaultAllowed) {
  ------------------
  |  Branch (212:13): [True: 6.68k, False: 0]
  ------------------
  213|  6.68k|            assert(!ZSTD_isError(basicCost));
  ------------------
  |  |   70|  6.68k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  214|  6.68k|            assert(!(*repeatMode == FSE_repeat_valid && ZSTD_isError(repeatCost)));
  ------------------
  |  |   70|  6.68k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  215|  6.68k|        }
  216|  6.68k|        assert(!ZSTD_isError(NCountCost));
  ------------------
  |  |   70|  6.68k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  217|  6.68k|        assert(compressedCost < ERROR(maxCode));
  ------------------
  |  |   70|  6.68k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  218|  6.68k|        DEBUGLOG(5, "Estimated bit costs: basic=%u\trepeat=%u\tcompressed=%u",
  ------------------
  |  |  104|  6.68k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 6.68k]
  |  |  ------------------
  ------------------
  219|  6.68k|                    (unsigned)basicCost, (unsigned)repeatCost, (unsigned)compressedCost);
  220|  6.68k|        if (basicCost <= repeatCost && basicCost <= compressedCost) {
  ------------------
  |  Branch (220:13): [True: 6.68k, False: 0]
  |  Branch (220:40): [True: 6.09k, False: 589]
  ------------------
  221|  6.09k|            DEBUGLOG(5, "Selected set_basic");
  ------------------
  |  |  104|  6.09k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 6.09k]
  |  |  ------------------
  ------------------
  222|  6.09k|            assert(isDefaultAllowed);
  ------------------
  |  |   70|  6.09k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  223|  6.09k|            *repeatMode = FSE_repeat_none;
  224|  6.09k|            return set_basic;
  225|  6.09k|        }
  226|    589|        if (repeatCost <= compressedCost) {
  ------------------
  |  Branch (226:13): [True: 0, False: 589]
  ------------------
  227|      0|            DEBUGLOG(5, "Selected set_repeat");
  ------------------
  |  |  104|      0|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 0]
  |  |  ------------------
  ------------------
  228|      0|            assert(!ZSTD_isError(repeatCost));
  ------------------
  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  229|      0|            return set_repeat;
  230|      0|        }
  231|    589|        assert(compressedCost < basicCost && compressedCost < repeatCost);
  ------------------
  |  |   70|    589|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  232|    589|    }
  233|    589|    DEBUGLOG(5, "Selected set_compressed");
  ------------------
  |  |  104|    589|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 589]
  |  |  ------------------
  ------------------
  234|    589|    *repeatMode = FSE_repeat_check;
  235|    589|    return set_compressed;
  236|  6.89k|}
ZSTD_buildCTable:
  251|  8.44k|{
  252|  8.44k|    BYTE* op = (BYTE*)dst;
  253|  8.44k|    const BYTE* const oend = op + dstCapacity;
  254|  8.44k|    DEBUGLOG(6, "ZSTD_buildCTable (dstCapacity=%u)", (unsigned)dstCapacity);
  ------------------
  |  |  104|  8.44k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 8.44k]
  |  |  ------------------
  ------------------
  255|       |
  256|  8.44k|    switch (type) {
  257|    257|    case set_rle:
  ------------------
  |  Branch (257:5): [True: 257, False: 8.18k]
  ------------------
  258|    257|        FORWARD_IF_ERROR(FSE_buildCTable_rle(nextCTable, (BYTE)max), "");
  ------------------
  |  |  146|    257|    do {                                                                           \
  |  |  147|    257|        size_t const err_code = (err);                                             \
  |  |  148|    257|        if (ERR_isError(err_code)) {                                               \
  |  |  ------------------
  |  |  |  Branch (148:13): [True: 0, False: 257]
  |  |  ------------------
  |  |  149|      0|            RAWLOG(3, "%s:%d: ERROR!: forwarding error in %s: %s",                 \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  150|      0|                  __FILE__, __LINE__, ERR_QUOTE(err), ERR_getErrorName(err_code)); \
  |  |  151|      0|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                                 \
  |  |  ------------------
  |  |  |  |   98|      0|    do {                                           \
  |  |  |  |   99|      0|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  152|      0|            RAWLOG(3, ": " __VA_ARGS__);                                           \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  153|      0|            RAWLOG(3, "\n");                                                       \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  154|      0|            return err_code;                                                       \
  |  |  155|      0|        }                                                                          \
  |  |  156|    257|    } while(0)
  |  |  ------------------
  |  |  |  Branch (156:13): [Folded, False: 257]
  |  |  ------------------
  ------------------
  259|    257|        RETURN_ERROR_IF(dstCapacity==0, dstSize_tooSmall, "not enough space");
  ------------------
  |  |  114|    257|    do {                                                                       \
  |  |  115|    257|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 0, False: 257]
  |  |  ------------------
  |  |  116|      0|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|      0|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|      0|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|      0|    do {                                           \
  |  |  |  |   99|      0|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|      0|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|      0|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|      0|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|      0|        }                                                                      \
  |  |  123|    257|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 257]
  |  |  ------------------
  ------------------
  260|    257|        *op = codeTable[0];
  261|    257|        return 1;
  262|      0|    case set_repeat:
  ------------------
  |  Branch (262:5): [True: 0, False: 8.44k]
  ------------------
  263|      0|        ZSTD_memcpy(nextCTable, prevCTable, prevCTableSize);
  ------------------
  |  |   44|      0|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  ------------------
  264|      0|        return 0;
  265|  7.59k|    case set_basic:
  ------------------
  |  Branch (265:5): [True: 7.59k, False: 846]
  ------------------
  266|  7.59k|        FORWARD_IF_ERROR(FSE_buildCTable_wksp(nextCTable, defaultNorm, defaultMax, defaultNormLog, entropyWorkspace, entropyWorkspaceSize), "");  /* note : could be pre-calculated */
  ------------------
  |  |  146|  7.59k|    do {                                                                           \
  |  |  147|  7.59k|        size_t const err_code = (err);                                             \
  |  |  148|  7.59k|        if (ERR_isError(err_code)) {                                               \
  |  |  ------------------
  |  |  |  Branch (148:13): [True: 0, False: 7.59k]
  |  |  ------------------
  |  |  149|      0|            RAWLOG(3, "%s:%d: ERROR!: forwarding error in %s: %s",                 \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  150|      0|                  __FILE__, __LINE__, ERR_QUOTE(err), ERR_getErrorName(err_code)); \
  |  |  151|      0|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                                 \
  |  |  ------------------
  |  |  |  |   98|      0|    do {                                           \
  |  |  |  |   99|      0|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  152|      0|            RAWLOG(3, ": " __VA_ARGS__);                                           \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  153|      0|            RAWLOG(3, "\n");                                                       \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  154|      0|            return err_code;                                                       \
  |  |  155|      0|        }                                                                          \
  |  |  156|  7.59k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (156:13): [Folded, False: 7.59k]
  |  |  ------------------
  ------------------
  267|  7.59k|        return 0;
  268|    589|    case set_compressed: {
  ------------------
  |  Branch (268:5): [True: 589, False: 7.85k]
  ------------------
  269|    589|        ZSTD_BuildCTableWksp* wksp = (ZSTD_BuildCTableWksp*)entropyWorkspace;
  270|    589|        size_t nbSeq_1 = nbSeq;
  271|    589|        const U32 tableLog = FSE_optimalTableLog(FSELog, nbSeq, max);
  272|    589|        if (count[codeTable[nbSeq-1]] > 1) {
  ------------------
  |  Branch (272:13): [True: 402, False: 187]
  ------------------
  273|    402|            count[codeTable[nbSeq-1]]--;
  274|    402|            nbSeq_1--;
  275|    402|        }
  276|    589|        assert(nbSeq_1 > 1);
  ------------------
  |  |   70|    589|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  277|    589|        assert(entropyWorkspaceSize >= sizeof(ZSTD_BuildCTableWksp));
  ------------------
  |  |   70|    589|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  278|    589|        (void)entropyWorkspaceSize;
  279|    589|        FORWARD_IF_ERROR(FSE_normalizeCount(wksp->norm, tableLog, count, nbSeq_1, max, ZSTD_useLowProbCount(nbSeq_1)), "FSE_normalizeCount failed");
  ------------------
  |  |  146|    589|    do {                                                                           \
  |  |  147|    589|        size_t const err_code = (err);                                             \
  |  |  148|    589|        if (ERR_isError(err_code)) {                                               \
  |  |  ------------------
  |  |  |  Branch (148:13): [True: 0, False: 589]
  |  |  ------------------
  |  |  149|      0|            RAWLOG(3, "%s:%d: ERROR!: forwarding error in %s: %s",                 \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  150|      0|                  __FILE__, __LINE__, ERR_QUOTE(err), ERR_getErrorName(err_code)); \
  |  |  151|      0|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                                 \
  |  |  ------------------
  |  |  |  |   98|      0|    do {                                           \
  |  |  |  |   99|      0|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  152|      0|            RAWLOG(3, ": " __VA_ARGS__);                                           \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  153|      0|            RAWLOG(3, "\n");                                                       \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  154|      0|            return err_code;                                                       \
  |  |  155|      0|        }                                                                          \
  |  |  156|    589|    } while(0)
  |  |  ------------------
  |  |  |  Branch (156:13): [Folded, False: 589]
  |  |  ------------------
  ------------------
  280|    589|        assert(oend >= op);
  ------------------
  |  |   70|    589|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  281|    589|        {   size_t const NCountSize = FSE_writeNCount(op, (size_t)(oend - op), wksp->norm, max, tableLog);   /* overflow protected */
  282|    589|            FORWARD_IF_ERROR(NCountSize, "FSE_writeNCount failed");
  ------------------
  |  |  146|    589|    do {                                                                           \
  |  |  147|    589|        size_t const err_code = (err);                                             \
  |  |  148|    589|        if (ERR_isError(err_code)) {                                               \
  |  |  ------------------
  |  |  |  Branch (148:13): [True: 9, False: 580]
  |  |  ------------------
  |  |  149|      9|            RAWLOG(3, "%s:%d: ERROR!: forwarding error in %s: %s",                 \
  |  |  ------------------
  |  |  |  |  103|      9|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 9]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  150|      9|                  __FILE__, __LINE__, ERR_QUOTE(err), ERR_getErrorName(err_code)); \
  |  |  151|      9|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                                 \
  |  |  ------------------
  |  |  |  |   98|      9|    do {                                           \
  |  |  |  |   99|      9|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 9]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      9|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 9]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  152|      9|            RAWLOG(3, ": " __VA_ARGS__);                                           \
  |  |  ------------------
  |  |  |  |  103|      9|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 9]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  153|      9|            RAWLOG(3, "\n");                                                       \
  |  |  ------------------
  |  |  |  |  103|      9|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 9]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  154|      9|            return err_code;                                                       \
  |  |  155|      9|        }                                                                          \
  |  |  156|    589|    } while(0)
  |  |  ------------------
  |  |  |  Branch (156:13): [Folded, False: 580]
  |  |  ------------------
  ------------------
  283|    580|            FORWARD_IF_ERROR(FSE_buildCTable_wksp(nextCTable, wksp->norm, max, tableLog, wksp->wksp, sizeof(wksp->wksp)), "FSE_buildCTable_wksp failed");
  ------------------
  |  |  146|    580|    do {                                                                           \
  |  |  147|    580|        size_t const err_code = (err);                                             \
  |  |  148|    580|        if (ERR_isError(err_code)) {                                               \
  |  |  ------------------
  |  |  |  Branch (148:13): [True: 0, False: 580]
  |  |  ------------------
  |  |  149|      0|            RAWLOG(3, "%s:%d: ERROR!: forwarding error in %s: %s",                 \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  150|      0|                  __FILE__, __LINE__, ERR_QUOTE(err), ERR_getErrorName(err_code)); \
  |  |  151|      0|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                                 \
  |  |  ------------------
  |  |  |  |   98|      0|    do {                                           \
  |  |  |  |   99|      0|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  152|      0|            RAWLOG(3, ": " __VA_ARGS__);                                           \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  153|      0|            RAWLOG(3, "\n");                                                       \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  154|      0|            return err_code;                                                       \
  |  |  155|      0|        }                                                                          \
  |  |  156|    580|    } while(0)
  |  |  ------------------
  |  |  |  Branch (156:13): [Folded, False: 580]
  |  |  ------------------
  ------------------
  284|    580|            return NCountSize;
  285|    580|        }
  286|    580|    }
  287|      0|    default: assert(0); RETURN_ERROR(GENERIC, "impossible to reach");
  ------------------
  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
                  default: assert(0); RETURN_ERROR(GENERIC, "impossible to reach");
  ------------------
  |  |  131|      0|    do {                                                                     \
  |  |  132|      0|        RAWLOG(3, "%s:%d: ERROR!: unconditional check failed, returning %s", \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  133|      0|              __FILE__, __LINE__, ERR_QUOTE(ERROR(err)));                    \
  |  |  134|      0|        _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                               \
  |  |  ------------------
  |  |  |  |   98|      0|    do {                                           \
  |  |  |  |   99|      0|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  135|      0|        RAWLOG(3, ": " __VA_ARGS__);                                         \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  136|      0|        RAWLOG(3, "\n");                                                     \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  137|      0|        return ERROR(err);                                                   \
  |  |  ------------------
  |  |  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  138|      0|    } while(0)
  |  |  ------------------
  |  |  |  Branch (138:13): [Folded, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (287:5): [True: 0, False: 8.44k]
  ------------------
  288|  8.44k|    }
  289|  8.44k|}
ZSTD_encodeSequences:
  431|  2.80k|{
  432|  2.80k|    DEBUGLOG(5, "ZSTD_encodeSequences: dstCapacity = %u", (unsigned)dstCapacity);
  ------------------
  |  |  104|  2.80k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 2.80k]
  |  |  ------------------
  ------------------
  433|  2.80k|    if (ZSTD_USE_BMI2(bmi2)) {
  ------------------
  |  |   36|  2.80k|#  define ZSTD_USE_BMI2(bmi2) (bmi2)
  |  |  ------------------
  |  |  |  Branch (36:31): [True: 2.80k, False: 0]
  |  |  ------------------
  ------------------
  434|  2.80k|        return ZSTD_encodeSequences_bmi2(dst, dstCapacity,
  435|  2.80k|                                         CTable_MatchLength, mlCodeTable,
  436|  2.80k|                                         CTable_OffsetBits, ofCodeTable,
  437|  2.80k|                                         CTable_LitLength, llCodeTable,
  438|  2.80k|                                         sequences, nbSeq, longOffsets);
  439|  2.80k|    }
  440|      0|    (void)bmi2;
  441|      0|    return ZSTD_encodeSequences_default(dst, dstCapacity,
  442|      0|                                        CTable_MatchLength, mlCodeTable,
  443|      0|                                        CTable_OffsetBits, ofCodeTable,
  444|      0|                                        CTable_LitLength, llCodeTable,
  445|      0|                                        sequences, nbSeq, longOffsets);
  446|  2.80k|}
zstd_compress_sequences.c:ZSTD_NCountCost:
   73|  6.68k|{
   74|  6.68k|    BYTE wksp[FSE_NCOUNTBOUND];
   75|  6.68k|    S16 norm[MaxSeq + 1];
   76|  6.68k|    const U32 tableLog = FSE_optimalTableLog(FSELog, nbSeq, max);
   77|  6.68k|    FORWARD_IF_ERROR(FSE_normalizeCount(norm, tableLog, count, nbSeq, max, ZSTD_useLowProbCount(nbSeq)), "");
  ------------------
  |  |  146|  6.68k|    do {                                                                           \
  |  |  147|  6.68k|        size_t const err_code = (err);                                             \
  |  |  148|  6.68k|        if (ERR_isError(err_code)) {                                               \
  |  |  ------------------
  |  |  |  Branch (148:13): [True: 0, False: 6.68k]
  |  |  ------------------
  |  |  149|      0|            RAWLOG(3, "%s:%d: ERROR!: forwarding error in %s: %s",                 \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  150|      0|                  __FILE__, __LINE__, ERR_QUOTE(err), ERR_getErrorName(err_code)); \
  |  |  151|      0|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                                 \
  |  |  ------------------
  |  |  |  |   98|      0|    do {                                           \
  |  |  |  |   99|      0|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  152|      0|            RAWLOG(3, ": " __VA_ARGS__);                                           \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  153|      0|            RAWLOG(3, "\n");                                                       \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  154|      0|            return err_code;                                                       \
  |  |  155|      0|        }                                                                          \
  |  |  156|  6.68k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (156:13): [Folded, False: 6.68k]
  |  |  ------------------
  ------------------
   78|  6.68k|    return FSE_writeNCount(wksp, sizeof(wksp), norm, max, tableLog);
   79|  6.68k|}
zstd_compress_sequences.c:ZSTD_entropyCost:
   86|  6.68k|{
   87|  6.68k|    unsigned cost = 0;
   88|  6.68k|    unsigned s;
   89|       |
   90|  6.68k|    assert(total > 0);
  ------------------
  |  |   70|  6.68k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
   91|  98.9k|    for (s = 0; s <= max; ++s) {
  ------------------
  |  Branch (91:17): [True: 92.3k, False: 6.68k]
  ------------------
   92|  92.3k|        unsigned norm = (unsigned)((256 * count[s]) / total);
   93|  92.3k|        if (count[s] != 0 && norm == 0)
  ------------------
  |  Branch (93:13): [True: 22.9k, False: 69.4k]
  |  Branch (93:30): [True: 0, False: 22.9k]
  ------------------
   94|      0|            norm = 1;
   95|  92.3k|        assert(count[s] < total);
  ------------------
  |  |   70|  92.3k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
   96|  92.3k|        cost += count[s] * kInverseProbabilityLog256[norm];
   97|  92.3k|    }
   98|  6.68k|    return cost >> 8;
   99|  6.68k|}
zstd_compress_sequences.c:ZSTD_useLowProbCount:
   59|  7.27k|{
   60|       |    /* Heuristic: This should cover most blocks <= 16K and
   61|       |     * start to fade out after 16K to about 32K depending on
   62|       |     * compressibility.
   63|       |     */
   64|  7.27k|    return nbSeq >= 2048;
   65|  7.27k|}
zstd_compress_sequences.c:ZSTD_encodeSequences_bmi2:
  411|  2.80k|{
  412|  2.80k|    return ZSTD_encodeSequences_body(dst, dstCapacity,
  413|  2.80k|                                    CTable_MatchLength, mlCodeTable,
  414|  2.80k|                                    CTable_OffsetBits, ofCodeTable,
  415|  2.80k|                                    CTable_LitLength, llCodeTable,
  416|  2.80k|                                    sequences, nbSeq, longOffsets);
  417|  2.80k|}
zstd_compress_sequences.c:ZSTD_encodeSequences_body:
  298|  2.80k|{
  299|  2.80k|    BIT_CStream_t blockStream;
  300|  2.80k|    FSE_CState_t  stateMatchLength;
  301|  2.80k|    FSE_CState_t  stateOffsetBits;
  302|  2.80k|    FSE_CState_t  stateLitLength;
  303|       |
  304|  2.80k|    assert(MEM_32bits() || !longOffsets);
  ------------------
  |  |   70|  2.80k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  305|  2.80k|    RETURN_ERROR_IF(
  ------------------
  |  |  114|  2.80k|    do {                                                                       \
  |  |  115|  2.80k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 109, False: 2.69k]
  |  |  ------------------
  |  |  116|    109|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|    109|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 109]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|    109|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|    109|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|    109|    do {                                           \
  |  |  |  |   99|    109|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 109]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|    109|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 109]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|    109|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|    109|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 109]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|    109|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|    109|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 109]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|    109|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|    109|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|    109|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|    109|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|    109|        }                                                                      \
  |  |  123|  2.80k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 2.69k]
  |  |  ------------------
  ------------------
  306|  2.80k|        ERR_isError(BIT_initCStream(&blockStream, dst, dstCapacity)),
  307|  2.80k|        dstSize_tooSmall, "not enough space remaining");
  308|  2.69k|    DEBUGLOG(6, "available space for bitstream : %i  (dstCapacity=%u)",
  ------------------
  |  |  104|  2.69k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 2.69k]
  |  |  ------------------
  ------------------
  309|  2.69k|                (int)(blockStream.endPtr - blockStream.startPtr),
  310|  2.69k|                (unsigned)dstCapacity);
  311|       |
  312|       |    /* first symbols */
  313|  2.69k|    FSE_initCState2(&stateMatchLength, CTable_MatchLength, mlCodeTable[nbSeq-1]);
  314|  2.69k|    FSE_initCState2(&stateOffsetBits,  CTable_OffsetBits,  ofCodeTable[nbSeq-1]);
  315|  2.69k|    FSE_initCState2(&stateLitLength,   CTable_LitLength,   llCodeTable[nbSeq-1]);
  316|  2.69k|    BIT_addBits(&blockStream, sequences[nbSeq-1].litLength, LL_bits[llCodeTable[nbSeq-1]]);
  317|  2.69k|    if (MEM_32bits()) BIT_flushBits(&blockStream);
  ------------------
  |  Branch (317:9): [True: 0, False: 2.69k]
  ------------------
  318|  2.69k|    BIT_addBits(&blockStream, sequences[nbSeq-1].mlBase, ML_bits[mlCodeTable[nbSeq-1]]);
  319|  2.69k|    if (MEM_32bits()) BIT_flushBits(&blockStream);
  ------------------
  |  Branch (319:9): [True: 0, False: 2.69k]
  ------------------
  320|  2.69k|    if (MEM_32bits() && longOffsets) {
  ------------------
  |  Branch (320:9): [True: 0, False: 2.69k]
  |  Branch (320:25): [True: 0, False: 0]
  ------------------
  321|      0|        U32 const ofBits = ofCodeTable[nbSeq-1];
  322|      0|        unsigned const extraBits = ofBits - MIN(ofBits, STREAM_ACCUMULATOR_MIN-1);
  ------------------
  |  |   54|      0|#define MIN(a,b) ((a)<(b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (54:19): [True: 0, False: 0]
  |  |  |  Branch (54:24): [True: 0, False: 0]
  |  |  |  Branch (54:36): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  323|      0|        if (extraBits) {
  ------------------
  |  Branch (323:13): [True: 0, False: 0]
  ------------------
  324|      0|            BIT_addBits(&blockStream, sequences[nbSeq-1].offBase, extraBits);
  325|      0|            BIT_flushBits(&blockStream);
  326|      0|        }
  327|      0|        BIT_addBits(&blockStream, sequences[nbSeq-1].offBase >> extraBits,
  328|      0|                    ofBits - extraBits);
  329|  2.69k|    } else {
  330|  2.69k|        BIT_addBits(&blockStream, sequences[nbSeq-1].offBase, ofCodeTable[nbSeq-1]);
  331|  2.69k|    }
  332|  2.69k|    BIT_flushBits(&blockStream);
  333|       |
  334|  2.69k|    {   size_t n;
  335|  12.5k|        for (n=nbSeq-2 ; n<nbSeq ; n--) {      /* intentional underflow */
  ------------------
  |  Branch (335:26): [True: 9.86k, False: 2.69k]
  ------------------
  336|  9.86k|            BYTE const llCode = llCodeTable[n];
  337|  9.86k|            BYTE const ofCode = ofCodeTable[n];
  338|  9.86k|            BYTE const mlCode = mlCodeTable[n];
  339|  9.86k|            U32  const llBits = LL_bits[llCode];
  340|  9.86k|            U32  const ofBits = ofCode;
  341|  9.86k|            U32  const mlBits = ML_bits[mlCode];
  342|  9.86k|            DEBUGLOG(6, "encoding: litlen:%2u - matchlen:%2u - offCode:%7u",
  ------------------
  |  |  104|  9.86k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 9.86k]
  |  |  ------------------
  ------------------
  343|  9.86k|                        (unsigned)sequences[n].litLength,
  344|  9.86k|                        (unsigned)sequences[n].mlBase + MINMATCH,
  345|  9.86k|                        (unsigned)sequences[n].offBase);
  346|       |                                                                            /* 32b*/  /* 64b*/
  347|       |                                                                            /* (7)*/  /* (7)*/
  348|  9.86k|            FSE_encodeSymbol(&blockStream, &stateOffsetBits, ofCode);       /* 15 */  /* 15 */
  349|  9.86k|            FSE_encodeSymbol(&blockStream, &stateMatchLength, mlCode);      /* 24 */  /* 24 */
  350|  9.86k|            if (MEM_32bits()) BIT_flushBits(&blockStream);                  /* (7)*/
  ------------------
  |  Branch (350:17): [True: 0, False: 9.86k]
  ------------------
  351|  9.86k|            FSE_encodeSymbol(&blockStream, &stateLitLength, llCode);        /* 16 */  /* 33 */
  352|  9.86k|            if (MEM_32bits() || (ofBits+mlBits+llBits >= 64-7-(LLFSELog+MLFSELog+OffFSELog)))
  ------------------
  |  |  109|  9.86k|#define LLFSELog    9
  ------------------
                          if (MEM_32bits() || (ofBits+mlBits+llBits >= 64-7-(LLFSELog+MLFSELog+OffFSELog)))
  ------------------
  |  |  108|  9.86k|#define MLFSELog    9
  ------------------
                          if (MEM_32bits() || (ofBits+mlBits+llBits >= 64-7-(LLFSELog+MLFSELog+OffFSELog)))
  ------------------
  |  |  110|  9.86k|#define OffFSELog   8
  ------------------
  |  Branch (352:17): [True: 0, False: 9.86k]
  |  Branch (352:33): [True: 0, False: 9.86k]
  ------------------
  353|      0|                BIT_flushBits(&blockStream);                                /* (7)*/
  354|  9.86k|            BIT_addBits(&blockStream, sequences[n].litLength, llBits);
  355|  9.86k|            if (MEM_32bits() && ((llBits+mlBits)>24)) BIT_flushBits(&blockStream);
  ------------------
  |  Branch (355:17): [True: 0, False: 9.86k]
  |  Branch (355:33): [True: 0, False: 0]
  ------------------
  356|  9.86k|            BIT_addBits(&blockStream, sequences[n].mlBase, mlBits);
  357|  9.86k|            if (MEM_32bits() || (ofBits+mlBits+llBits > 56)) BIT_flushBits(&blockStream);
  ------------------
  |  Branch (357:17): [True: 0, False: 9.86k]
  |  Branch (357:33): [True: 0, False: 9.86k]
  ------------------
  358|  9.86k|            if (MEM_32bits() && longOffsets) {
  ------------------
  |  Branch (358:17): [True: 0, False: 9.86k]
  |  Branch (358:33): [True: 0, False: 0]
  ------------------
  359|      0|                unsigned const extraBits = ofBits - MIN(ofBits, STREAM_ACCUMULATOR_MIN-1);
  ------------------
  |  |   54|      0|#define MIN(a,b) ((a)<(b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (54:19): [True: 0, False: 0]
  |  |  |  Branch (54:24): [True: 0, False: 0]
  |  |  |  Branch (54:36): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  360|      0|                if (extraBits) {
  ------------------
  |  Branch (360:21): [True: 0, False: 0]
  ------------------
  361|      0|                    BIT_addBits(&blockStream, sequences[n].offBase, extraBits);
  362|      0|                    BIT_flushBits(&blockStream);                            /* (7)*/
  363|      0|                }
  364|      0|                BIT_addBits(&blockStream, sequences[n].offBase >> extraBits,
  365|      0|                            ofBits - extraBits);                            /* 31 */
  366|  9.86k|            } else {
  367|  9.86k|                BIT_addBits(&blockStream, sequences[n].offBase, ofBits);     /* 31 */
  368|  9.86k|            }
  369|  9.86k|            BIT_flushBits(&blockStream);                                    /* (7)*/
  370|  9.86k|            DEBUGLOG(7, "remaining space : %i", (int)(blockStream.endPtr - blockStream.ptr));
  ------------------
  |  |  104|  9.86k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 9.86k]
  |  |  ------------------
  ------------------
  371|  9.86k|    }   }
  372|       |
  373|  2.69k|    DEBUGLOG(6, "ZSTD_encodeSequences: flushing ML state with %u bits", stateMatchLength.stateLog);
  ------------------
  |  |  104|  2.69k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 2.69k]
  |  |  ------------------
  ------------------
  374|  2.69k|    FSE_flushCState(&blockStream, &stateMatchLength);
  375|  2.69k|    DEBUGLOG(6, "ZSTD_encodeSequences: flushing Off state with %u bits", stateOffsetBits.stateLog);
  ------------------
  |  |  104|  2.69k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 2.69k]
  |  |  ------------------
  ------------------
  376|  2.69k|    FSE_flushCState(&blockStream, &stateOffsetBits);
  377|  2.69k|    DEBUGLOG(6, "ZSTD_encodeSequences: flushing LL state with %u bits", stateLitLength.stateLog);
  ------------------
  |  |  104|  2.69k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 2.69k]
  |  |  ------------------
  ------------------
  378|  2.69k|    FSE_flushCState(&blockStream, &stateLitLength);
  379|       |
  380|  2.69k|    {   size_t const streamSize = BIT_closeCStream(&blockStream);
  381|  2.69k|        RETURN_ERROR_IF(streamSize==0, dstSize_tooSmall, "not enough space");
  ------------------
  |  |  114|  2.69k|    do {                                                                       \
  |  |  115|  2.69k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 291, False: 2.40k]
  |  |  ------------------
  |  |  116|    291|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|    291|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 291]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|    291|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|    291|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|    291|    do {                                           \
  |  |  |  |   99|    291|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 291]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|    291|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 291]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|    291|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|    291|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 291]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|    291|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|    291|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 291]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|    291|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|    291|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|    291|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|    291|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|    291|        }                                                                      \
  |  |  123|  2.69k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 2.40k]
  |  |  ------------------
  ------------------
  382|  2.40k|        return streamSize;
  383|  2.69k|    }
  384|  2.69k|}

zstd_compress.c:ZSTD_cwksp_init:
  674|     28|MEM_STATIC void ZSTD_cwksp_init(ZSTD_cwksp* ws, void* start, size_t size, ZSTD_cwksp_static_alloc_e isStatic) {
  675|     28|    DEBUGLOG(4, "cwksp: init'ing workspace with %zd bytes", size);
  ------------------
  |  |  104|     28|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 28]
  |  |  ------------------
  ------------------
  676|     28|    assert(((size_t)start & (sizeof(void*)-1)) == 0); /* ensure correct alignment */
  ------------------
  |  |   70|     28|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  677|     28|    ws->workspace = start;
  678|     28|    ws->workspaceEnd = (BYTE*)start + size;
  679|     28|    ws->objectEnd = ws->workspace;
  680|     28|    ws->tableValidEnd = ws->objectEnd;
  681|     28|    ws->initOnceStart = ZSTD_cwksp_initialAllocStart(ws);
  682|     28|    ws->phase = ZSTD_cwksp_alloc_objects;
  683|     28|    ws->isStatic = isStatic;
  684|     28|    ZSTD_cwksp_clear(ws);
  685|     28|    ws->workspaceOversizedDuration = 0;
  686|     28|    ZSTD_cwksp_assert_internal_consistency(ws);
  687|     28|}
zstd_compress.c:ZSTD_cwksp_initialAllocStart:
  276|  4.44k|{
  277|  4.44k|    char* endPtr = (char*)ws->workspaceEnd;
  278|  4.44k|    assert(ZSTD_isPower2(ZSTD_CWKSP_ALIGNMENT_BYTES));
  ------------------
  |  |   70|  4.44k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  279|  4.44k|    endPtr = endPtr - ((size_t)endPtr % ZSTD_CWKSP_ALIGNMENT_BYTES);
  ------------------
  |  |   39|  4.44k|#define ZSTD_CWKSP_ALIGNMENT_BYTES 64
  ------------------
  280|  4.44k|    return (void*)endPtr;
  281|  4.44k|}
zstd_compress.c:ZSTD_cwksp_clear:
  623|  4.39k|MEM_STATIC void ZSTD_cwksp_clear(ZSTD_cwksp* ws) {
  624|  4.39k|    DEBUGLOG(4, "cwksp: clearing!");
  ------------------
  |  |  104|  4.39k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 4.39k]
  |  |  ------------------
  ------------------
  625|       |
  626|       |#if ZSTD_MEMORY_SANITIZER && !defined (ZSTD_MSAN_DONT_POISON_WORKSPACE)
  627|       |    /* To validate that the context reuse logic is sound, and that we don't
  628|       |     * access stuff that this compression hasn't initialized, we re-"poison"
  629|       |     * the workspace except for the areas in which we expect memory reuse
  630|       |     * without initialization (objects, valid tables area and init once
  631|       |     * memory). */
  632|       |    {
  633|       |        if((BYTE*)ws->tableValidEnd < (BYTE*)ws->initOnceStart) {
  634|       |            size_t size = (BYTE*)ws->initOnceStart - (BYTE*)ws->tableValidEnd;
  635|       |            __msan_poison(ws->tableValidEnd, size);
  636|       |        }
  637|       |    }
  638|       |#endif
  639|       |
  640|       |#if ZSTD_ADDRESS_SANITIZER && !defined (ZSTD_ASAN_DONT_POISON_WORKSPACE)
  641|       |    /* We don't do this when the workspace is statically allocated, because
  642|       |     * when that is the case, we have no capability to hook into the end of the
  643|       |     * workspace's lifecycle to unpoison the memory.
  644|       |     */
  645|       |    if (ws->isStatic == ZSTD_cwksp_dynamic_alloc) {
  646|       |        size_t size = (BYTE*)ws->workspaceEnd - (BYTE*)ws->objectEnd;
  647|       |        __asan_poison_memory_region(ws->objectEnd, size);
  648|       |    }
  649|       |#endif
  650|       |
  651|  4.39k|    ws->tableEnd = ws->objectEnd;
  652|  4.39k|    ws->allocStart = ZSTD_cwksp_initialAllocStart(ws);
  653|  4.39k|    ws->allocFailed = 0;
  654|  4.39k|    if (ws->phase > ZSTD_cwksp_alloc_aligned_init_once) {
  ------------------
  |  Branch (654:9): [True: 4.33k, False: 56]
  ------------------
  655|  4.33k|        ws->phase = ZSTD_cwksp_alloc_aligned_init_once;
  656|  4.33k|    }
  657|  4.39k|    ZSTD_cwksp_assert_internal_consistency(ws);
  658|  4.39k|}
zstd_compress.c:ZSTD_cwksp_assert_internal_consistency:
  178|  67.9k|MEM_STATIC void ZSTD_cwksp_assert_internal_consistency(ZSTD_cwksp* ws) {
  179|  67.9k|    (void)ws;
  180|  67.9k|    assert(ws->workspace <= ws->objectEnd);
  ------------------
  |  |   70|  67.9k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  181|  67.9k|    assert(ws->objectEnd <= ws->tableEnd);
  ------------------
  |  |   70|  67.9k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  182|  67.9k|    assert(ws->objectEnd <= ws->tableValidEnd);
  ------------------
  |  |   70|  67.9k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  183|  67.9k|    assert(ws->tableEnd <= ws->allocStart);
  ------------------
  |  |   70|  67.9k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  184|  67.9k|    assert(ws->tableValidEnd <= ws->allocStart);
  ------------------
  |  |   70|  67.9k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  185|  67.9k|    assert(ws->allocStart <= ws->workspaceEnd);
  ------------------
  |  |   70|  67.9k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  186|  67.9k|    assert(ws->initOnceStart <= ZSTD_cwksp_initialAllocStart(ws));
  ------------------
  |  |   70|  67.9k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  187|  67.9k|    assert(ws->workspace <= ws->initOnceStart);
  ------------------
  |  |   70|  67.9k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  188|       |#if ZSTD_MEMORY_SANITIZER
  189|       |    {
  190|       |        intptr_t const offset = __msan_test_shadow(ws->initOnceStart,
  191|       |            (U8*)ZSTD_cwksp_initialAllocStart(ws) - (U8*)ws->initOnceStart);
  192|       |        (void)offset;
  193|       |#if defined(ZSTD_MSAN_PRINT)
  194|       |        if(offset!=-1) {
  195|       |            __msan_print_shadow((U8*)ws->initOnceStart + offset - 8, 32);
  196|       |        }
  197|       |#endif
  198|       |        assert(offset==-1);
  199|       |    };
  200|       |#endif
  201|  67.9k|}
zstd_compress.c:ZSTD_cwksp_reserve_object:
  492|     84|{
  493|     84|    size_t const roundedBytes = ZSTD_cwksp_align(bytes, sizeof(void*));
  494|     84|    void* alloc = ws->objectEnd;
  495|     84|    void* end = (BYTE*)alloc + roundedBytes;
  496|       |
  497|       |#if ZSTD_ADDRESS_SANITIZER && !defined (ZSTD_ASAN_DONT_POISON_WORKSPACE)
  498|       |    /* over-reserve space */
  499|       |    end = (BYTE *)end + 2 * ZSTD_CWKSP_ASAN_REDZONE_SIZE;
  500|       |#endif
  501|       |
  502|     84|    DEBUGLOG(4,
  ------------------
  |  |  104|     84|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 84]
  |  |  ------------------
  ------------------
  503|     84|        "cwksp: reserving %p object %zd bytes (rounded to %zd), %zd bytes remaining",
  504|     84|        alloc, bytes, roundedBytes, ZSTD_cwksp_available_space(ws) - roundedBytes);
  505|     84|    assert((size_t)alloc % ZSTD_ALIGNOF(void*) == 0);
  ------------------
  |  |   70|     84|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  506|     84|    assert(bytes % ZSTD_ALIGNOF(void*) == 0);
  ------------------
  |  |   70|     84|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  507|     84|    ZSTD_cwksp_assert_internal_consistency(ws);
  508|       |    /* we must be in the first phase, no advance is possible */
  509|     84|    if (ws->phase != ZSTD_cwksp_alloc_objects || end > ws->workspaceEnd) {
  ------------------
  |  Branch (509:9): [True: 0, False: 84]
  |  Branch (509:50): [True: 0, False: 84]
  ------------------
  510|      0|        DEBUGLOG(3, "cwksp: object alloc failed!");
  ------------------
  |  |  104|      0|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 0]
  |  |  ------------------
  ------------------
  511|      0|        ws->allocFailed = 1;
  512|      0|        return NULL;
  513|      0|    }
  514|     84|    ws->objectEnd = end;
  515|     84|    ws->tableEnd = end;
  516|     84|    ws->tableValidEnd = end;
  517|       |
  518|       |#if ZSTD_ADDRESS_SANITIZER && !defined (ZSTD_ASAN_DONT_POISON_WORKSPACE)
  519|       |    /* Move alloc so there's ZSTD_CWKSP_ASAN_REDZONE_SIZE unused space on
  520|       |     * either size. */
  521|       |    alloc = (BYTE*)alloc + ZSTD_CWKSP_ASAN_REDZONE_SIZE;
  522|       |    if (ws->isStatic == ZSTD_cwksp_dynamic_alloc) {
  523|       |        __asan_unpoison_memory_region(alloc, bytes);
  524|       |    }
  525|       |#endif
  526|       |
  527|     84|    return alloc;
  528|     84|}
zstd_compress.c:ZSTD_cwksp_align:
  206|  45.7k|MEM_STATIC size_t ZSTD_cwksp_align(size_t size, size_t align) {
  207|  45.7k|    size_t const mask = align - 1;
  208|  45.7k|    assert(ZSTD_isPower2(align));
  ------------------
  |  |   70|  45.7k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  209|  45.7k|    return (size + mask) & ~mask;
  210|  45.7k|}
zstd_compress.c:ZSTD_cwksp_check_available:
  742|  8.72k|MEM_STATIC int ZSTD_cwksp_check_available(ZSTD_cwksp* ws, size_t additionalNeededSpace) {
  743|  8.72k|    return ZSTD_cwksp_available_space(ws) >= additionalNeededSpace;
  744|  8.72k|}
zstd_compress.c:ZSTD_cwksp_available_space:
  738|  8.72k|MEM_STATIC size_t ZSTD_cwksp_available_space(ZSTD_cwksp* ws) {
  739|  8.72k|    return (size_t)((BYTE*)ws->allocStart - (BYTE*)ws->tableEnd);
  740|  8.72k|}
zstd_compress.c:ZSTD_cwksp_owns_buffer:
  353|     28|{
  354|     28|    return (ptr != NULL) && (ws->workspace <= ptr) && (ptr < ws->workspaceEnd);
  ------------------
  |  Branch (354:12): [True: 28, False: 0]
  |  Branch (354:29): [True: 5, False: 23]
  |  Branch (354:55): [True: 0, False: 5]
  ------------------
  355|     28|}
zstd_compress.c:ZSTD_cwksp_sizeof:
  660|  7.25k|MEM_STATIC size_t ZSTD_cwksp_sizeof(const ZSTD_cwksp* ws) {
  661|  7.25k|    return (size_t)((BYTE*)ws->workspaceEnd - (BYTE*)ws->workspace);
  662|  7.25k|}
zstd_compress.c:ZSTD_cwksp_alloc_size:
  224|  56.7k|MEM_STATIC size_t ZSTD_cwksp_alloc_size(size_t size) {
  225|  56.7k|    if (size == 0)
  ------------------
  |  Branch (225:9): [True: 8.72k, False: 47.9k]
  ------------------
  226|  8.72k|        return 0;
  227|       |#if ZSTD_ADDRESS_SANITIZER && !defined (ZSTD_ASAN_DONT_POISON_WORKSPACE)
  228|       |    return size + 2 * ZSTD_CWKSP_ASAN_REDZONE_SIZE;
  229|       |#else
  230|  47.9k|    return size;
  231|  56.7k|#endif
  232|  56.7k|}
zstd_compress.c:ZSTD_cwksp_aligned64_alloc_size:
  242|  30.5k|MEM_STATIC size_t ZSTD_cwksp_aligned64_alloc_size(size_t size) {
  243|  30.5k|    return ZSTD_cwksp_aligned_alloc_size(size, ZSTD_CWKSP_ALIGNMENT_BYTES);
  ------------------
  |  |   39|  30.5k|#define ZSTD_CWKSP_ALIGNMENT_BYTES 64
  ------------------
  244|  30.5k|}
zstd_compress.c:ZSTD_cwksp_aligned_alloc_size:
  234|  30.5k|MEM_STATIC size_t ZSTD_cwksp_aligned_alloc_size(size_t size, size_t alignment) {
  235|  30.5k|    return ZSTD_cwksp_alloc_size(ZSTD_cwksp_align(size, alignment));
  236|  30.5k|}
zstd_compress.c:ZSTD_cwksp_mark_tables_dirty:
  545|    161|{
  546|    161|    DEBUGLOG(4, "cwksp: ZSTD_cwksp_mark_tables_dirty");
  ------------------
  |  |  104|    161|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 161]
  |  |  ------------------
  ------------------
  547|       |
  548|       |#if ZSTD_MEMORY_SANITIZER && !defined (ZSTD_MSAN_DONT_POISON_WORKSPACE)
  549|       |    /* To validate that the table reuse logic is sound, and that we don't
  550|       |     * access table space that we haven't cleaned, we re-"poison" the table
  551|       |     * space every time we mark it dirty.
  552|       |     * Since tableValidEnd space and initOnce space may overlap we don't poison
  553|       |     * the initOnce portion as it break its promise. This means that this poisoning
  554|       |     * check isn't always applied fully. */
  555|       |    {
  556|       |        size_t size = (BYTE*)ws->tableValidEnd - (BYTE*)ws->objectEnd;
  557|       |        assert(__msan_test_shadow(ws->objectEnd, size) == -1);
  558|       |        if((BYTE*)ws->tableValidEnd < (BYTE*)ws->initOnceStart) {
  559|       |            __msan_poison(ws->objectEnd, size);
  560|       |        } else {
  561|       |            assert(ws->initOnceStart >= ws->objectEnd);
  562|       |            __msan_poison(ws->objectEnd, (BYTE*)ws->initOnceStart - (BYTE*)ws->objectEnd);
  563|       |        }
  564|       |    }
  565|       |#endif
  566|       |
  567|    161|    assert(ws->tableValidEnd >= ws->objectEnd);
  ------------------
  |  |   70|    161|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  568|    161|    assert(ws->tableValidEnd <= ws->allocStart);
  ------------------
  |  |   70|    161|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  569|    161|    ws->tableValidEnd = ws->objectEnd;
  570|    161|    ZSTD_cwksp_assert_internal_consistency(ws);
  571|    161|}
zstd_compress.c:ZSTD_cwksp_mark_tables_clean:
  573|  4.49k|MEM_STATIC void ZSTD_cwksp_mark_tables_clean(ZSTD_cwksp* ws) {
  574|  4.49k|    DEBUGLOG(4, "cwksp: ZSTD_cwksp_mark_tables_clean");
  ------------------
  |  |  104|  4.49k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 4.49k]
  |  |  ------------------
  ------------------
  575|  4.49k|    assert(ws->tableValidEnd >= ws->objectEnd);
  ------------------
  |  |   70|  4.49k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  576|  4.49k|    assert(ws->tableValidEnd <= ws->allocStart);
  ------------------
  |  |   70|  4.49k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  577|  4.49k|    if (ws->tableValidEnd < ws->tableEnd) {
  ------------------
  |  Branch (577:9): [True: 161, False: 4.33k]
  ------------------
  578|    161|        ws->tableValidEnd = ws->tableEnd;
  579|    161|    }
  580|  4.49k|    ZSTD_cwksp_assert_internal_consistency(ws);
  581|  4.49k|}
zstd_compress.c:ZSTD_cwksp_bump_oversized_duration:
  757|  4.36k|        ZSTD_cwksp* ws, size_t additionalNeededSpace) {
  758|  4.36k|    if (ZSTD_cwksp_check_too_large(ws, additionalNeededSpace)) {
  ------------------
  |  Branch (758:9): [True: 4.36k, False: 0]
  ------------------
  759|  4.36k|        ws->workspaceOversizedDuration++;
  760|  4.36k|    } else {
  761|      0|        ws->workspaceOversizedDuration = 0;
  762|      0|    }
  763|  4.36k|}
zstd_compress.c:ZSTD_cwksp_check_too_large:
  746|  8.72k|MEM_STATIC int ZSTD_cwksp_check_too_large(ZSTD_cwksp* ws, size_t additionalNeededSpace) {
  747|  8.72k|    return ZSTD_cwksp_check_available(
  748|  8.72k|        ws, additionalNeededSpace * ZSTD_WORKSPACETOOLARGE_FACTOR);
  ------------------
  |  |  260|  8.72k|#define ZSTD_WORKSPACETOOLARGE_FACTOR 3
  ------------------
  749|  8.72k|}
zstd_compress.c:ZSTD_cwksp_check_wasteful:
  751|  4.36k|MEM_STATIC int ZSTD_cwksp_check_wasteful(ZSTD_cwksp* ws, size_t additionalNeededSpace) {
  752|  4.36k|    return ZSTD_cwksp_check_too_large(ws, additionalNeededSpace)
  ------------------
  |  Branch (752:12): [True: 0, False: 4.36k]
  ------------------
  753|      0|        && ws->workspaceOversizedDuration > ZSTD_WORKSPACETOOLARGE_MAXDURATION;
  ------------------
  |  |  267|      0|#define ZSTD_WORKSPACETOOLARGE_MAXDURATION 128
  ------------------
  |  Branch (753:12): [True: 0, False: 0]
  ------------------
  754|  4.36k|}
zstd_compress.c:ZSTD_cwksp_create:
  689|     28|MEM_STATIC size_t ZSTD_cwksp_create(ZSTD_cwksp* ws, size_t size, ZSTD_customMem customMem) {
  690|     28|    void* workspace = ZSTD_customMalloc(size, customMem);
  691|     28|    DEBUGLOG(4, "cwksp: creating new workspace with %zd bytes", size);
  ------------------
  |  |  104|     28|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 28]
  |  |  ------------------
  ------------------
  692|     28|    RETURN_ERROR_IF(workspace == NULL, memory_allocation, "NULL pointer!");
  ------------------
  |  |  114|     28|    do {                                                                       \
  |  |  115|     28|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 0, False: 28]
  |  |  ------------------
  |  |  116|      0|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|      0|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|      0|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|      0|    do {                                           \
  |  |  |  |   99|      0|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|      0|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|      0|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|      0|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|      0|        }                                                                      \
  |  |  123|     28|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 28]
  |  |  ------------------
  ------------------
  693|     28|    ZSTD_cwksp_init(ws, workspace, size, ZSTD_cwksp_dynamic_alloc);
  694|     28|    return 0;
  695|     28|}
zstd_compress.c:ZSTD_cwksp_clear_tables:
  601|  4.36k|{
  602|  4.36k|    DEBUGLOG(4, "cwksp: clearing tables!");
  ------------------
  |  |  104|  4.36k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 4.36k]
  |  |  ------------------
  ------------------
  603|       |
  604|       |#if ZSTD_ADDRESS_SANITIZER && !defined (ZSTD_ASAN_DONT_POISON_WORKSPACE)
  605|       |    /* We don't do this when the workspace is statically allocated, because
  606|       |     * when that is the case, we have no capability to hook into the end of the
  607|       |     * workspace's lifecycle to unpoison the memory.
  608|       |     */
  609|       |    if (ws->isStatic == ZSTD_cwksp_dynamic_alloc) {
  610|       |        size_t size = (BYTE*)ws->tableValidEnd - (BYTE*)ws->objectEnd;
  611|       |        __asan_poison_memory_region(ws->objectEnd, size);
  612|       |    }
  613|       |#endif
  614|       |
  615|  4.36k|    ws->tableEnd = ws->objectEnd;
  616|  4.36k|    ZSTD_cwksp_assert_internal_consistency(ws);
  617|  4.36k|}
zstd_compress.c:ZSTD_cwksp_reserve_table:
  447|  13.0k|{
  448|  13.0k|    const ZSTD_cwksp_alloc_phase_e phase = ZSTD_cwksp_alloc_aligned_init_once;
  449|  13.0k|    void* alloc;
  450|  13.0k|    void* end;
  451|  13.0k|    void* top;
  452|       |
  453|       |    /* We can only start allocating tables after we are done reserving space for objects at the
  454|       |     * start of the workspace */
  455|  13.0k|    if(ws->phase < phase) {
  ------------------
  |  Branch (455:8): [True: 28, False: 13.0k]
  ------------------
  456|     28|        if (ZSTD_isError(ZSTD_cwksp_internal_advance_phase(ws, phase))) {
  ------------------
  |  |   44|     28|#define ZSTD_isError ERR_isError   /* for inlining */
  ------------------
  |  Branch (456:13): [True: 0, False: 28]
  ------------------
  457|      0|            return NULL;
  458|      0|        }
  459|     28|    }
  460|  13.0k|    alloc = ws->tableEnd;
  461|  13.0k|    end = (BYTE *)alloc + bytes;
  462|  13.0k|    top = ws->allocStart;
  463|       |
  464|  13.0k|    DEBUGLOG(5, "cwksp: reserving %p table %zd bytes, %zd bytes remaining",
  ------------------
  |  |  104|  13.0k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 13.0k]
  |  |  ------------------
  ------------------
  465|  13.0k|        alloc, bytes, ZSTD_cwksp_available_space(ws) - bytes);
  466|  13.0k|    assert((bytes & (sizeof(U32)-1)) == 0);
  ------------------
  |  |   70|  13.0k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  467|  13.0k|    ZSTD_cwksp_assert_internal_consistency(ws);
  468|  13.0k|    assert(end <= top);
  ------------------
  |  |   70|  13.0k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  469|  13.0k|    if (end > top) {
  ------------------
  |  Branch (469:9): [True: 0, False: 13.0k]
  ------------------
  470|      0|        DEBUGLOG(4, "cwksp: table alloc failed!");
  ------------------
  |  |  104|      0|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 0]
  |  |  ------------------
  ------------------
  471|      0|        ws->allocFailed = 1;
  472|      0|        return NULL;
  473|      0|    }
  474|  13.0k|    ws->tableEnd = end;
  475|       |
  476|       |#if ZSTD_ADDRESS_SANITIZER && !defined (ZSTD_ASAN_DONT_POISON_WORKSPACE)
  477|       |    if (ws->isStatic == ZSTD_cwksp_dynamic_alloc) {
  478|       |        __asan_unpoison_memory_region(alloc, bytes);
  479|       |    }
  480|       |#endif
  481|       |
  482|  13.0k|    assert((bytes & (ZSTD_CWKSP_ALIGNMENT_BYTES-1)) == 0);
  ------------------
  |  |   70|  13.0k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  483|  13.0k|    assert(((size_t)alloc & (ZSTD_CWKSP_ALIGNMENT_BYTES-1)) == 0);
  ------------------
  |  |   70|  13.0k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  484|  13.0k|    return alloc;
  485|  13.0k|}
zstd_compress.c:ZSTD_cwksp_internal_advance_phase:
  320|  41.3k|{
  321|  41.3k|    assert(phase >= ws->phase);
  ------------------
  |  |   70|  41.3k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  322|  41.3k|    if (phase > ws->phase) {
  ------------------
  |  Branch (322:9): [True: 8.75k, False: 32.6k]
  ------------------
  323|       |        /* Going from allocating objects to allocating initOnce / tables */
  324|  8.75k|        if (ws->phase < ZSTD_cwksp_alloc_aligned_init_once &&
  ------------------
  |  Branch (324:13): [True: 28, False: 8.72k]
  ------------------
  325|     28|            phase >= ZSTD_cwksp_alloc_aligned_init_once) {
  ------------------
  |  Branch (325:13): [True: 28, False: 0]
  ------------------
  326|     28|            ws->tableValidEnd = ws->objectEnd;
  327|     28|            ws->initOnceStart = ZSTD_cwksp_initialAllocStart(ws);
  328|       |
  329|     28|            {   /* Align the start of the tables to 64 bytes. Use [0, 63] bytes */
  330|     28|                void *const alloc = ws->objectEnd;
  331|     28|                size_t const bytesToAlign = ZSTD_cwksp_bytes_to_align_ptr(alloc, ZSTD_CWKSP_ALIGNMENT_BYTES);
  ------------------
  |  |   39|     28|#define ZSTD_CWKSP_ALIGNMENT_BYTES 64
  ------------------
  332|     28|                void *const objectEnd = (BYTE *) alloc + bytesToAlign;
  333|     28|                DEBUGLOG(5, "reserving table alignment addtl space: %zu", bytesToAlign);
  ------------------
  |  |  104|     28|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 28]
  |  |  ------------------
  ------------------
  334|     28|                RETURN_ERROR_IF(objectEnd > ws->workspaceEnd, memory_allocation,
  ------------------
  |  |  114|     28|    do {                                                                       \
  |  |  115|     28|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 0, False: 28]
  |  |  ------------------
  |  |  116|      0|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|      0|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|      0|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|      0|    do {                                           \
  |  |  |  |   99|      0|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|      0|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|      0|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|      0|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|      0|        }                                                                      \
  |  |  123|     28|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 28]
  |  |  ------------------
  ------------------
  335|     28|                                "table phase - alignment initial allocation failed!");
  336|     28|                ws->objectEnd = objectEnd;
  337|     28|                ws->tableEnd = objectEnd;  /* table area starts being empty */
  338|     28|                if (ws->tableValidEnd < ws->tableEnd) {
  ------------------
  |  Branch (338:21): [True: 28, False: 0]
  ------------------
  339|     28|                    ws->tableValidEnd = ws->tableEnd;
  340|     28|                }
  341|     28|            }
  342|     28|        }
  343|  8.75k|        ws->phase = phase;
  344|  8.75k|        ZSTD_cwksp_assert_internal_consistency(ws);
  345|  8.75k|    }
  346|  41.3k|    return 0;
  347|  41.3k|}
zstd_compress.c:ZSTD_cwksp_bytes_to_align_ptr:
  263|     28|MEM_STATIC size_t ZSTD_cwksp_bytes_to_align_ptr(void* ptr, const size_t alignBytes) {
  264|     28|    size_t const alignBytesMask = alignBytes - 1;
  265|     28|    size_t const bytes = (alignBytes - ((size_t)ptr & (alignBytesMask))) & alignBytesMask;
  266|     28|    assert(ZSTD_isPower2(alignBytes));
  ------------------
  |  |   70|     28|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  267|     28|    assert(bytes < alignBytes);
  ------------------
  |  |   70|     28|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  268|     28|    return bytes;
  269|     28|}
zstd_compress.c:ZSTD_cwksp_reserve_failed:
  718|  8.72k|MEM_STATIC int ZSTD_cwksp_reserve_failed(const ZSTD_cwksp* ws) {
  719|  8.72k|    return ws->allocFailed;
  720|  8.72k|}
zstd_compress.c:ZSTD_cwksp_clean_tables:
  586|  4.36k|MEM_STATIC void ZSTD_cwksp_clean_tables(ZSTD_cwksp* ws) {
  587|  4.36k|    DEBUGLOG(4, "cwksp: ZSTD_cwksp_clean_tables");
  ------------------
  |  |  104|  4.36k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 4.36k]
  |  |  ------------------
  ------------------
  588|  4.36k|    assert(ws->tableValidEnd >= ws->objectEnd);
  ------------------
  |  |   70|  4.36k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  589|  4.36k|    assert(ws->tableValidEnd <= ws->allocStart);
  ------------------
  |  |   70|  4.36k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  590|  4.36k|    if (ws->tableValidEnd < ws->tableEnd) {
  ------------------
  |  Branch (590:9): [True: 28, False: 4.33k]
  ------------------
  591|     28|        ZSTD_memset(ws->tableValidEnd, 0, (size_t)((BYTE*)ws->tableEnd - (BYTE*)ws->tableValidEnd));
  ------------------
  |  |   46|     28|# define ZSTD_memset(p,v,l) __builtin_memset((p),(v),(l))
  ------------------
  592|     28|    }
  593|  4.36k|    ZSTD_cwksp_mark_tables_clean(ws);
  594|  4.36k|}
zstd_compress.c:ZSTD_cwksp_reserve_internal:
  362|  41.3k|{
  363|  41.3k|    void* alloc;
  364|  41.3k|    if (ZSTD_isError(ZSTD_cwksp_internal_advance_phase(ws, phase)) || bytes == 0) {
  ------------------
  |  |   44|  41.3k|#define ZSTD_isError ERR_isError   /* for inlining */
  ------------------
  |  Branch (364:9): [True: 0, False: 41.3k]
  |  Branch (364:71): [True: 8.72k, False: 32.6k]
  ------------------
  365|  8.72k|        return NULL;
  366|  8.72k|    }
  367|       |
  368|       |#if ZSTD_ADDRESS_SANITIZER && !defined (ZSTD_ASAN_DONT_POISON_WORKSPACE)
  369|       |    /* over-reserve space */
  370|       |    bytes += 2 * ZSTD_CWKSP_ASAN_REDZONE_SIZE;
  371|       |#endif
  372|       |
  373|  32.6k|    alloc = ZSTD_cwksp_reserve_internal_buffer_space(ws, bytes);
  374|       |
  375|       |#if ZSTD_ADDRESS_SANITIZER && !defined (ZSTD_ASAN_DONT_POISON_WORKSPACE)
  376|       |    /* Move alloc so there's ZSTD_CWKSP_ASAN_REDZONE_SIZE unused space on
  377|       |     * either size. */
  378|       |    if (alloc) {
  379|       |        alloc = (BYTE *)alloc + ZSTD_CWKSP_ASAN_REDZONE_SIZE;
  380|       |        if (ws->isStatic == ZSTD_cwksp_dynamic_alloc) {
  381|       |            /* We need to keep the redzone poisoned while unpoisoning the bytes that
  382|       |             * are actually allocated. */
  383|       |            __asan_unpoison_memory_region(alloc, bytes - 2 * ZSTD_CWKSP_ASAN_REDZONE_SIZE);
  384|       |        }
  385|       |    }
  386|       |#endif
  387|       |
  388|  32.6k|    return alloc;
  389|  41.3k|}
zstd_compress.c:ZSTD_cwksp_reserve_internal_buffer_space:
  292|  32.6k|{
  293|  32.6k|    void* const alloc = (BYTE*)ws->allocStart - bytes;
  294|  32.6k|    void* const bottom = ws->tableEnd;
  295|  32.6k|    DEBUGLOG(5, "cwksp: reserving [0x%p]:%zd bytes; %zd bytes remaining",
  ------------------
  |  |  104|  32.6k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 32.6k]
  |  |  ------------------
  ------------------
  296|  32.6k|        alloc, bytes, ZSTD_cwksp_available_space(ws) - bytes);
  297|  32.6k|    ZSTD_cwksp_assert_internal_consistency(ws);
  298|  32.6k|    assert(alloc >= bottom);
  ------------------
  |  |   70|  32.6k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  299|  32.6k|    if (alloc < bottom) {
  ------------------
  |  Branch (299:9): [True: 0, False: 32.6k]
  ------------------
  300|      0|        DEBUGLOG(4, "cwksp: alloc failed!");
  ------------------
  |  |  104|      0|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 0]
  |  |  ------------------
  ------------------
  301|      0|        ws->allocFailed = 1;
  302|      0|        return NULL;
  303|      0|    }
  304|       |    /* the area is reserved from the end of wksp.
  305|       |     * If it overlaps with tableValidEnd, it voids guarantees on values' range */
  306|  32.6k|    if (alloc < ws->tableValidEnd) {
  ------------------
  |  Branch (306:9): [True: 0, False: 32.6k]
  ------------------
  307|      0|        ws->tableValidEnd = alloc;
  308|      0|    }
  309|  32.6k|    ws->allocStart = alloc;
  310|  32.6k|    return alloc;
  311|  32.6k|}
zstd_compress.c:ZSTD_cwksp_reserve_aligned64:
  433|  15.1k|{
  434|  15.1k|    void* const ptr = ZSTD_cwksp_reserve_internal(ws,
  435|  15.1k|                        ZSTD_cwksp_align(bytes, ZSTD_CWKSP_ALIGNMENT_BYTES),
  ------------------
  |  |   39|  15.1k|#define ZSTD_CWKSP_ALIGNMENT_BYTES 64
  ------------------
  436|  15.1k|                        ZSTD_cwksp_alloc_aligned);
  437|  15.1k|    assert(((size_t)ptr & (ZSTD_CWKSP_ALIGNMENT_BYTES-1)) == 0);
  ------------------
  |  |   70|  15.1k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  438|  15.1k|    return ptr;
  439|  15.1k|}
zstd_compress.c:ZSTD_cwksp_reserve_buffer:
  395|  26.1k|{
  396|  26.1k|    return (BYTE*)ZSTD_cwksp_reserve_internal(ws, bytes, ZSTD_cwksp_alloc_buffers);
  397|  26.1k|}
zstd_compress.c:ZSTD_cwksp_slack_space_required:
  250|  4.36k|MEM_STATIC size_t ZSTD_cwksp_slack_space_required(void) {
  251|       |    /* For alignment, the wksp will always allocate an additional 2*ZSTD_CWKSP_ALIGNMENT_BYTES
  252|       |     * bytes to align the beginning of tables section and end of buffers;
  253|       |     */
  254|  4.36k|    size_t const slackSpace = ZSTD_CWKSP_ALIGNMENT_BYTES * 2;
  ------------------
  |  |   39|  4.36k|#define ZSTD_CWKSP_ALIGNMENT_BYTES 64
  ------------------
  255|  4.36k|    return slackSpace;
  256|  4.36k|}
zstd_compress.c:ZSTD_cwksp_free:
  697|     56|MEM_STATIC void ZSTD_cwksp_free(ZSTD_cwksp* ws, ZSTD_customMem customMem) {
  698|     56|    void *ptr = ws->workspace;
  699|     56|    DEBUGLOG(4, "cwksp: freeing workspace");
  ------------------
  |  |  104|     56|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 56]
  |  |  ------------------
  ------------------
  700|       |#if ZSTD_MEMORY_SANITIZER && !defined(ZSTD_MSAN_DONT_POISON_WORKSPACE)
  701|       |    if (ptr != NULL && customMem.customFree != NULL) {
  702|       |        __msan_unpoison(ptr, ZSTD_cwksp_sizeof(ws));
  703|       |    }
  704|       |#endif
  705|     56|    ZSTD_memset(ws, 0, sizeof(ZSTD_cwksp));
  ------------------
  |  |   46|     56|# define ZSTD_memset(p,v,l) __builtin_memset((p),(v),(l))
  ------------------
  706|     56|    ZSTD_customFree(ptr, customMem);
  707|     56|}
zstd_ldm.c:ZSTD_cwksp_alloc_size:
  224|  8.72k|MEM_STATIC size_t ZSTD_cwksp_alloc_size(size_t size) {
  225|  8.72k|    if (size == 0)
  ------------------
  |  Branch (225:9): [True: 0, False: 8.72k]
  ------------------
  226|      0|        return 0;
  227|       |#if ZSTD_ADDRESS_SANITIZER && !defined (ZSTD_ASAN_DONT_POISON_WORKSPACE)
  228|       |    return size + 2 * ZSTD_CWKSP_ASAN_REDZONE_SIZE;
  229|       |#else
  230|  8.72k|    return size;
  231|  8.72k|#endif
  232|  8.72k|}

ZSTD_compressBlock_doubleFast:
  571|    192|{
  572|    192|    const U32 mls = ms->cParams.minMatch;
  573|    192|    switch(mls)
  574|    192|    {
  575|      0|    default: /* includes case 3 */
  ------------------
  |  Branch (575:5): [True: 0, False: 192]
  ------------------
  576|    192|    case 4 :
  ------------------
  |  Branch (576:5): [True: 192, False: 0]
  ------------------
  577|    192|        return ZSTD_compressBlock_doubleFast_noDict_4(ms, seqStore, rep, src, srcSize);
  578|      0|    case 5 :
  ------------------
  |  Branch (578:5): [True: 0, False: 192]
  ------------------
  579|      0|        return ZSTD_compressBlock_doubleFast_noDict_5(ms, seqStore, rep, src, srcSize);
  580|      0|    case 6 :
  ------------------
  |  Branch (580:5): [True: 0, False: 192]
  ------------------
  581|      0|        return ZSTD_compressBlock_doubleFast_noDict_6(ms, seqStore, rep, src, srcSize);
  582|      0|    case 7 :
  ------------------
  |  Branch (582:5): [True: 0, False: 192]
  ------------------
  583|      0|        return ZSTD_compressBlock_doubleFast_noDict_7(ms, seqStore, rep, src, srcSize);
  584|    192|    }
  585|    192|}
zstd_double_fast.c:ZSTD_compressBlock_doubleFast_noDict_4:
  553|    192|    {                                                                                                    \
  554|    192|        return ZSTD_compressBlock_doubleFast_##dictMode##_generic(ms, seqStore, rep, src, srcSize, mls); \
  555|    192|    }
zstd_double_fast.c:ZSTD_compressBlock_doubleFast_noDict_generic:
  108|    192|{
  109|    192|    ZSTD_compressionParameters const* cParams = &ms->cParams;
  110|    192|    U32* const hashLong = ms->hashTable;
  111|    192|    const U32 hBitsL = cParams->hashLog;
  112|    192|    U32* const hashSmall = ms->chainTable;
  113|    192|    const U32 hBitsS = cParams->chainLog;
  114|    192|    const BYTE* const base = ms->window.base;
  115|    192|    const BYTE* const istart = (const BYTE*)src;
  116|    192|    const BYTE* anchor = istart;
  117|    192|    const U32 endIndex = (U32)((size_t)(istart - base) + srcSize);
  118|       |    /* presumes that, if there is a dictionary, it must be using Attach mode */
  119|    192|    const U32 prefixLowestIndex = ZSTD_getLowestPrefixIndex(ms, endIndex, cParams->windowLog);
  120|    192|    const BYTE* const prefixLowest = base + prefixLowestIndex;
  121|    192|    const BYTE* const iend = istart + srcSize;
  122|    192|    const BYTE* const ilimit = iend - HASH_READ_SIZE;
  ------------------
  |  |   33|    192|#define HASH_READ_SIZE       8
  ------------------
  123|    192|    U32 offset_1=rep[0], offset_2=rep[1];
  124|    192|    U32 offsetSaved1 = 0, offsetSaved2 = 0;
  125|       |
  126|    192|    size_t mLength;
  127|    192|    U32 offset;
  128|    192|    U32 curr;
  129|       |
  130|       |    /* how many positions to search before increasing step size */
  131|    192|    const size_t kStepIncr = 1 << kSearchStrength;
  ------------------
  |  |   32|    192|#define kSearchStrength      8
  ------------------
  132|       |    /* the position at which to increment the step size if no match is found */
  133|    192|    const BYTE* nextStep;
  134|    192|    size_t step; /* the current step size */
  135|       |
  136|    192|    size_t hl0; /* the long hash at ip */
  137|    192|    size_t hl1; /* the long hash at ip1 */
  138|       |
  139|    192|    U32 idxl0; /* the long match index for ip */
  140|    192|    U32 idxl1; /* the long match index for ip1 */
  141|       |
  142|    192|    const BYTE* matchl0; /* the long match for ip */
  143|    192|    const BYTE* matchs0; /* the short match for ip */
  144|    192|    const BYTE* matchl1; /* the long match for ip1 */
  145|    192|    const BYTE* matchs0_safe; /* matchs0 or safe address */
  146|       |
  147|    192|    const BYTE* ip = istart; /* the current position */
  148|    192|    const BYTE* ip1; /* the next position */
  149|       |    /* Array of ~random data, should have low probability of matching data
  150|       |     * we load from here instead of from tables, if matchl0/matchl1 are
  151|       |     * invalid indices. Used to avoid unpredictable branches. */
  152|    192|    const BYTE dummy[] = {0x12,0x34,0x56,0x78,0x9a,0xbc,0xde,0xf0,0xe2,0xb4};
  153|       |
  154|    192|    DEBUGLOG(5, "ZSTD_compressBlock_doubleFast_noDict_generic");
  ------------------
  |  |  104|    192|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 192]
  |  |  ------------------
  ------------------
  155|       |
  156|       |    /* init */
  157|    192|    ip += ((ip - prefixLowest) == 0);
  158|    192|    {
  159|    192|        U32 const current = (U32)(ip - base);
  160|    192|        U32 const windowLow = ZSTD_getLowestPrefixIndex(ms, current, cParams->windowLog);
  161|    192|        U32 const maxRep = current - windowLow;
  162|    192|        if (offset_2 > maxRep) offsetSaved2 = offset_2, offset_2 = 0;
  ------------------
  |  Branch (162:13): [True: 192, False: 0]
  ------------------
  163|    192|        if (offset_1 > maxRep) offsetSaved1 = offset_1, offset_1 = 0;
  ------------------
  |  Branch (163:13): [True: 0, False: 192]
  ------------------
  164|    192|    }
  165|       |
  166|       |    /* Outer Loop: one iteration per match found and stored */
  167|    611|    while (1) {
  ------------------
  |  Branch (167:12): [True: 611, Folded]
  ------------------
  168|    611|        step = 1;
  169|    611|        nextStep = ip + kStepIncr;
  170|    611|        ip1 = ip + step;
  171|       |
  172|    611|        if (ip1 > ilimit) {
  ------------------
  |  Branch (172:13): [True: 51, False: 560]
  ------------------
  173|     51|            goto _cleanup;
  174|     51|        }
  175|       |
  176|    560|        hl0 = ZSTD_hashPtr(ip, hBitsL, 8);
  177|    560|        idxl0 = hashLong[hl0];
  178|    560|        matchl0 = base + idxl0;
  179|       |
  180|       |        /* Inner Loop: one iteration per search / position */
  181|  21.1k|        do {
  182|  21.1k|            const size_t hs0 = ZSTD_hashPtr(ip, hBitsS, mls);
  183|  21.1k|            const U32 idxs0 = hashSmall[hs0];
  184|  21.1k|            curr = (U32)(ip-base);
  185|  21.1k|            matchs0 = base + idxs0;
  186|       |
  187|  21.1k|            hashLong[hl0] = hashSmall[hs0] = curr;   /* update hash tables */
  188|       |
  189|       |            /* check noDict repcode */
  190|  21.1k|            if ((offset_1 > 0) & (MEM_read32(ip+1-offset_1) == MEM_read32(ip+1))) {
  ------------------
  |  Branch (190:17): [True: 28, False: 21.1k]
  ------------------
  191|     28|                mLength = ZSTD_count(ip+1+4, ip+1+4-offset_1, iend) + 4;
  192|     28|                ip++;
  193|     28|                ZSTD_storeSeq(seqStore, (size_t)(ip-anchor), anchor, iend, REPCODE1_TO_OFFBASE, mLength);
  ------------------
  |  |  747|     28|#define REPCODE1_TO_OFFBASE REPCODE_TO_OFFBASE(1)
  |  |  ------------------
  |  |  |  |  750|     28|#define REPCODE_TO_OFFBASE(r) (assert((r)>=1), assert((r)<=ZSTD_REP_NUM), (r)) /* accepts IDs 1,2,3 */
  |  |  |  |  ------------------
  |  |  |  |  |  |   70|     28|#    define assert(condition) ((void)0)   /* disable assert (default) */
  |  |  |  |  ------------------
  |  |  |  |               #define REPCODE_TO_OFFBASE(r) (assert((r)>=1), assert((r)<=ZSTD_REP_NUM), (r)) /* accepts IDs 1,2,3 */
  |  |  |  |  ------------------
  |  |  |  |  |  |   70|     28|#    define assert(condition) ((void)0)   /* disable assert (default) */
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  194|     28|                goto _match_stored;
  195|     28|            }
  196|       |
  197|  21.1k|            hl1 = ZSTD_hashPtr(ip1, hBitsL, 8);
  198|       |
  199|       |            /* idxl0 > prefixLowestIndex is a (somewhat) unpredictable branch.
  200|       |             * However expression below complies into conditional move. Since
  201|       |             * match is unlikely and we only *branch* on idxl0 > prefixLowestIndex
  202|       |             * if there is a match, all branches become predictable. */
  203|  21.1k|            {   const BYTE*  const matchl0_safe = ZSTD_selectAddr(idxl0, prefixLowestIndex, matchl0, &dummy[0]);
  204|       |
  205|       |                /* check prefix long match */
  206|  21.1k|                if (MEM_read64(matchl0_safe) == MEM_read64(ip) && matchl0_safe == matchl0) {
  ------------------
  |  Branch (206:21): [True: 36, False: 21.0k]
  |  Branch (206:67): [True: 36, False: 0]
  ------------------
  207|     36|                    mLength = ZSTD_count(ip+8, matchl0+8, iend) + 8;
  208|     36|                    offset = (U32)(ip-matchl0);
  209|     36|                    while (((ip>anchor) & (matchl0>prefixLowest)) && (ip[-1] == matchl0[-1])) { ip--; matchl0--; mLength++; } /* catch up */
  ------------------
  |  Branch (209:28): [True: 34, False: 2]
  |  Branch (209:70): [True: 0, False: 34]
  ------------------
  210|     36|                    goto _match_found;
  211|     36|            }   }
  212|       |
  213|  21.0k|            idxl1 = hashLong[hl1];
  214|  21.0k|            matchl1 = base + idxl1;
  215|       |
  216|       |            /* Same optimization as matchl0 above */
  217|  21.0k|            matchs0_safe = ZSTD_selectAddr(idxs0, prefixLowestIndex, matchs0, &dummy[0]);
  218|       |
  219|       |            /* check prefix short match */
  220|  21.0k|            if(MEM_read32(matchs0_safe) == MEM_read32(ip) && matchs0_safe == matchs0) {
  ------------------
  |  Branch (220:16): [True: 355, False: 20.7k]
  |  Branch (220:62): [True: 355, False: 0]
  ------------------
  221|    355|                  goto _search_next_long;
  222|    355|            }
  223|       |
  224|  20.7k|            if (ip1 >= nextStep) {
  ------------------
  |  Branch (224:17): [True: 0, False: 20.7k]
  ------------------
  225|      0|                PREFETCH_L1(ip1 + 64);
  ------------------
  |  |  149|      0|#    define PREFETCH_L1(ptr)  __builtin_prefetch((ptr), 0 /* rw==read */, 3 /* locality */)
  ------------------
  226|      0|                PREFETCH_L1(ip1 + 128);
  ------------------
  |  |  149|      0|#    define PREFETCH_L1(ptr)  __builtin_prefetch((ptr), 0 /* rw==read */, 3 /* locality */)
  ------------------
  227|      0|                step++;
  228|      0|                nextStep += kStepIncr;
  229|      0|            }
  230|  20.7k|            ip = ip1;
  231|  20.7k|            ip1 += step;
  232|       |
  233|  20.7k|            hl0 = hl1;
  234|  20.7k|            idxl0 = idxl1;
  235|  20.7k|            matchl0 = matchl1;
  236|       |    #if defined(__aarch64__)
  237|       |            PREFETCH_L1(ip+256);
  238|       |    #endif
  239|  20.7k|        } while (ip1 <= ilimit);
  ------------------
  |  Branch (239:18): [True: 20.6k, False: 141]
  ------------------
  240|       |
  241|    192|_cleanup:
  242|       |        /* If offset_1 started invalid (offsetSaved1 != 0) and became valid (offset_1 != 0),
  243|       |         * rotate saved offsets. See comment in ZSTD_compressBlock_fast_noDict for more context. */
  244|    192|        offsetSaved2 = ((offsetSaved1 != 0) && (offset_1 != 0)) ? offsetSaved1 : offsetSaved2;
  ------------------
  |  Branch (244:25): [True: 0, False: 192]
  |  Branch (244:48): [True: 0, False: 0]
  ------------------
  245|       |
  246|       |        /* save reps for next block */
  247|    192|        rep[0] = offset_1 ? offset_1 : offsetSaved1;
  ------------------
  |  Branch (247:18): [True: 192, False: 0]
  ------------------
  248|    192|        rep[1] = offset_2 ? offset_2 : offsetSaved2;
  ------------------
  |  Branch (248:18): [True: 125, False: 67]
  ------------------
  249|       |
  250|       |        /* Return the last literals size */
  251|    192|        return (size_t)(iend - anchor);
  252|       |
  253|    355|_search_next_long:
  254|       |
  255|       |        /* short match found: let's check for a longer one */
  256|    355|        mLength = ZSTD_count(ip+4, matchs0+4, iend) + 4;
  257|    355|        offset = (U32)(ip - matchs0);
  258|       |
  259|       |        /* check long match at +1 position */
  260|    355|        if ((idxl1 > prefixLowestIndex) && (MEM_read64(matchl1) == MEM_read64(ip1))) {
  ------------------
  |  Branch (260:13): [True: 93, False: 262]
  |  Branch (260:44): [True: 12, False: 81]
  ------------------
  261|     12|            size_t const l1len = ZSTD_count(ip1+8, matchl1+8, iend) + 8;
  262|     12|            if (l1len > mLength) {
  ------------------
  |  Branch (262:17): [True: 6, False: 6]
  ------------------
  263|       |                /* use the long match instead */
  264|      6|                ip = ip1;
  265|      6|                mLength = l1len;
  266|      6|                offset = (U32)(ip-matchl1);
  267|      6|                matchs0 = matchl1;
  268|      6|            }
  269|     12|        }
  270|       |
  271|    387|        while (((ip>anchor) & (matchs0>prefixLowest)) && (ip[-1] == matchs0[-1])) { ip--; matchs0--; mLength++; } /* complete backward */
  ------------------
  |  Branch (271:16): [True: 346, False: 41]
  |  Branch (271:58): [True: 32, False: 314]
  ------------------
  272|       |
  273|       |        /* fall-through */
  274|       |
  275|    391|_match_found: /* requires ip, offset, mLength */
  276|    391|        offset_2 = offset_1;
  277|    391|        offset_1 = offset;
  278|       |
  279|    391|        if (step < 4) {
  ------------------
  |  Branch (279:13): [True: 391, False: 0]
  ------------------
  280|       |            /* It is unsafe to write this value back to the hashtable when ip1 is
  281|       |             * greater than or equal to the new ip we will have after we're done
  282|       |             * processing this match. Rather than perform that test directly
  283|       |             * (ip1 >= ip + mLength), which costs speed in practice, we do a simpler
  284|       |             * more predictable test. The minmatch even if we take a short match is
  285|       |             * 4 bytes, so as long as step, the distance between ip and ip1
  286|       |             * (initially) is less than 4, we know ip1 < new ip. */
  287|    391|            hashLong[hl1] = (U32)(ip1 - base);
  288|    391|        }
  289|       |
  290|    391|        ZSTD_storeSeq(seqStore, (size_t)(ip-anchor), anchor, iend, OFFSET_TO_OFFBASE(offset), mLength);
  ------------------
  |  |  751|    391|#define OFFSET_TO_OFFBASE(o)  (assert((o)>0), o + ZSTD_REP_NUM)
  |  |  ------------------
  |  |  |  |   70|    391|#    define assert(condition) ((void)0)   /* disable assert (default) */
  |  |  ------------------
  |  |               #define OFFSET_TO_OFFBASE(o)  (assert((o)>0), o + ZSTD_REP_NUM)
  |  |  ------------------
  |  |  |  |   64|    391|#define ZSTD_REP_NUM      3                 /* number of repcodes */
  |  |  ------------------
  ------------------
  291|       |
  292|    419|_match_stored:
  293|       |        /* match found */
  294|    419|        ip += mLength;
  295|    419|        anchor = ip;
  296|       |
  297|    419|        if (ip <= ilimit) {
  ------------------
  |  Branch (297:13): [True: 371, False: 48]
  ------------------
  298|       |            /* Complementary insertion */
  299|       |            /* done after iLimit test, as candidates could be > iend-8 */
  300|    371|            {   U32 const indexToInsert = curr+2;
  301|    371|                hashLong[ZSTD_hashPtr(base+indexToInsert, hBitsL, 8)] = indexToInsert;
  302|    371|                hashLong[ZSTD_hashPtr(ip-2, hBitsL, 8)] = (U32)(ip-2-base);
  303|    371|                hashSmall[ZSTD_hashPtr(base+indexToInsert, hBitsS, mls)] = indexToInsert;
  304|    371|                hashSmall[ZSTD_hashPtr(ip-1, hBitsS, mls)] = (U32)(ip-1-base);
  305|    371|            }
  306|       |
  307|       |            /* check immediate repcode */
  308|    375|            while ( (ip <= ilimit)
  ------------------
  |  Branch (308:21): [True: 374, False: 1]
  ------------------
  309|    374|                 && ( (offset_2>0)
  ------------------
  |  Branch (309:21): [True: 4, False: 370]
  ------------------
  310|    374|                    & (MEM_read32(ip) == MEM_read32(ip - offset_2)) )) {
  311|       |                /* store sequence */
  312|      4|                size_t const rLength = ZSTD_count(ip+4, ip+4-offset_2, iend) + 4;
  313|      4|                U32 const tmpOff = offset_2; offset_2 = offset_1; offset_1 = tmpOff;  /* swap offset_2 <=> offset_1 */
  314|      4|                hashSmall[ZSTD_hashPtr(ip, hBitsS, mls)] = (U32)(ip-base);
  315|      4|                hashLong[ZSTD_hashPtr(ip, hBitsL, 8)] = (U32)(ip-base);
  316|      4|                ZSTD_storeSeq(seqStore, 0, anchor, iend, REPCODE1_TO_OFFBASE, rLength);
  ------------------
  |  |  747|      4|#define REPCODE1_TO_OFFBASE REPCODE_TO_OFFBASE(1)
  |  |  ------------------
  |  |  |  |  750|      4|#define REPCODE_TO_OFFBASE(r) (assert((r)>=1), assert((r)<=ZSTD_REP_NUM), (r)) /* accepts IDs 1,2,3 */
  |  |  |  |  ------------------
  |  |  |  |  |  |   70|      4|#    define assert(condition) ((void)0)   /* disable assert (default) */
  |  |  |  |  ------------------
  |  |  |  |               #define REPCODE_TO_OFFBASE(r) (assert((r)>=1), assert((r)<=ZSTD_REP_NUM), (r)) /* accepts IDs 1,2,3 */
  |  |  |  |  ------------------
  |  |  |  |  |  |   70|      4|#    define assert(condition) ((void)0)   /* disable assert (default) */
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  317|      4|                ip += rLength;
  318|      4|                anchor = ip;
  319|      4|                continue;   /* faster when present ... (?) */
  320|      4|            }
  321|    371|        }
  322|    419|    }
  323|    192|}

ZSTD_compressBlock_lazy:
 1875|     51|{
 1876|     51|    return ZSTD_compressBlock_lazy_generic(ms, seqStore, rep, src, srcSize, search_hashChain, 1, ZSTD_noDict);
 1877|     51|}
ZSTD_compressBlock_lazy2:
 1919|  1.56k|{
 1920|  1.56k|    return ZSTD_compressBlock_lazy_generic(ms, seqStore, rep, src, srcSize, search_hashChain, 2, ZSTD_noDict);
 1921|  1.56k|}
ZSTD_compressBlock_btlazy2:
 1963|    746|{
 1964|    746|    return ZSTD_compressBlock_lazy_generic(ms, seqStore, rep, src, srcSize, search_binaryTree, 2, ZSTD_noDict);
 1965|    746|}
zstd_lazy.c:ZSTD_insertAndFindFirstIndex_internal:
  636|   174k|{
  637|   174k|    U32* const hashTable  = ms->hashTable;
  638|   174k|    const U32 hashLog = cParams->hashLog;
  639|   174k|    U32* const chainTable = ms->chainTable;
  640|   174k|    const U32 chainMask = (1 << cParams->chainLog) - 1;
  641|   174k|    const BYTE* const base = ms->window.base;
  642|   174k|    const U32 target = (U32)(ip - base);
  643|   174k|    U32 idx = ms->nextToUpdate;
  644|       |
  645|   359k|    while(idx < target) { /* catch up */
  ------------------
  |  Branch (645:11): [True: 184k, False: 174k]
  ------------------
  646|   184k|        size_t const h = ZSTD_hashPtr(base+idx, hashLog, mls);
  647|   184k|        NEXT_IN_CHAIN(idx, chainMask) = hashTable[h];
  ------------------
  |  |  626|   184k|#define NEXT_IN_CHAIN(d, mask)   chainTable[(d) & (mask)]
  ------------------
  648|   184k|        hashTable[h] = idx;
  649|   184k|        idx++;
  650|       |        /* Stop inserting every position when in the lazy skipping mode. */
  651|   184k|        if (lazySkipping)
  ------------------
  |  Branch (651:13): [True: 0, False: 184k]
  ------------------
  652|      0|            break;
  653|   184k|    }
  654|       |
  655|   174k|    ms->nextToUpdate = target;
  656|   174k|    return hashTable[ZSTD_hashPtr(ip, hashLog, mls)];
  657|   174k|}
zstd_lazy.c:ZSTD_compressBlock_lazy_generic:
 1566|  2.36k|{
 1567|  2.36k|    const BYTE* const istart = (const BYTE*)src;
 1568|  2.36k|    const BYTE* ip = istart;
 1569|  2.36k|    const BYTE* anchor = istart;
 1570|  2.36k|    const BYTE* const iend = istart + srcSize;
 1571|  2.36k|    const BYTE* const ilimit = (searchMethod == search_rowHash) ? iend - 8 - ZSTD_ROW_HASH_CACHE_SIZE : iend - 8;
  ------------------
  |  |  274|      0|#define ZSTD_ROW_HASH_CACHE_SIZE 8       /* Size of prefetching hash cache for row-based matchfinder */
  ------------------
  |  Branch (1571:32): [True: 0, False: 2.36k]
  ------------------
 1572|  2.36k|    const BYTE* const base = ms->window.base;
 1573|  2.36k|    const U32 prefixLowestIndex = ms->window.dictLimit;
 1574|  2.36k|    const BYTE* const prefixLowest = base + prefixLowestIndex;
 1575|  2.36k|    const U32 mls = BOUNDED(4, ms->cParams.minMatch, 6);
  ------------------
  |  |   56|  2.36k|#define BOUNDED(min,val,max) (MAX(min,MIN(val,max)))
  |  |  ------------------
  |  |  |  |   55|  4.72k|#define MAX(a,b) ((a)>(b) ? (a) : (b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (55:19): [True: 0, False: 2.36k]
  |  |  |  |  |  Branch (55:24): [True: 2.36k, False: 0]
  |  |  |  |  |  Branch (55:36): [True: 2.36k, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1576|  2.36k|    const U32 rowLog = BOUNDED(4, ms->cParams.searchLog, 6);
  ------------------
  |  |   56|  2.36k|#define BOUNDED(min,val,max) (MAX(min,MIN(val,max)))
  |  |  ------------------
  |  |  |  |   55|  4.72k|#define MAX(a,b) ((a)>(b) ? (a) : (b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (55:19): [True: 51, False: 2.31k]
  |  |  |  |  |  Branch (55:24): [True: 797, False: 1.56k]
  |  |  |  |  |  Branch (55:36): [True: 746, False: 1.56k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1577|       |
 1578|  2.36k|    U32 offset_1 = rep[0], offset_2 = rep[1];
 1579|  2.36k|    U32 offsetSaved1 = 0, offsetSaved2 = 0;
 1580|       |
 1581|  2.36k|    const int isDMS = dictMode == ZSTD_dictMatchState;
 1582|  2.36k|    const int isDDS = dictMode == ZSTD_dedicatedDictSearch;
 1583|  2.36k|    const int isDxS = isDMS || isDDS;
  ------------------
  |  Branch (1583:23): [True: 0, False: 2.36k]
  |  Branch (1583:32): [True: 0, False: 2.36k]
  ------------------
 1584|  2.36k|    const ZSTD_MatchState_t* const dms = ms->dictMatchState;
 1585|  2.36k|    const U32 dictLowestIndex      = isDxS ? dms->window.dictLimit : 0;
  ------------------
  |  Branch (1585:38): [True: 0, False: 2.36k]
  ------------------
 1586|  2.36k|    const BYTE* const dictBase     = isDxS ? dms->window.base : NULL;
  ------------------
  |  Branch (1586:38): [True: 0, False: 2.36k]
  ------------------
 1587|  2.36k|    const BYTE* const dictLowest   = isDxS ? dictBase + dictLowestIndex : NULL;
  ------------------
  |  Branch (1587:38): [True: 0, False: 2.36k]
  ------------------
 1588|  2.36k|    const BYTE* const dictEnd      = isDxS ? dms->window.nextSrc : NULL;
  ------------------
  |  Branch (1588:38): [True: 0, False: 2.36k]
  ------------------
 1589|  2.36k|    const U32 dictIndexDelta       = isDxS ?
  ------------------
  |  Branch (1589:38): [True: 0, False: 2.36k]
  ------------------
 1590|      0|                                     prefixLowestIndex - (U32)(dictEnd - dictBase) :
 1591|  2.36k|                                     0;
 1592|  2.36k|    const U32 dictAndPrefixLength = (U32)((ip - prefixLowest) + (dictEnd - dictLowest));
 1593|       |
 1594|  2.36k|    DEBUGLOG(5, "ZSTD_compressBlock_lazy_generic (dictMode=%u) (searchFunc=%u)", (U32)dictMode, (U32)searchMethod);
  ------------------
  |  |  104|  2.36k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 2.36k]
  |  |  ------------------
  ------------------
 1595|  2.36k|    ip += (dictAndPrefixLength == 0);
 1596|  2.36k|    if (dictMode == ZSTD_noDict) {
  ------------------
  |  Branch (1596:9): [True: 2.36k, False: 0]
  ------------------
 1597|  2.36k|        U32 const curr = (U32)(ip - base);
 1598|  2.36k|        U32 const windowLow = ZSTD_getLowestPrefixIndex(ms, curr, ms->cParams.windowLog);
 1599|  2.36k|        U32 const maxRep = curr - windowLow;
 1600|  2.36k|        if (offset_2 > maxRep) offsetSaved2 = offset_2, offset_2 = 0;
  ------------------
  |  Branch (1600:13): [True: 2.36k, False: 0]
  ------------------
 1601|  2.36k|        if (offset_1 > maxRep) offsetSaved1 = offset_1, offset_1 = 0;
  ------------------
  |  Branch (1601:13): [True: 0, False: 2.36k]
  ------------------
 1602|  2.36k|    }
 1603|  2.36k|    if (isDxS) {
  ------------------
  |  Branch (1603:9): [True: 0, False: 2.36k]
  ------------------
 1604|       |        /* Dictionary repcodes are validated when the CDict is attached.
 1605|       |         * dictMatchState repCode checks don't handle repCode == 0 disabling. */
 1606|      0|        assert(offset_1 <= dictAndPrefixLength);
  ------------------
  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1607|      0|        assert(offset_2 <= dictAndPrefixLength);
  ------------------
  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1608|      0|    }
 1609|       |
 1610|       |    /* Reset the lazy skipping state */
 1611|  2.36k|    ms->lazySkipping = 0;
 1612|       |
 1613|  2.36k|    if (searchMethod == search_rowHash) {
  ------------------
  |  Branch (1613:9): [True: 0, False: 2.36k]
  ------------------
 1614|      0|        ZSTD_row_fillHashCache(ms, base, rowLog, mls, ms->nextToUpdate, ilimit);
 1615|      0|    }
 1616|       |
 1617|       |    /* Match Loop */
 1618|  2.36k|#if defined(__GNUC__) && defined(__x86_64__)
 1619|       |    /* I've measured random a 5% speed loss on levels 5 & 6 (greedy) when the
 1620|       |     * code alignment is perturbed. To fix the instability align the loop on 32-bytes.
 1621|       |     */
 1622|  2.36k|    __asm__(".p2align 5");
 1623|  2.36k|#endif
 1624|   189k|    while (ip < ilimit) {
  ------------------
  |  Branch (1624:12): [True: 187k, False: 2.36k]
  ------------------
 1625|   187k|        size_t matchLength=0;
 1626|   187k|        size_t offBase = REPCODE1_TO_OFFBASE;
  ------------------
  |  |  747|   187k|#define REPCODE1_TO_OFFBASE REPCODE_TO_OFFBASE(1)
  |  |  ------------------
  |  |  |  |  750|   187k|#define REPCODE_TO_OFFBASE(r) (assert((r)>=1), assert((r)<=ZSTD_REP_NUM), (r)) /* accepts IDs 1,2,3 */
  |  |  |  |  ------------------
  |  |  |  |  |  |   70|   187k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  |  |  |  |  ------------------
  |  |  |  |               #define REPCODE_TO_OFFBASE(r) (assert((r)>=1), assert((r)<=ZSTD_REP_NUM), (r)) /* accepts IDs 1,2,3 */
  |  |  |  |  ------------------
  |  |  |  |  |  |   70|   187k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1627|   187k|        const BYTE* start=ip+1;
 1628|   187k|        DEBUGLOG(7, "search baseline (depth 0)");
  ------------------
  |  |  104|   187k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 187k]
  |  |  ------------------
  ------------------
 1629|       |
 1630|       |        /* check repCode */
 1631|   187k|        if (isDxS) {
  ------------------
  |  Branch (1631:13): [True: 0, False: 187k]
  ------------------
 1632|      0|            const U32 repIndex = (U32)(ip - base) + 1 - offset_1;
 1633|      0|            const BYTE* repMatch = ((dictMode == ZSTD_dictMatchState || dictMode == ZSTD_dedicatedDictSearch)
  ------------------
  |  Branch (1633:38): [True: 0, False: 0]
  |  Branch (1633:73): [True: 0, False: 0]
  ------------------
 1634|      0|                                && repIndex < prefixLowestIndex) ?
  ------------------
  |  Branch (1634:36): [True: 0, False: 0]
  ------------------
 1635|      0|                                   dictBase + (repIndex - dictIndexDelta) :
 1636|      0|                                   base + repIndex;
 1637|      0|            if ((ZSTD_index_overlap_check(prefixLowestIndex, repIndex))
  ------------------
  |  Branch (1637:17): [True: 0, False: 0]
  ------------------
 1638|      0|                && (MEM_read32(repMatch) == MEM_read32(ip+1)) ) {
  ------------------
  |  Branch (1638:20): [True: 0, False: 0]
  ------------------
 1639|      0|                const BYTE* repMatchEnd = repIndex < prefixLowestIndex ? dictEnd : iend;
  ------------------
  |  Branch (1639:43): [True: 0, False: 0]
  ------------------
 1640|      0|                matchLength = ZSTD_count_2segments(ip+1+4, repMatch+4, iend, repMatchEnd, prefixLowest) + 4;
 1641|      0|                if (depth==0) goto _storeSequence;
  ------------------
  |  Branch (1641:21): [True: 0, False: 0]
  ------------------
 1642|      0|            }
 1643|      0|        }
 1644|   187k|        if ( dictMode == ZSTD_noDict
  ------------------
  |  Branch (1644:14): [True: 187k, False: 0]
  ------------------
 1645|   187k|          && ((offset_1 > 0) & (MEM_read32(ip+1-offset_1) == MEM_read32(ip+1)))) {
  ------------------
  |  Branch (1645:14): [True: 3.09k, False: 184k]
  ------------------
 1646|  3.09k|            matchLength = ZSTD_count(ip+1+4, ip+1+4-offset_1, iend) + 4;
 1647|  3.09k|            if (depth==0) goto _storeSequence;
  ------------------
  |  Branch (1647:17): [True: 0, False: 3.09k]
  ------------------
 1648|  3.09k|        }
 1649|       |
 1650|       |        /* first search (depth 0) */
 1651|   187k|        {   size_t offbaseFound = 999999999;
 1652|   187k|            size_t const ml2 = ZSTD_searchMax(ms, ip, iend, &offbaseFound, mls, rowLog, searchMethod, dictMode);
 1653|   187k|            if (ml2 > matchLength)
  ------------------
  |  Branch (1653:17): [True: 165k, False: 21.7k]
  ------------------
 1654|   165k|                matchLength = ml2, start = ip, offBase = offbaseFound;
 1655|   187k|        }
 1656|       |
 1657|   187k|        if (matchLength < 4) {
  ------------------
  |  Branch (1657:13): [True: 178k, False: 9.18k]
  ------------------
 1658|   178k|            size_t const step = ((size_t)(ip-anchor) >> kSearchStrength) + 1;   /* jump faster over incompressible sections */;
  ------------------
  |  |   32|   178k|#define kSearchStrength      8
  ------------------
 1659|   178k|            ip += step;
 1660|       |            /* Enter the lazy skipping mode once we are skipping more than 8 bytes at a time.
 1661|       |             * In this mode we stop inserting every position into our tables, and only insert
 1662|       |             * positions that we search, which is one in step positions.
 1663|       |             * The exact cutoff is flexible, I've just chosen a number that is reasonably high,
 1664|       |             * so we minimize the compression ratio loss in "normal" scenarios. This mode gets
 1665|       |             * triggered once we've gone 2KB without finding any matches.
 1666|       |             */
 1667|   178k|            ms->lazySkipping = step > kLazySkippingStep;
  ------------------
  |  |   20|   178k|#define kLazySkippingStep 8
  ------------------
 1668|   178k|            continue;
 1669|   178k|        }
 1670|       |
 1671|       |        /* let's try to find a better solution */
 1672|  9.18k|        if (depth>=1)
  ------------------
  |  Branch (1672:13): [True: 9.18k, False: 0]
  ------------------
 1673|  9.97k|        while (ip<ilimit) {
  ------------------
  |  Branch (1673:16): [True: 9.96k, False: 11]
  ------------------
 1674|  9.96k|            DEBUGLOG(7, "search depth 1");
  ------------------
  |  |  104|  9.96k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 9.96k]
  |  |  ------------------
  ------------------
 1675|  9.96k|            ip ++;
 1676|  9.96k|            if ( (dictMode == ZSTD_noDict)
  ------------------
  |  Branch (1676:18): [True: 9.96k, False: 0]
  ------------------
 1677|  9.96k|              && (offBase) && ((offset_1>0) & (MEM_read32(ip) == MEM_read32(ip - offset_1)))) {
  ------------------
  |  Branch (1677:18): [True: 9.96k, False: 0]
  |  Branch (1677:31): [True: 3.69k, False: 6.26k]
  ------------------
 1678|  3.69k|                size_t const mlRep = ZSTD_count(ip+4, ip+4-offset_1, iend) + 4;
 1679|  3.69k|                int const gain2 = (int)(mlRep * 3);
 1680|  3.69k|                int const gain1 = (int)(matchLength*3 - ZSTD_highbit32((U32)offBase) + 1);
 1681|  3.69k|                if ((mlRep >= 4) && (gain2 > gain1))
  ------------------
  |  Branch (1681:21): [True: 3.69k, False: 0]
  |  Branch (1681:37): [True: 87, False: 3.60k]
  ------------------
 1682|     87|                    matchLength = mlRep, offBase = REPCODE1_TO_OFFBASE, start = ip;
  ------------------
  |  |  747|     87|#define REPCODE1_TO_OFFBASE REPCODE_TO_OFFBASE(1)
  |  |  ------------------
  |  |  |  |  750|     87|#define REPCODE_TO_OFFBASE(r) (assert((r)>=1), assert((r)<=ZSTD_REP_NUM), (r)) /* accepts IDs 1,2,3 */
  |  |  |  |  ------------------
  |  |  |  |  |  |   70|     87|#    define assert(condition) ((void)0)   /* disable assert (default) */
  |  |  |  |  ------------------
  |  |  |  |               #define REPCODE_TO_OFFBASE(r) (assert((r)>=1), assert((r)<=ZSTD_REP_NUM), (r)) /* accepts IDs 1,2,3 */
  |  |  |  |  ------------------
  |  |  |  |  |  |   70|     87|#    define assert(condition) ((void)0)   /* disable assert (default) */
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1683|  3.69k|            }
 1684|  9.96k|            if (isDxS) {
  ------------------
  |  Branch (1684:17): [True: 0, False: 9.96k]
  ------------------
 1685|      0|                const U32 repIndex = (U32)(ip - base) - offset_1;
 1686|      0|                const BYTE* repMatch = repIndex < prefixLowestIndex ?
  ------------------
  |  Branch (1686:40): [True: 0, False: 0]
  ------------------
 1687|      0|                               dictBase + (repIndex - dictIndexDelta) :
 1688|      0|                               base + repIndex;
 1689|      0|                if ((ZSTD_index_overlap_check(prefixLowestIndex, repIndex))
  ------------------
  |  Branch (1689:21): [True: 0, False: 0]
  ------------------
 1690|      0|                    && (MEM_read32(repMatch) == MEM_read32(ip)) ) {
  ------------------
  |  Branch (1690:24): [True: 0, False: 0]
  ------------------
 1691|      0|                    const BYTE* repMatchEnd = repIndex < prefixLowestIndex ? dictEnd : iend;
  ------------------
  |  Branch (1691:47): [True: 0, False: 0]
  ------------------
 1692|      0|                    size_t const mlRep = ZSTD_count_2segments(ip+4, repMatch+4, iend, repMatchEnd, prefixLowest) + 4;
 1693|      0|                    int const gain2 = (int)(mlRep * 3);
 1694|      0|                    int const gain1 = (int)(matchLength*3 - ZSTD_highbit32((U32)offBase) + 1);
 1695|      0|                    if ((mlRep >= 4) && (gain2 > gain1))
  ------------------
  |  Branch (1695:25): [True: 0, False: 0]
  |  Branch (1695:41): [True: 0, False: 0]
  ------------------
 1696|      0|                        matchLength = mlRep, offBase = REPCODE1_TO_OFFBASE, start = ip;
  ------------------
  |  |  747|      0|#define REPCODE1_TO_OFFBASE REPCODE_TO_OFFBASE(1)
  |  |  ------------------
  |  |  |  |  750|      0|#define REPCODE_TO_OFFBASE(r) (assert((r)>=1), assert((r)<=ZSTD_REP_NUM), (r)) /* accepts IDs 1,2,3 */
  |  |  |  |  ------------------
  |  |  |  |  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  |  |  |  |  ------------------
  |  |  |  |               #define REPCODE_TO_OFFBASE(r) (assert((r)>=1), assert((r)<=ZSTD_REP_NUM), (r)) /* accepts IDs 1,2,3 */
  |  |  |  |  ------------------
  |  |  |  |  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1697|      0|                }
 1698|      0|            }
 1699|  9.96k|            {   size_t ofbCandidate=999999999;
 1700|  9.96k|                size_t const ml2 = ZSTD_searchMax(ms, ip, iend, &ofbCandidate, mls, rowLog, searchMethod, dictMode);
 1701|  9.96k|                int const gain2 = (int)(ml2*4 - ZSTD_highbit32((U32)ofbCandidate));   /* raw approx */
 1702|  9.96k|                int const gain1 = (int)(matchLength*4 - ZSTD_highbit32((U32)offBase) + 4);
 1703|  9.96k|                if ((ml2 >= 4) && (gain2 > gain1)) {
  ------------------
  |  Branch (1703:21): [True: 5.69k, False: 4.26k]
  |  Branch (1703:35): [True: 686, False: 5.01k]
  ------------------
 1704|    686|                    matchLength = ml2, offBase = ofbCandidate, start = ip;
 1705|    686|                    continue;   /* search a better one */
 1706|    686|            }   }
 1707|       |
 1708|       |            /* let's find an even better one */
 1709|  9.27k|            if ((depth==2) && (ip<ilimit)) {
  ------------------
  |  Branch (1709:17): [True: 9.18k, False: 95]
  |  Branch (1709:31): [True: 9.07k, False: 107]
  ------------------
 1710|  9.07k|                DEBUGLOG(7, "search depth 2");
  ------------------
  |  |  104|  9.07k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 9.07k]
  |  |  ------------------
  ------------------
 1711|  9.07k|                ip ++;
 1712|  9.07k|                if ( (dictMode == ZSTD_noDict)
  ------------------
  |  Branch (1712:22): [True: 9.07k, False: 0]
  ------------------
 1713|  9.07k|                  && (offBase) && ((offset_1>0) & (MEM_read32(ip) == MEM_read32(ip - offset_1)))) {
  ------------------
  |  Branch (1713:22): [True: 9.07k, False: 0]
  |  Branch (1713:35): [True: 2.58k, False: 6.48k]
  ------------------
 1714|  2.58k|                    size_t const mlRep = ZSTD_count(ip+4, ip+4-offset_1, iend) + 4;
 1715|  2.58k|                    int const gain2 = (int)(mlRep * 4);
 1716|  2.58k|                    int const gain1 = (int)(matchLength*4 - ZSTD_highbit32((U32)offBase) + 1);
 1717|  2.58k|                    if ((mlRep >= 4) && (gain2 > gain1))
  ------------------
  |  Branch (1717:25): [True: 2.58k, False: 0]
  |  Branch (1717:41): [True: 113, False: 2.47k]
  ------------------
 1718|    113|                        matchLength = mlRep, offBase = REPCODE1_TO_OFFBASE, start = ip;
  ------------------
  |  |  747|    113|#define REPCODE1_TO_OFFBASE REPCODE_TO_OFFBASE(1)
  |  |  ------------------
  |  |  |  |  750|    113|#define REPCODE_TO_OFFBASE(r) (assert((r)>=1), assert((r)<=ZSTD_REP_NUM), (r)) /* accepts IDs 1,2,3 */
  |  |  |  |  ------------------
  |  |  |  |  |  |   70|    113|#    define assert(condition) ((void)0)   /* disable assert (default) */
  |  |  |  |  ------------------
  |  |  |  |               #define REPCODE_TO_OFFBASE(r) (assert((r)>=1), assert((r)<=ZSTD_REP_NUM), (r)) /* accepts IDs 1,2,3 */
  |  |  |  |  ------------------
  |  |  |  |  |  |   70|    113|#    define assert(condition) ((void)0)   /* disable assert (default) */
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1719|  2.58k|                }
 1720|  9.07k|                if (isDxS) {
  ------------------
  |  Branch (1720:21): [True: 0, False: 9.07k]
  ------------------
 1721|      0|                    const U32 repIndex = (U32)(ip - base) - offset_1;
 1722|      0|                    const BYTE* repMatch = repIndex < prefixLowestIndex ?
  ------------------
  |  Branch (1722:44): [True: 0, False: 0]
  ------------------
 1723|      0|                                   dictBase + (repIndex - dictIndexDelta) :
 1724|      0|                                   base + repIndex;
 1725|      0|                    if ((ZSTD_index_overlap_check(prefixLowestIndex, repIndex))
  ------------------
  |  Branch (1725:25): [True: 0, False: 0]
  ------------------
 1726|      0|                        && (MEM_read32(repMatch) == MEM_read32(ip)) ) {
  ------------------
  |  Branch (1726:28): [True: 0, False: 0]
  ------------------
 1727|      0|                        const BYTE* repMatchEnd = repIndex < prefixLowestIndex ? dictEnd : iend;
  ------------------
  |  Branch (1727:51): [True: 0, False: 0]
  ------------------
 1728|      0|                        size_t const mlRep = ZSTD_count_2segments(ip+4, repMatch+4, iend, repMatchEnd, prefixLowest) + 4;
 1729|      0|                        int const gain2 = (int)(mlRep * 4);
 1730|      0|                        int const gain1 = (int)(matchLength*4 - ZSTD_highbit32((U32)offBase) + 1);
 1731|      0|                        if ((mlRep >= 4) && (gain2 > gain1))
  ------------------
  |  Branch (1731:29): [True: 0, False: 0]
  |  Branch (1731:45): [True: 0, False: 0]
  ------------------
 1732|      0|                            matchLength = mlRep, offBase = REPCODE1_TO_OFFBASE, start = ip;
  ------------------
  |  |  747|      0|#define REPCODE1_TO_OFFBASE REPCODE_TO_OFFBASE(1)
  |  |  ------------------
  |  |  |  |  750|      0|#define REPCODE_TO_OFFBASE(r) (assert((r)>=1), assert((r)<=ZSTD_REP_NUM), (r)) /* accepts IDs 1,2,3 */
  |  |  |  |  ------------------
  |  |  |  |  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  |  |  |  |  ------------------
  |  |  |  |               #define REPCODE_TO_OFFBASE(r) (assert((r)>=1), assert((r)<=ZSTD_REP_NUM), (r)) /* accepts IDs 1,2,3 */
  |  |  |  |  ------------------
  |  |  |  |  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1733|      0|                    }
 1734|      0|                }
 1735|  9.07k|                {   size_t ofbCandidate=999999999;
 1736|  9.07k|                    size_t const ml2 = ZSTD_searchMax(ms, ip, iend, &ofbCandidate, mls, rowLog, searchMethod, dictMode);
 1737|  9.07k|                    int const gain2 = (int)(ml2*4 - ZSTD_highbit32((U32)ofbCandidate));   /* raw approx */
 1738|  9.07k|                    int const gain1 = (int)(matchLength*4 - ZSTD_highbit32((U32)offBase) + 7);
 1739|  9.07k|                    if ((ml2 >= 4) && (gain2 > gain1)) {
  ------------------
  |  Branch (1739:25): [True: 4.18k, False: 4.89k]
  |  Branch (1739:39): [True: 106, False: 4.07k]
  ------------------
 1740|    106|                        matchLength = ml2, offBase = ofbCandidate, start = ip;
 1741|    106|                        continue;
 1742|    106|            }   }   }
 1743|  9.17k|            break;  /* nothing found : store previous solution */
 1744|  9.27k|        }
 1745|       |
 1746|       |        /* NOTE:
 1747|       |         * Pay attention that `start[-value]` can lead to strange undefined behavior
 1748|       |         * notably if `value` is unsigned, resulting in a large positive `-value`.
 1749|       |         */
 1750|       |        /* catch up */
 1751|  9.18k|        if (OFFBASE_IS_OFFSET(offBase)) {
  ------------------
  |  |  752|  9.18k|#define OFFBASE_IS_OFFSET(o)  ((o) > ZSTD_REP_NUM)
  |  |  ------------------
  |  |  |  |   64|  9.18k|#define ZSTD_REP_NUM      3                 /* number of repcodes */
  |  |  ------------------
  |  |  |  Branch (752:31): [True: 7.04k, False: 2.14k]
  |  |  ------------------
  ------------------
 1752|  7.04k|            if (dictMode == ZSTD_noDict) {
  ------------------
  |  Branch (1752:17): [True: 7.04k, False: 0]
  ------------------
 1753|  7.39k|                while ( ((start > anchor) & (start - OFFBASE_TO_OFFSET(offBase) > prefixLowest))
  ------------------
  |  |  754|  7.39k|#define OFFBASE_TO_OFFSET(o)  (assert(OFFBASE_IS_OFFSET(o)), (o) - ZSTD_REP_NUM)
  |  |  ------------------
  |  |  |  |   70|  7.39k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  |  |  ------------------
  |  |               #define OFFBASE_TO_OFFSET(o)  (assert(OFFBASE_IS_OFFSET(o)), (o) - ZSTD_REP_NUM)
  |  |  ------------------
  |  |  |  |   64|  7.39k|#define ZSTD_REP_NUM      3                 /* number of repcodes */
  |  |  ------------------
  ------------------
  |  Branch (1753:25): [True: 5.44k, False: 1.94k]
  ------------------
 1754|  5.44k|                     && (start[-1] == (start-OFFBASE_TO_OFFSET(offBase))[-1]) )  /* only search for offset within prefix */
  ------------------
  |  |  754|  5.44k|#define OFFBASE_TO_OFFSET(o)  (assert(OFFBASE_IS_OFFSET(o)), (o) - ZSTD_REP_NUM)
  |  |  ------------------
  |  |  |  |   70|  5.44k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  |  |  ------------------
  |  |               #define OFFBASE_TO_OFFSET(o)  (assert(OFFBASE_IS_OFFSET(o)), (o) - ZSTD_REP_NUM)
  |  |  ------------------
  |  |  |  |   64|  5.44k|#define ZSTD_REP_NUM      3                 /* number of repcodes */
  |  |  ------------------
  ------------------
  |  Branch (1754:25): [True: 350, False: 5.09k]
  ------------------
 1755|    350|                    { start--; matchLength++; }
 1756|  7.04k|            }
 1757|  7.04k|            if (isDxS) {
  ------------------
  |  Branch (1757:17): [True: 0, False: 7.04k]
  ------------------
 1758|      0|                U32 const matchIndex = (U32)((size_t)(start-base) - OFFBASE_TO_OFFSET(offBase));
  ------------------
  |  |  754|      0|#define OFFBASE_TO_OFFSET(o)  (assert(OFFBASE_IS_OFFSET(o)), (o) - ZSTD_REP_NUM)
  |  |  ------------------
  |  |  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  |  |  ------------------
  |  |               #define OFFBASE_TO_OFFSET(o)  (assert(OFFBASE_IS_OFFSET(o)), (o) - ZSTD_REP_NUM)
  |  |  ------------------
  |  |  |  |   64|      0|#define ZSTD_REP_NUM      3                 /* number of repcodes */
  |  |  ------------------
  ------------------
 1759|      0|                const BYTE* match = (matchIndex < prefixLowestIndex) ? dictBase + matchIndex - dictIndexDelta : base + matchIndex;
  ------------------
  |  Branch (1759:37): [True: 0, False: 0]
  ------------------
 1760|      0|                const BYTE* const mStart = (matchIndex < prefixLowestIndex) ? dictLowest : prefixLowest;
  ------------------
  |  Branch (1760:44): [True: 0, False: 0]
  ------------------
 1761|      0|                while ((start>anchor) && (match>mStart) && (start[-1] == match[-1])) { start--; match--; matchLength++; }  /* catch up */
  ------------------
  |  Branch (1761:24): [True: 0, False: 0]
  |  Branch (1761:42): [True: 0, False: 0]
  |  Branch (1761:60): [True: 0, False: 0]
  ------------------
 1762|      0|            }
 1763|  7.04k|            offset_2 = offset_1; offset_1 = (U32)OFFBASE_TO_OFFSET(offBase);
  ------------------
  |  |  754|  7.04k|#define OFFBASE_TO_OFFSET(o)  (assert(OFFBASE_IS_OFFSET(o)), (o) - ZSTD_REP_NUM)
  |  |  ------------------
  |  |  |  |   70|  7.04k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  |  |  ------------------
  |  |               #define OFFBASE_TO_OFFSET(o)  (assert(OFFBASE_IS_OFFSET(o)), (o) - ZSTD_REP_NUM)
  |  |  ------------------
  |  |  |  |   64|  7.04k|#define ZSTD_REP_NUM      3                 /* number of repcodes */
  |  |  ------------------
  ------------------
 1764|  7.04k|        }
 1765|       |        /* store sequence */
 1766|  9.18k|_storeSequence:
 1767|  9.18k|        {   size_t const litLength = (size_t)(start - anchor);
 1768|  9.18k|            ZSTD_storeSeq(seqStore, litLength, anchor, iend, (U32)offBase, matchLength);
 1769|  9.18k|            anchor = ip = start + matchLength;
 1770|  9.18k|        }
 1771|  9.18k|        if (ms->lazySkipping) {
  ------------------
  |  Branch (1771:13): [True: 0, False: 9.18k]
  ------------------
 1772|       |            /* We've found a match, disable lazy skipping mode, and refill the hash cache. */
 1773|      0|            if (searchMethod == search_rowHash) {
  ------------------
  |  Branch (1773:17): [True: 0, False: 0]
  ------------------
 1774|      0|                ZSTD_row_fillHashCache(ms, base, rowLog, mls, ms->nextToUpdate, ilimit);
 1775|      0|            }
 1776|      0|            ms->lazySkipping = 0;
 1777|      0|        }
 1778|       |
 1779|       |        /* check immediate repcode */
 1780|  9.18k|        if (isDxS) {
  ------------------
  |  Branch (1780:13): [True: 0, False: 9.18k]
  ------------------
 1781|      0|            while (ip <= ilimit) {
  ------------------
  |  Branch (1781:20): [True: 0, False: 0]
  ------------------
 1782|      0|                U32 const current2 = (U32)(ip-base);
 1783|      0|                U32 const repIndex = current2 - offset_2;
 1784|      0|                const BYTE* repMatch = repIndex < prefixLowestIndex ?
  ------------------
  |  Branch (1784:40): [True: 0, False: 0]
  ------------------
 1785|      0|                        dictBase - dictIndexDelta + repIndex :
 1786|      0|                        base + repIndex;
 1787|      0|                if ( (ZSTD_index_overlap_check(prefixLowestIndex, repIndex))
  ------------------
  |  Branch (1787:22): [True: 0, False: 0]
  ------------------
 1788|      0|                   && (MEM_read32(repMatch) == MEM_read32(ip)) ) {
  ------------------
  |  Branch (1788:23): [True: 0, False: 0]
  ------------------
 1789|      0|                    const BYTE* const repEnd2 = repIndex < prefixLowestIndex ? dictEnd : iend;
  ------------------
  |  Branch (1789:49): [True: 0, False: 0]
  ------------------
 1790|      0|                    matchLength = ZSTD_count_2segments(ip+4, repMatch+4, iend, repEnd2, prefixLowest) + 4;
 1791|      0|                    offBase = offset_2; offset_2 = offset_1; offset_1 = (U32)offBase;   /* swap offset_2 <=> offset_1 */
 1792|      0|                    ZSTD_storeSeq(seqStore, 0, anchor, iend, REPCODE1_TO_OFFBASE, matchLength);
  ------------------
  |  |  747|      0|#define REPCODE1_TO_OFFBASE REPCODE_TO_OFFBASE(1)
  |  |  ------------------
  |  |  |  |  750|      0|#define REPCODE_TO_OFFBASE(r) (assert((r)>=1), assert((r)<=ZSTD_REP_NUM), (r)) /* accepts IDs 1,2,3 */
  |  |  |  |  ------------------
  |  |  |  |  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  |  |  |  |  ------------------
  |  |  |  |               #define REPCODE_TO_OFFBASE(r) (assert((r)>=1), assert((r)<=ZSTD_REP_NUM), (r)) /* accepts IDs 1,2,3 */
  |  |  |  |  ------------------
  |  |  |  |  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1793|      0|                    ip += matchLength;
 1794|      0|                    anchor = ip;
 1795|      0|                    continue;
 1796|      0|                }
 1797|      0|                break;
 1798|      0|            }
 1799|      0|        }
 1800|       |
 1801|  9.18k|        if (dictMode == ZSTD_noDict) {
  ------------------
  |  Branch (1801:13): [True: 9.18k, False: 0]
  ------------------
 1802|  9.48k|            while ( ((ip <= ilimit) & (offset_2>0))
  ------------------
  |  Branch (1802:21): [True: 7.85k, False: 1.63k]
  ------------------
 1803|  7.85k|                 && (MEM_read32(ip) == MEM_read32(ip - offset_2)) ) {
  ------------------
  |  Branch (1803:21): [True: 305, False: 7.54k]
  ------------------
 1804|       |                /* store sequence */
 1805|    305|                matchLength = ZSTD_count(ip+4, ip+4-offset_2, iend) + 4;
 1806|    305|                offBase = offset_2; offset_2 = offset_1; offset_1 = (U32)offBase; /* swap repcodes */
 1807|    305|                ZSTD_storeSeq(seqStore, 0, anchor, iend, REPCODE1_TO_OFFBASE, matchLength);
  ------------------
  |  |  747|    305|#define REPCODE1_TO_OFFBASE REPCODE_TO_OFFBASE(1)
  |  |  ------------------
  |  |  |  |  750|    305|#define REPCODE_TO_OFFBASE(r) (assert((r)>=1), assert((r)<=ZSTD_REP_NUM), (r)) /* accepts IDs 1,2,3 */
  |  |  |  |  ------------------
  |  |  |  |  |  |   70|    305|#    define assert(condition) ((void)0)   /* disable assert (default) */
  |  |  |  |  ------------------
  |  |  |  |               #define REPCODE_TO_OFFBASE(r) (assert((r)>=1), assert((r)<=ZSTD_REP_NUM), (r)) /* accepts IDs 1,2,3 */
  |  |  |  |  ------------------
  |  |  |  |  |  |   70|    305|#    define assert(condition) ((void)0)   /* disable assert (default) */
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1808|    305|                ip += matchLength;
 1809|    305|                anchor = ip;
 1810|    305|                continue;   /* faster when present ... (?) */
 1811|    305|    }   }   }
 1812|       |
 1813|       |    /* If offset_1 started invalid (offsetSaved1 != 0) and became valid (offset_1 != 0),
 1814|       |     * rotate saved offsets. See comment in ZSTD_compressBlock_fast_noDict for more context. */
 1815|  2.36k|    offsetSaved2 = ((offsetSaved1 != 0) && (offset_1 != 0)) ? offsetSaved1 : offsetSaved2;
  ------------------
  |  Branch (1815:21): [True: 0, False: 2.36k]
  |  Branch (1815:44): [True: 0, False: 0]
  ------------------
 1816|       |
 1817|       |    /* save reps for next block */
 1818|  2.36k|    rep[0] = offset_1 ? offset_1 : offsetSaved1;
  ------------------
  |  Branch (1818:14): [True: 2.36k, False: 0]
  ------------------
 1819|  2.36k|    rep[1] = offset_2 ? offset_2 : offsetSaved2;
  ------------------
  |  Branch (1819:14): [True: 2.09k, False: 265]
  ------------------
 1820|       |
 1821|       |    /* Return the last literals size */
 1822|  2.36k|    return (size_t)(iend - anchor);
 1823|  2.36k|}
zstd_lazy.c:ZSTD_searchMax:
 1540|   206k|{
 1541|   206k|    if (dictMode == ZSTD_noDict) {
  ------------------
  |  Branch (1541:9): [True: 206k, False: 0]
  ------------------
 1542|   206k|        ZSTD_SWITCH_SEARCH_METHOD(noDict)
  ------------------
  |  | 1494|   206k|    switch (searchMethod) {                                       \
  |  |  ------------------
  |  |  |  Branch (1494:13): [True: 206k, False: 0]
  |  |  ------------------
  |  | 1495|   174k|        case search_hashChain:                                    \
  |  |  ------------------
  |  |  |  Branch (1495:9): [True: 174k, False: 31.6k]
  |  |  ------------------
  |  | 1496|   174k|            ZSTD_SWITCH_MLS(GEN_ZSTD_CALL_HC_SEARCH_FN, dictMode) \
  |  |  ------------------
  |  |  |  | 1481|   174k|    switch (mls) {                     \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1481:13): [True: 174k, False: 0]
  |  |  |  |  ------------------
  |  |  |  | 1482|      0|        ZSTD_FOR_EACH_MLS(X, dictMode) \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1451|   174k|    X(dictMode, 4)                     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1496|   174k|            ZSTD_SWITCH_MLS(GEN_ZSTD_CALL_HC_SEARCH_FN, dictMode) \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1474|   174k|    case mls:                                                             \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (1474:5): [True: 174k, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1475|   174k|        return ZSTD_HC_SEARCH_FN(dictMode, mls)(ms, ip, iend, offsetPtr);
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  | 1404|   174k|#define ZSTD_HC_SEARCH_FN(dictMode, mls) ZSTD_HcFindBestMatch_##dictMode##_##mls
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1452|   174k|    X(dictMode, 5)                     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1496|      0|            ZSTD_SWITCH_MLS(GEN_ZSTD_CALL_HC_SEARCH_FN, dictMode) \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1474|      0|    case mls:                                                             \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (1474:5): [True: 0, False: 174k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1475|      0|        return ZSTD_HC_SEARCH_FN(dictMode, mls)(ms, ip, iend, offsetPtr);
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  | 1404|      0|#define ZSTD_HC_SEARCH_FN(dictMode, mls) ZSTD_HcFindBestMatch_##dictMode##_##mls
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1453|      0|    X(dictMode, 6)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1496|      0|            ZSTD_SWITCH_MLS(GEN_ZSTD_CALL_HC_SEARCH_FN, dictMode) \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1474|      0|    case mls:                                                             \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (1474:5): [True: 0, False: 174k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1475|      0|        return ZSTD_HC_SEARCH_FN(dictMode, mls)(ms, ip, iend, offsetPtr);
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  | 1404|      0|#define ZSTD_HC_SEARCH_FN(dictMode, mls) ZSTD_HcFindBestMatch_##dictMode##_##mls
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1483|   174k|    }
  |  |  ------------------
  |  | 1497|   174k|            break;                                                \
  |  | 1498|   174k|        case search_binaryTree:                                   \
  |  |  ------------------
  |  |  |  Branch (1498:9): [True: 31.6k, False: 174k]
  |  |  ------------------
  |  | 1499|  31.6k|            ZSTD_SWITCH_MLS(GEN_ZSTD_CALL_BT_SEARCH_FN, dictMode) \
  |  |  ------------------
  |  |  |  | 1481|  31.6k|    switch (mls) {                     \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1481:13): [True: 31.6k, False: 0]
  |  |  |  |  ------------------
  |  |  |  | 1482|      0|        ZSTD_FOR_EACH_MLS(X, dictMode) \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1451|  31.6k|    X(dictMode, 4)                     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1499|  31.6k|            ZSTD_SWITCH_MLS(GEN_ZSTD_CALL_BT_SEARCH_FN, dictMode) \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1471|  31.6k|    case mls:                                                             \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (1471:5): [True: 31.6k, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1472|  31.6k|        return ZSTD_BT_SEARCH_FN(dictMode, mls)(ms, ip, iend, offsetPtr);
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  | 1403|  31.6k|#define ZSTD_BT_SEARCH_FN(dictMode, mls) ZSTD_BtFindBestMatch_##dictMode##_##mls
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1452|  31.6k|    X(dictMode, 5)                     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1499|      0|            ZSTD_SWITCH_MLS(GEN_ZSTD_CALL_BT_SEARCH_FN, dictMode) \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1471|      0|    case mls:                                                             \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (1471:5): [True: 0, False: 31.6k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1472|      0|        return ZSTD_BT_SEARCH_FN(dictMode, mls)(ms, ip, iend, offsetPtr);
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  | 1403|      0|#define ZSTD_BT_SEARCH_FN(dictMode, mls) ZSTD_BtFindBestMatch_##dictMode##_##mls
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1453|      0|    X(dictMode, 6)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1499|      0|            ZSTD_SWITCH_MLS(GEN_ZSTD_CALL_BT_SEARCH_FN, dictMode) \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1471|      0|    case mls:                                                             \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (1471:5): [True: 0, False: 31.6k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1472|      0|        return ZSTD_BT_SEARCH_FN(dictMode, mls)(ms, ip, iend, offsetPtr);
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  | 1403|      0|#define ZSTD_BT_SEARCH_FN(dictMode, mls) ZSTD_BtFindBestMatch_##dictMode##_##mls
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1483|  31.6k|    }
  |  |  ------------------
  |  | 1500|  31.6k|            break;                                                \
  |  | 1501|  31.6k|        case search_rowHash:                                      \
  |  |  ------------------
  |  |  |  Branch (1501:9): [True: 0, False: 206k]
  |  |  ------------------
  |  | 1502|      0|            ZSTD_SWITCH_MLS(ZSTD_SWITCH_ROWLOG, dictMode)         \
  |  |  ------------------
  |  |  |  | 1481|      0|    switch (mls) {                     \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1481:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  | 1482|      0|        ZSTD_FOR_EACH_MLS(X, dictMode) \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1451|      0|    X(dictMode, 4)                     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1502|      0|            ZSTD_SWITCH_MLS(ZSTD_SWITCH_ROWLOG, dictMode)         \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1486|      0|    case mls:                                                                \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (1486:5): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1487|      0|        switch (rowLog) {                                                    \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (1487:17): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1488|      0|            ZSTD_FOR_EACH_ROWLOG(GEN_ZSTD_CALL_ROW_SEARCH_FN, dictMode, mls) \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  | 1441|      0|    X(dictMode, mls, 4)                        \
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1488|      0|            ZSTD_FOR_EACH_ROWLOG(GEN_ZSTD_CALL_ROW_SEARCH_FN, dictMode, mls) \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1477|      0|    case rowLog:                                                                   \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  Branch (1477:5): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1478|      0|        return ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog)(ms, ip, iend, offsetPtr);
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1405|      0|#define ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog) ZSTD_RowFindBestMatch_##dictMode##_##mls##_##rowLog
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  | 1442|      0|    X(dictMode, mls, 5)                        \
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1488|      0|            ZSTD_FOR_EACH_ROWLOG(GEN_ZSTD_CALL_ROW_SEARCH_FN, dictMode, mls) \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1477|      0|    case rowLog:                                                                   \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  Branch (1477:5): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1478|      0|        return ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog)(ms, ip, iend, offsetPtr);
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1405|      0|#define ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog) ZSTD_RowFindBestMatch_##dictMode##_##mls##_##rowLog
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  | 1443|      0|    X(dictMode, mls, 6)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1488|      0|            ZSTD_FOR_EACH_ROWLOG(GEN_ZSTD_CALL_ROW_SEARCH_FN, dictMode, mls) \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1477|      0|    case rowLog:                                                                   \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  Branch (1477:5): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1478|      0|        return ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog)(ms, ip, iend, offsetPtr);
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1405|      0|#define ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog) ZSTD_RowFindBestMatch_##dictMode##_##mls##_##rowLog
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1489|      0|        }                                                                    \
  |  |  |  |  |  |  |  |  |  | 1490|      0|        ZSTD_UNREACHABLE;                                                    \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  203|      0|#  define ZSTD_UNREACHABLE do { assert(0), __builtin_unreachable(); } while (0)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  Branch (203:78): [Folded, False: 0]
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1491|      0|        break;
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1452|      0|    X(dictMode, 5)                     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1502|      0|            ZSTD_SWITCH_MLS(ZSTD_SWITCH_ROWLOG, dictMode)         \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1486|      0|    case mls:                                                                \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (1486:5): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1487|      0|        switch (rowLog) {                                                    \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (1487:17): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1488|      0|            ZSTD_FOR_EACH_ROWLOG(GEN_ZSTD_CALL_ROW_SEARCH_FN, dictMode, mls) \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  | 1441|      0|    X(dictMode, mls, 4)                        \
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1488|      0|            ZSTD_FOR_EACH_ROWLOG(GEN_ZSTD_CALL_ROW_SEARCH_FN, dictMode, mls) \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1477|      0|    case rowLog:                                                                   \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  Branch (1477:5): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1478|      0|        return ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog)(ms, ip, iend, offsetPtr);
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1405|      0|#define ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog) ZSTD_RowFindBestMatch_##dictMode##_##mls##_##rowLog
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  | 1442|      0|    X(dictMode, mls, 5)                        \
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1488|      0|            ZSTD_FOR_EACH_ROWLOG(GEN_ZSTD_CALL_ROW_SEARCH_FN, dictMode, mls) \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1477|      0|    case rowLog:                                                                   \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  Branch (1477:5): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1478|      0|        return ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog)(ms, ip, iend, offsetPtr);
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1405|      0|#define ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog) ZSTD_RowFindBestMatch_##dictMode##_##mls##_##rowLog
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  | 1443|      0|    X(dictMode, mls, 6)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1488|      0|            ZSTD_FOR_EACH_ROWLOG(GEN_ZSTD_CALL_ROW_SEARCH_FN, dictMode, mls) \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1477|      0|    case rowLog:                                                                   \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  Branch (1477:5): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1478|      0|        return ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog)(ms, ip, iend, offsetPtr);
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1405|      0|#define ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog) ZSTD_RowFindBestMatch_##dictMode##_##mls##_##rowLog
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1489|      0|        }                                                                    \
  |  |  |  |  |  |  |  |  |  | 1490|      0|        ZSTD_UNREACHABLE;                                                    \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  203|      0|#  define ZSTD_UNREACHABLE do { assert(0), __builtin_unreachable(); } while (0)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  Branch (203:78): [Folded, False: 0]
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1491|      0|        break;
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1453|      0|    X(dictMode, 6)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1502|      0|            ZSTD_SWITCH_MLS(ZSTD_SWITCH_ROWLOG, dictMode)         \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1486|      0|    case mls:                                                                \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (1486:5): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1487|      0|        switch (rowLog) {                                                    \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (1487:17): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1488|      0|            ZSTD_FOR_EACH_ROWLOG(GEN_ZSTD_CALL_ROW_SEARCH_FN, dictMode, mls) \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  | 1441|      0|    X(dictMode, mls, 4)                        \
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1488|      0|            ZSTD_FOR_EACH_ROWLOG(GEN_ZSTD_CALL_ROW_SEARCH_FN, dictMode, mls) \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1477|      0|    case rowLog:                                                                   \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  Branch (1477:5): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1478|      0|        return ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog)(ms, ip, iend, offsetPtr);
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1405|      0|#define ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog) ZSTD_RowFindBestMatch_##dictMode##_##mls##_##rowLog
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  | 1442|      0|    X(dictMode, mls, 5)                        \
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1488|      0|            ZSTD_FOR_EACH_ROWLOG(GEN_ZSTD_CALL_ROW_SEARCH_FN, dictMode, mls) \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1477|      0|    case rowLog:                                                                   \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  Branch (1477:5): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1478|      0|        return ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog)(ms, ip, iend, offsetPtr);
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1405|      0|#define ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog) ZSTD_RowFindBestMatch_##dictMode##_##mls##_##rowLog
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  | 1443|      0|    X(dictMode, mls, 6)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1488|      0|            ZSTD_FOR_EACH_ROWLOG(GEN_ZSTD_CALL_ROW_SEARCH_FN, dictMode, mls) \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1477|      0|    case rowLog:                                                                   \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  Branch (1477:5): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1478|      0|        return ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog)(ms, ip, iend, offsetPtr);
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1405|      0|#define ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog) ZSTD_RowFindBestMatch_##dictMode##_##mls##_##rowLog
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1489|      0|        }                                                                    \
  |  |  |  |  |  |  |  |  |  | 1490|      0|        ZSTD_UNREACHABLE;                                                    \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  203|      0|#  define ZSTD_UNREACHABLE do { assert(0), __builtin_unreachable(); } while (0)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  Branch (203:78): [Folded, False: 0]
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1491|      0|        break;
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1483|      0|    }
  |  |  ------------------
  |  | 1503|      0|            break;                                                \
  |  | 1504|   206k|    }                                                             \
  |  | 1505|   206k|    ZSTD_UNREACHABLE;
  |  |  ------------------
  |  |  |  |  203|      0|#  define ZSTD_UNREACHABLE do { assert(0), __builtin_unreachable(); } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (203:78): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1543|      0|    } else if (dictMode == ZSTD_extDict) {
  ------------------
  |  Branch (1543:16): [True: 0, False: 0]
  ------------------
 1544|      0|        ZSTD_SWITCH_SEARCH_METHOD(extDict)
  ------------------
  |  | 1494|      0|    switch (searchMethod) {                                       \
  |  |  ------------------
  |  |  |  Branch (1494:13): [True: 0, False: 0]
  |  |  ------------------
  |  | 1495|      0|        case search_hashChain:                                    \
  |  |  ------------------
  |  |  |  Branch (1495:9): [True: 0, False: 0]
  |  |  ------------------
  |  | 1496|      0|            ZSTD_SWITCH_MLS(GEN_ZSTD_CALL_HC_SEARCH_FN, dictMode) \
  |  |  ------------------
  |  |  |  | 1481|      0|    switch (mls) {                     \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1481:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  | 1482|      0|        ZSTD_FOR_EACH_MLS(X, dictMode) \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1451|      0|    X(dictMode, 4)                     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1496|      0|            ZSTD_SWITCH_MLS(GEN_ZSTD_CALL_HC_SEARCH_FN, dictMode) \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1474|      0|    case mls:                                                             \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (1474:5): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1475|      0|        return ZSTD_HC_SEARCH_FN(dictMode, mls)(ms, ip, iend, offsetPtr);
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  | 1404|      0|#define ZSTD_HC_SEARCH_FN(dictMode, mls) ZSTD_HcFindBestMatch_##dictMode##_##mls
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1452|      0|    X(dictMode, 5)                     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1496|      0|            ZSTD_SWITCH_MLS(GEN_ZSTD_CALL_HC_SEARCH_FN, dictMode) \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1474|      0|    case mls:                                                             \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (1474:5): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1475|      0|        return ZSTD_HC_SEARCH_FN(dictMode, mls)(ms, ip, iend, offsetPtr);
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  | 1404|      0|#define ZSTD_HC_SEARCH_FN(dictMode, mls) ZSTD_HcFindBestMatch_##dictMode##_##mls
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1453|      0|    X(dictMode, 6)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1496|      0|            ZSTD_SWITCH_MLS(GEN_ZSTD_CALL_HC_SEARCH_FN, dictMode) \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1474|      0|    case mls:                                                             \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (1474:5): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1475|      0|        return ZSTD_HC_SEARCH_FN(dictMode, mls)(ms, ip, iend, offsetPtr);
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  | 1404|      0|#define ZSTD_HC_SEARCH_FN(dictMode, mls) ZSTD_HcFindBestMatch_##dictMode##_##mls
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1483|      0|    }
  |  |  ------------------
  |  | 1497|      0|            break;                                                \
  |  | 1498|      0|        case search_binaryTree:                                   \
  |  |  ------------------
  |  |  |  Branch (1498:9): [True: 0, False: 0]
  |  |  ------------------
  |  | 1499|      0|            ZSTD_SWITCH_MLS(GEN_ZSTD_CALL_BT_SEARCH_FN, dictMode) \
  |  |  ------------------
  |  |  |  | 1481|      0|    switch (mls) {                     \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1481:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  | 1482|      0|        ZSTD_FOR_EACH_MLS(X, dictMode) \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1451|      0|    X(dictMode, 4)                     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1499|      0|            ZSTD_SWITCH_MLS(GEN_ZSTD_CALL_BT_SEARCH_FN, dictMode) \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1471|      0|    case mls:                                                             \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (1471:5): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1472|      0|        return ZSTD_BT_SEARCH_FN(dictMode, mls)(ms, ip, iend, offsetPtr);
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  | 1403|      0|#define ZSTD_BT_SEARCH_FN(dictMode, mls) ZSTD_BtFindBestMatch_##dictMode##_##mls
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1452|      0|    X(dictMode, 5)                     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1499|      0|            ZSTD_SWITCH_MLS(GEN_ZSTD_CALL_BT_SEARCH_FN, dictMode) \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1471|      0|    case mls:                                                             \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (1471:5): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1472|      0|        return ZSTD_BT_SEARCH_FN(dictMode, mls)(ms, ip, iend, offsetPtr);
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  | 1403|      0|#define ZSTD_BT_SEARCH_FN(dictMode, mls) ZSTD_BtFindBestMatch_##dictMode##_##mls
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1453|      0|    X(dictMode, 6)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1499|      0|            ZSTD_SWITCH_MLS(GEN_ZSTD_CALL_BT_SEARCH_FN, dictMode) \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1471|      0|    case mls:                                                             \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (1471:5): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1472|      0|        return ZSTD_BT_SEARCH_FN(dictMode, mls)(ms, ip, iend, offsetPtr);
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  | 1403|      0|#define ZSTD_BT_SEARCH_FN(dictMode, mls) ZSTD_BtFindBestMatch_##dictMode##_##mls
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1483|      0|    }
  |  |  ------------------
  |  | 1500|      0|            break;                                                \
  |  | 1501|      0|        case search_rowHash:                                      \
  |  |  ------------------
  |  |  |  Branch (1501:9): [True: 0, False: 0]
  |  |  ------------------
  |  | 1502|      0|            ZSTD_SWITCH_MLS(ZSTD_SWITCH_ROWLOG, dictMode)         \
  |  |  ------------------
  |  |  |  | 1481|      0|    switch (mls) {                     \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1481:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  | 1482|      0|        ZSTD_FOR_EACH_MLS(X, dictMode) \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1451|      0|    X(dictMode, 4)                     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1502|      0|            ZSTD_SWITCH_MLS(ZSTD_SWITCH_ROWLOG, dictMode)         \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1486|      0|    case mls:                                                                \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (1486:5): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1487|      0|        switch (rowLog) {                                                    \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (1487:17): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1488|      0|            ZSTD_FOR_EACH_ROWLOG(GEN_ZSTD_CALL_ROW_SEARCH_FN, dictMode, mls) \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  | 1441|      0|    X(dictMode, mls, 4)                        \
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1488|      0|            ZSTD_FOR_EACH_ROWLOG(GEN_ZSTD_CALL_ROW_SEARCH_FN, dictMode, mls) \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1477|      0|    case rowLog:                                                                   \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  Branch (1477:5): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1478|      0|        return ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog)(ms, ip, iend, offsetPtr);
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1405|      0|#define ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog) ZSTD_RowFindBestMatch_##dictMode##_##mls##_##rowLog
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  | 1442|      0|    X(dictMode, mls, 5)                        \
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1488|      0|            ZSTD_FOR_EACH_ROWLOG(GEN_ZSTD_CALL_ROW_SEARCH_FN, dictMode, mls) \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1477|      0|    case rowLog:                                                                   \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  Branch (1477:5): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1478|      0|        return ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog)(ms, ip, iend, offsetPtr);
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1405|      0|#define ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog) ZSTD_RowFindBestMatch_##dictMode##_##mls##_##rowLog
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  | 1443|      0|    X(dictMode, mls, 6)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1488|      0|            ZSTD_FOR_EACH_ROWLOG(GEN_ZSTD_CALL_ROW_SEARCH_FN, dictMode, mls) \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1477|      0|    case rowLog:                                                                   \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  Branch (1477:5): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1478|      0|        return ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog)(ms, ip, iend, offsetPtr);
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1405|      0|#define ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog) ZSTD_RowFindBestMatch_##dictMode##_##mls##_##rowLog
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1489|      0|        }                                                                    \
  |  |  |  |  |  |  |  |  |  | 1490|      0|        ZSTD_UNREACHABLE;                                                    \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  203|      0|#  define ZSTD_UNREACHABLE do { assert(0), __builtin_unreachable(); } while (0)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  Branch (203:78): [Folded, False: 0]
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1491|      0|        break;
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1452|      0|    X(dictMode, 5)                     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1502|      0|            ZSTD_SWITCH_MLS(ZSTD_SWITCH_ROWLOG, dictMode)         \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1486|      0|    case mls:                                                                \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (1486:5): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1487|      0|        switch (rowLog) {                                                    \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (1487:17): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1488|      0|            ZSTD_FOR_EACH_ROWLOG(GEN_ZSTD_CALL_ROW_SEARCH_FN, dictMode, mls) \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  | 1441|      0|    X(dictMode, mls, 4)                        \
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1488|      0|            ZSTD_FOR_EACH_ROWLOG(GEN_ZSTD_CALL_ROW_SEARCH_FN, dictMode, mls) \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1477|      0|    case rowLog:                                                                   \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  Branch (1477:5): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1478|      0|        return ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog)(ms, ip, iend, offsetPtr);
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1405|      0|#define ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog) ZSTD_RowFindBestMatch_##dictMode##_##mls##_##rowLog
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  | 1442|      0|    X(dictMode, mls, 5)                        \
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1488|      0|            ZSTD_FOR_EACH_ROWLOG(GEN_ZSTD_CALL_ROW_SEARCH_FN, dictMode, mls) \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1477|      0|    case rowLog:                                                                   \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  Branch (1477:5): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1478|      0|        return ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog)(ms, ip, iend, offsetPtr);
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1405|      0|#define ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog) ZSTD_RowFindBestMatch_##dictMode##_##mls##_##rowLog
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  | 1443|      0|    X(dictMode, mls, 6)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1488|      0|            ZSTD_FOR_EACH_ROWLOG(GEN_ZSTD_CALL_ROW_SEARCH_FN, dictMode, mls) \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1477|      0|    case rowLog:                                                                   \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  Branch (1477:5): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1478|      0|        return ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog)(ms, ip, iend, offsetPtr);
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1405|      0|#define ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog) ZSTD_RowFindBestMatch_##dictMode##_##mls##_##rowLog
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1489|      0|        }                                                                    \
  |  |  |  |  |  |  |  |  |  | 1490|      0|        ZSTD_UNREACHABLE;                                                    \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  203|      0|#  define ZSTD_UNREACHABLE do { assert(0), __builtin_unreachable(); } while (0)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  Branch (203:78): [Folded, False: 0]
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1491|      0|        break;
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1453|      0|    X(dictMode, 6)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1502|      0|            ZSTD_SWITCH_MLS(ZSTD_SWITCH_ROWLOG, dictMode)         \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1486|      0|    case mls:                                                                \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (1486:5): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1487|      0|        switch (rowLog) {                                                    \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (1487:17): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1488|      0|            ZSTD_FOR_EACH_ROWLOG(GEN_ZSTD_CALL_ROW_SEARCH_FN, dictMode, mls) \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  | 1441|      0|    X(dictMode, mls, 4)                        \
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1488|      0|            ZSTD_FOR_EACH_ROWLOG(GEN_ZSTD_CALL_ROW_SEARCH_FN, dictMode, mls) \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1477|      0|    case rowLog:                                                                   \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  Branch (1477:5): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1478|      0|        return ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog)(ms, ip, iend, offsetPtr);
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1405|      0|#define ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog) ZSTD_RowFindBestMatch_##dictMode##_##mls##_##rowLog
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  | 1442|      0|    X(dictMode, mls, 5)                        \
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1488|      0|            ZSTD_FOR_EACH_ROWLOG(GEN_ZSTD_CALL_ROW_SEARCH_FN, dictMode, mls) \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1477|      0|    case rowLog:                                                                   \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  Branch (1477:5): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1478|      0|        return ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog)(ms, ip, iend, offsetPtr);
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1405|      0|#define ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog) ZSTD_RowFindBestMatch_##dictMode##_##mls##_##rowLog
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  | 1443|      0|    X(dictMode, mls, 6)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1488|      0|            ZSTD_FOR_EACH_ROWLOG(GEN_ZSTD_CALL_ROW_SEARCH_FN, dictMode, mls) \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1477|      0|    case rowLog:                                                                   \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  Branch (1477:5): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1478|      0|        return ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog)(ms, ip, iend, offsetPtr);
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1405|      0|#define ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog) ZSTD_RowFindBestMatch_##dictMode##_##mls##_##rowLog
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1489|      0|        }                                                                    \
  |  |  |  |  |  |  |  |  |  | 1490|      0|        ZSTD_UNREACHABLE;                                                    \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  203|      0|#  define ZSTD_UNREACHABLE do { assert(0), __builtin_unreachable(); } while (0)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  Branch (203:78): [Folded, False: 0]
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1491|      0|        break;
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1483|      0|    }
  |  |  ------------------
  |  | 1503|      0|            break;                                                \
  |  | 1504|      0|    }                                                             \
  |  | 1505|      0|    ZSTD_UNREACHABLE;
  |  |  ------------------
  |  |  |  |  203|      0|#  define ZSTD_UNREACHABLE do { assert(0), __builtin_unreachable(); } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (203:78): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1545|      0|    } else if (dictMode == ZSTD_dictMatchState) {
  ------------------
  |  Branch (1545:16): [True: 0, False: 0]
  ------------------
 1546|      0|        ZSTD_SWITCH_SEARCH_METHOD(dictMatchState)
  ------------------
  |  | 1494|      0|    switch (searchMethod) {                                       \
  |  |  ------------------
  |  |  |  Branch (1494:13): [True: 0, False: 0]
  |  |  ------------------
  |  | 1495|      0|        case search_hashChain:                                    \
  |  |  ------------------
  |  |  |  Branch (1495:9): [True: 0, False: 0]
  |  |  ------------------
  |  | 1496|      0|            ZSTD_SWITCH_MLS(GEN_ZSTD_CALL_HC_SEARCH_FN, dictMode) \
  |  |  ------------------
  |  |  |  | 1481|      0|    switch (mls) {                     \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1481:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  | 1482|      0|        ZSTD_FOR_EACH_MLS(X, dictMode) \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1451|      0|    X(dictMode, 4)                     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1496|      0|            ZSTD_SWITCH_MLS(GEN_ZSTD_CALL_HC_SEARCH_FN, dictMode) \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1474|      0|    case mls:                                                             \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (1474:5): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1475|      0|        return ZSTD_HC_SEARCH_FN(dictMode, mls)(ms, ip, iend, offsetPtr);
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  | 1404|      0|#define ZSTD_HC_SEARCH_FN(dictMode, mls) ZSTD_HcFindBestMatch_##dictMode##_##mls
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1452|      0|    X(dictMode, 5)                     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1496|      0|            ZSTD_SWITCH_MLS(GEN_ZSTD_CALL_HC_SEARCH_FN, dictMode) \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1474|      0|    case mls:                                                             \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (1474:5): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1475|      0|        return ZSTD_HC_SEARCH_FN(dictMode, mls)(ms, ip, iend, offsetPtr);
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  | 1404|      0|#define ZSTD_HC_SEARCH_FN(dictMode, mls) ZSTD_HcFindBestMatch_##dictMode##_##mls
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1453|      0|    X(dictMode, 6)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1496|      0|            ZSTD_SWITCH_MLS(GEN_ZSTD_CALL_HC_SEARCH_FN, dictMode) \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1474|      0|    case mls:                                                             \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (1474:5): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1475|      0|        return ZSTD_HC_SEARCH_FN(dictMode, mls)(ms, ip, iend, offsetPtr);
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  | 1404|      0|#define ZSTD_HC_SEARCH_FN(dictMode, mls) ZSTD_HcFindBestMatch_##dictMode##_##mls
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1483|      0|    }
  |  |  ------------------
  |  | 1497|      0|            break;                                                \
  |  | 1498|      0|        case search_binaryTree:                                   \
  |  |  ------------------
  |  |  |  Branch (1498:9): [True: 0, False: 0]
  |  |  ------------------
  |  | 1499|      0|            ZSTD_SWITCH_MLS(GEN_ZSTD_CALL_BT_SEARCH_FN, dictMode) \
  |  |  ------------------
  |  |  |  | 1481|      0|    switch (mls) {                     \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1481:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  | 1482|      0|        ZSTD_FOR_EACH_MLS(X, dictMode) \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1451|      0|    X(dictMode, 4)                     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1499|      0|            ZSTD_SWITCH_MLS(GEN_ZSTD_CALL_BT_SEARCH_FN, dictMode) \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1471|      0|    case mls:                                                             \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (1471:5): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1472|      0|        return ZSTD_BT_SEARCH_FN(dictMode, mls)(ms, ip, iend, offsetPtr);
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  | 1403|      0|#define ZSTD_BT_SEARCH_FN(dictMode, mls) ZSTD_BtFindBestMatch_##dictMode##_##mls
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1452|      0|    X(dictMode, 5)                     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1499|      0|            ZSTD_SWITCH_MLS(GEN_ZSTD_CALL_BT_SEARCH_FN, dictMode) \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1471|      0|    case mls:                                                             \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (1471:5): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1472|      0|        return ZSTD_BT_SEARCH_FN(dictMode, mls)(ms, ip, iend, offsetPtr);
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  | 1403|      0|#define ZSTD_BT_SEARCH_FN(dictMode, mls) ZSTD_BtFindBestMatch_##dictMode##_##mls
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1453|      0|    X(dictMode, 6)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1499|      0|            ZSTD_SWITCH_MLS(GEN_ZSTD_CALL_BT_SEARCH_FN, dictMode) \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1471|      0|    case mls:                                                             \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (1471:5): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1472|      0|        return ZSTD_BT_SEARCH_FN(dictMode, mls)(ms, ip, iend, offsetPtr);
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  | 1403|      0|#define ZSTD_BT_SEARCH_FN(dictMode, mls) ZSTD_BtFindBestMatch_##dictMode##_##mls
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1483|      0|    }
  |  |  ------------------
  |  | 1500|      0|            break;                                                \
  |  | 1501|      0|        case search_rowHash:                                      \
  |  |  ------------------
  |  |  |  Branch (1501:9): [True: 0, False: 0]
  |  |  ------------------
  |  | 1502|      0|            ZSTD_SWITCH_MLS(ZSTD_SWITCH_ROWLOG, dictMode)         \
  |  |  ------------------
  |  |  |  | 1481|      0|    switch (mls) {                     \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1481:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  | 1482|      0|        ZSTD_FOR_EACH_MLS(X, dictMode) \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1451|      0|    X(dictMode, 4)                     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1502|      0|            ZSTD_SWITCH_MLS(ZSTD_SWITCH_ROWLOG, dictMode)         \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1486|      0|    case mls:                                                                \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (1486:5): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1487|      0|        switch (rowLog) {                                                    \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (1487:17): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1488|      0|            ZSTD_FOR_EACH_ROWLOG(GEN_ZSTD_CALL_ROW_SEARCH_FN, dictMode, mls) \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  | 1441|      0|    X(dictMode, mls, 4)                        \
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1488|      0|            ZSTD_FOR_EACH_ROWLOG(GEN_ZSTD_CALL_ROW_SEARCH_FN, dictMode, mls) \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1477|      0|    case rowLog:                                                                   \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  Branch (1477:5): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1478|      0|        return ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog)(ms, ip, iend, offsetPtr);
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1405|      0|#define ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog) ZSTD_RowFindBestMatch_##dictMode##_##mls##_##rowLog
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  | 1442|      0|    X(dictMode, mls, 5)                        \
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1488|      0|            ZSTD_FOR_EACH_ROWLOG(GEN_ZSTD_CALL_ROW_SEARCH_FN, dictMode, mls) \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1477|      0|    case rowLog:                                                                   \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  Branch (1477:5): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1478|      0|        return ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog)(ms, ip, iend, offsetPtr);
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1405|      0|#define ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog) ZSTD_RowFindBestMatch_##dictMode##_##mls##_##rowLog
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  | 1443|      0|    X(dictMode, mls, 6)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1488|      0|            ZSTD_FOR_EACH_ROWLOG(GEN_ZSTD_CALL_ROW_SEARCH_FN, dictMode, mls) \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1477|      0|    case rowLog:                                                                   \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  Branch (1477:5): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1478|      0|        return ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog)(ms, ip, iend, offsetPtr);
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1405|      0|#define ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog) ZSTD_RowFindBestMatch_##dictMode##_##mls##_##rowLog
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1489|      0|        }                                                                    \
  |  |  |  |  |  |  |  |  |  | 1490|      0|        ZSTD_UNREACHABLE;                                                    \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  203|      0|#  define ZSTD_UNREACHABLE do { assert(0), __builtin_unreachable(); } while (0)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  Branch (203:78): [Folded, False: 0]
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1491|      0|        break;
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1452|      0|    X(dictMode, 5)                     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1502|      0|            ZSTD_SWITCH_MLS(ZSTD_SWITCH_ROWLOG, dictMode)         \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1486|      0|    case mls:                                                                \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (1486:5): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1487|      0|        switch (rowLog) {                                                    \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (1487:17): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1488|      0|            ZSTD_FOR_EACH_ROWLOG(GEN_ZSTD_CALL_ROW_SEARCH_FN, dictMode, mls) \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  | 1441|      0|    X(dictMode, mls, 4)                        \
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1488|      0|            ZSTD_FOR_EACH_ROWLOG(GEN_ZSTD_CALL_ROW_SEARCH_FN, dictMode, mls) \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1477|      0|    case rowLog:                                                                   \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  Branch (1477:5): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1478|      0|        return ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog)(ms, ip, iend, offsetPtr);
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1405|      0|#define ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog) ZSTD_RowFindBestMatch_##dictMode##_##mls##_##rowLog
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  | 1442|      0|    X(dictMode, mls, 5)                        \
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1488|      0|            ZSTD_FOR_EACH_ROWLOG(GEN_ZSTD_CALL_ROW_SEARCH_FN, dictMode, mls) \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1477|      0|    case rowLog:                                                                   \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  Branch (1477:5): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1478|      0|        return ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog)(ms, ip, iend, offsetPtr);
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1405|      0|#define ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog) ZSTD_RowFindBestMatch_##dictMode##_##mls##_##rowLog
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  | 1443|      0|    X(dictMode, mls, 6)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1488|      0|            ZSTD_FOR_EACH_ROWLOG(GEN_ZSTD_CALL_ROW_SEARCH_FN, dictMode, mls) \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1477|      0|    case rowLog:                                                                   \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  Branch (1477:5): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1478|      0|        return ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog)(ms, ip, iend, offsetPtr);
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1405|      0|#define ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog) ZSTD_RowFindBestMatch_##dictMode##_##mls##_##rowLog
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1489|      0|        }                                                                    \
  |  |  |  |  |  |  |  |  |  | 1490|      0|        ZSTD_UNREACHABLE;                                                    \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  203|      0|#  define ZSTD_UNREACHABLE do { assert(0), __builtin_unreachable(); } while (0)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  Branch (203:78): [Folded, False: 0]
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1491|      0|        break;
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1453|      0|    X(dictMode, 6)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1502|      0|            ZSTD_SWITCH_MLS(ZSTD_SWITCH_ROWLOG, dictMode)         \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1486|      0|    case mls:                                                                \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (1486:5): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1487|      0|        switch (rowLog) {                                                    \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (1487:17): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1488|      0|            ZSTD_FOR_EACH_ROWLOG(GEN_ZSTD_CALL_ROW_SEARCH_FN, dictMode, mls) \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  | 1441|      0|    X(dictMode, mls, 4)                        \
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1488|      0|            ZSTD_FOR_EACH_ROWLOG(GEN_ZSTD_CALL_ROW_SEARCH_FN, dictMode, mls) \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1477|      0|    case rowLog:                                                                   \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  Branch (1477:5): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1478|      0|        return ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog)(ms, ip, iend, offsetPtr);
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1405|      0|#define ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog) ZSTD_RowFindBestMatch_##dictMode##_##mls##_##rowLog
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  | 1442|      0|    X(dictMode, mls, 5)                        \
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1488|      0|            ZSTD_FOR_EACH_ROWLOG(GEN_ZSTD_CALL_ROW_SEARCH_FN, dictMode, mls) \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1477|      0|    case rowLog:                                                                   \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  Branch (1477:5): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1478|      0|        return ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog)(ms, ip, iend, offsetPtr);
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1405|      0|#define ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog) ZSTD_RowFindBestMatch_##dictMode##_##mls##_##rowLog
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  | 1443|      0|    X(dictMode, mls, 6)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1488|      0|            ZSTD_FOR_EACH_ROWLOG(GEN_ZSTD_CALL_ROW_SEARCH_FN, dictMode, mls) \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1477|      0|    case rowLog:                                                                   \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  Branch (1477:5): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1478|      0|        return ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog)(ms, ip, iend, offsetPtr);
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1405|      0|#define ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog) ZSTD_RowFindBestMatch_##dictMode##_##mls##_##rowLog
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1489|      0|        }                                                                    \
  |  |  |  |  |  |  |  |  |  | 1490|      0|        ZSTD_UNREACHABLE;                                                    \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  203|      0|#  define ZSTD_UNREACHABLE do { assert(0), __builtin_unreachable(); } while (0)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  Branch (203:78): [Folded, False: 0]
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1491|      0|        break;
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1483|      0|    }
  |  |  ------------------
  |  | 1503|      0|            break;                                                \
  |  | 1504|      0|    }                                                             \
  |  | 1505|      0|    ZSTD_UNREACHABLE;
  |  |  ------------------
  |  |  |  |  203|      0|#  define ZSTD_UNREACHABLE do { assert(0), __builtin_unreachable(); } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (203:78): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1547|      0|    } else if (dictMode == ZSTD_dedicatedDictSearch) {
  ------------------
  |  Branch (1547:16): [True: 0, False: 0]
  ------------------
 1548|      0|        ZSTD_SWITCH_SEARCH_METHOD(dedicatedDictSearch)
  ------------------
  |  | 1494|      0|    switch (searchMethod) {                                       \
  |  |  ------------------
  |  |  |  Branch (1494:13): [True: 0, False: 0]
  |  |  ------------------
  |  | 1495|      0|        case search_hashChain:                                    \
  |  |  ------------------
  |  |  |  Branch (1495:9): [True: 0, False: 0]
  |  |  ------------------
  |  | 1496|      0|            ZSTD_SWITCH_MLS(GEN_ZSTD_CALL_HC_SEARCH_FN, dictMode) \
  |  |  ------------------
  |  |  |  | 1481|      0|    switch (mls) {                     \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1481:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  | 1482|      0|        ZSTD_FOR_EACH_MLS(X, dictMode) \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1451|      0|    X(dictMode, 4)                     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1496|      0|            ZSTD_SWITCH_MLS(GEN_ZSTD_CALL_HC_SEARCH_FN, dictMode) \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1474|      0|    case mls:                                                             \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (1474:5): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1475|      0|        return ZSTD_HC_SEARCH_FN(dictMode, mls)(ms, ip, iend, offsetPtr);
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  | 1404|      0|#define ZSTD_HC_SEARCH_FN(dictMode, mls) ZSTD_HcFindBestMatch_##dictMode##_##mls
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1452|      0|    X(dictMode, 5)                     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1496|      0|            ZSTD_SWITCH_MLS(GEN_ZSTD_CALL_HC_SEARCH_FN, dictMode) \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1474|      0|    case mls:                                                             \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (1474:5): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1475|      0|        return ZSTD_HC_SEARCH_FN(dictMode, mls)(ms, ip, iend, offsetPtr);
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  | 1404|      0|#define ZSTD_HC_SEARCH_FN(dictMode, mls) ZSTD_HcFindBestMatch_##dictMode##_##mls
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1453|      0|    X(dictMode, 6)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1496|      0|            ZSTD_SWITCH_MLS(GEN_ZSTD_CALL_HC_SEARCH_FN, dictMode) \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1474|      0|    case mls:                                                             \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (1474:5): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1475|      0|        return ZSTD_HC_SEARCH_FN(dictMode, mls)(ms, ip, iend, offsetPtr);
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  | 1404|      0|#define ZSTD_HC_SEARCH_FN(dictMode, mls) ZSTD_HcFindBestMatch_##dictMode##_##mls
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1483|      0|    }
  |  |  ------------------
  |  | 1497|      0|            break;                                                \
  |  | 1498|      0|        case search_binaryTree:                                   \
  |  |  ------------------
  |  |  |  Branch (1498:9): [True: 0, False: 0]
  |  |  ------------------
  |  | 1499|      0|            ZSTD_SWITCH_MLS(GEN_ZSTD_CALL_BT_SEARCH_FN, dictMode) \
  |  |  ------------------
  |  |  |  | 1481|      0|    switch (mls) {                     \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1481:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  | 1482|      0|        ZSTD_FOR_EACH_MLS(X, dictMode) \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1451|      0|    X(dictMode, 4)                     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1499|      0|            ZSTD_SWITCH_MLS(GEN_ZSTD_CALL_BT_SEARCH_FN, dictMode) \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1471|      0|    case mls:                                                             \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (1471:5): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1472|      0|        return ZSTD_BT_SEARCH_FN(dictMode, mls)(ms, ip, iend, offsetPtr);
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  | 1403|      0|#define ZSTD_BT_SEARCH_FN(dictMode, mls) ZSTD_BtFindBestMatch_##dictMode##_##mls
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1452|      0|    X(dictMode, 5)                     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1499|      0|            ZSTD_SWITCH_MLS(GEN_ZSTD_CALL_BT_SEARCH_FN, dictMode) \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1471|      0|    case mls:                                                             \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (1471:5): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1472|      0|        return ZSTD_BT_SEARCH_FN(dictMode, mls)(ms, ip, iend, offsetPtr);
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  | 1403|      0|#define ZSTD_BT_SEARCH_FN(dictMode, mls) ZSTD_BtFindBestMatch_##dictMode##_##mls
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1453|      0|    X(dictMode, 6)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1499|      0|            ZSTD_SWITCH_MLS(GEN_ZSTD_CALL_BT_SEARCH_FN, dictMode) \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1471|      0|    case mls:                                                             \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (1471:5): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1472|      0|        return ZSTD_BT_SEARCH_FN(dictMode, mls)(ms, ip, iend, offsetPtr);
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  | 1403|      0|#define ZSTD_BT_SEARCH_FN(dictMode, mls) ZSTD_BtFindBestMatch_##dictMode##_##mls
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1483|      0|    }
  |  |  ------------------
  |  | 1500|      0|            break;                                                \
  |  | 1501|      0|        case search_rowHash:                                      \
  |  |  ------------------
  |  |  |  Branch (1501:9): [True: 0, False: 0]
  |  |  ------------------
  |  | 1502|      0|            ZSTD_SWITCH_MLS(ZSTD_SWITCH_ROWLOG, dictMode)         \
  |  |  ------------------
  |  |  |  | 1481|      0|    switch (mls) {                     \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1481:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  | 1482|      0|        ZSTD_FOR_EACH_MLS(X, dictMode) \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1451|      0|    X(dictMode, 4)                     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1502|      0|            ZSTD_SWITCH_MLS(ZSTD_SWITCH_ROWLOG, dictMode)         \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1486|      0|    case mls:                                                                \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (1486:5): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1487|      0|        switch (rowLog) {                                                    \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (1487:17): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1488|      0|            ZSTD_FOR_EACH_ROWLOG(GEN_ZSTD_CALL_ROW_SEARCH_FN, dictMode, mls) \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  | 1441|      0|    X(dictMode, mls, 4)                        \
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1488|      0|            ZSTD_FOR_EACH_ROWLOG(GEN_ZSTD_CALL_ROW_SEARCH_FN, dictMode, mls) \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1477|      0|    case rowLog:                                                                   \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  Branch (1477:5): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1478|      0|        return ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog)(ms, ip, iend, offsetPtr);
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1405|      0|#define ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog) ZSTD_RowFindBestMatch_##dictMode##_##mls##_##rowLog
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  | 1442|      0|    X(dictMode, mls, 5)                        \
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1488|      0|            ZSTD_FOR_EACH_ROWLOG(GEN_ZSTD_CALL_ROW_SEARCH_FN, dictMode, mls) \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1477|      0|    case rowLog:                                                                   \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  Branch (1477:5): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1478|      0|        return ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog)(ms, ip, iend, offsetPtr);
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1405|      0|#define ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog) ZSTD_RowFindBestMatch_##dictMode##_##mls##_##rowLog
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  | 1443|      0|    X(dictMode, mls, 6)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1488|      0|            ZSTD_FOR_EACH_ROWLOG(GEN_ZSTD_CALL_ROW_SEARCH_FN, dictMode, mls) \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1477|      0|    case rowLog:                                                                   \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  Branch (1477:5): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1478|      0|        return ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog)(ms, ip, iend, offsetPtr);
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1405|      0|#define ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog) ZSTD_RowFindBestMatch_##dictMode##_##mls##_##rowLog
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1489|      0|        }                                                                    \
  |  |  |  |  |  |  |  |  |  | 1490|      0|        ZSTD_UNREACHABLE;                                                    \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  203|      0|#  define ZSTD_UNREACHABLE do { assert(0), __builtin_unreachable(); } while (0)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  Branch (203:78): [Folded, False: 0]
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1491|      0|        break;
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1452|      0|    X(dictMode, 5)                     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1502|      0|            ZSTD_SWITCH_MLS(ZSTD_SWITCH_ROWLOG, dictMode)         \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1486|      0|    case mls:                                                                \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (1486:5): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1487|      0|        switch (rowLog) {                                                    \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (1487:17): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1488|      0|            ZSTD_FOR_EACH_ROWLOG(GEN_ZSTD_CALL_ROW_SEARCH_FN, dictMode, mls) \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  | 1441|      0|    X(dictMode, mls, 4)                        \
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1488|      0|            ZSTD_FOR_EACH_ROWLOG(GEN_ZSTD_CALL_ROW_SEARCH_FN, dictMode, mls) \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1477|      0|    case rowLog:                                                                   \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  Branch (1477:5): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1478|      0|        return ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog)(ms, ip, iend, offsetPtr);
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1405|      0|#define ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog) ZSTD_RowFindBestMatch_##dictMode##_##mls##_##rowLog
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  | 1442|      0|    X(dictMode, mls, 5)                        \
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1488|      0|            ZSTD_FOR_EACH_ROWLOG(GEN_ZSTD_CALL_ROW_SEARCH_FN, dictMode, mls) \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1477|      0|    case rowLog:                                                                   \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  Branch (1477:5): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1478|      0|        return ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog)(ms, ip, iend, offsetPtr);
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1405|      0|#define ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog) ZSTD_RowFindBestMatch_##dictMode##_##mls##_##rowLog
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  | 1443|      0|    X(dictMode, mls, 6)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1488|      0|            ZSTD_FOR_EACH_ROWLOG(GEN_ZSTD_CALL_ROW_SEARCH_FN, dictMode, mls) \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1477|      0|    case rowLog:                                                                   \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  Branch (1477:5): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1478|      0|        return ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog)(ms, ip, iend, offsetPtr);
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1405|      0|#define ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog) ZSTD_RowFindBestMatch_##dictMode##_##mls##_##rowLog
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1489|      0|        }                                                                    \
  |  |  |  |  |  |  |  |  |  | 1490|      0|        ZSTD_UNREACHABLE;                                                    \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  203|      0|#  define ZSTD_UNREACHABLE do { assert(0), __builtin_unreachable(); } while (0)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  Branch (203:78): [Folded, False: 0]
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1491|      0|        break;
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1453|      0|    X(dictMode, 6)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1502|      0|            ZSTD_SWITCH_MLS(ZSTD_SWITCH_ROWLOG, dictMode)         \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1486|      0|    case mls:                                                                \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (1486:5): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1487|      0|        switch (rowLog) {                                                    \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (1487:17): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1488|      0|            ZSTD_FOR_EACH_ROWLOG(GEN_ZSTD_CALL_ROW_SEARCH_FN, dictMode, mls) \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  | 1441|      0|    X(dictMode, mls, 4)                        \
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1488|      0|            ZSTD_FOR_EACH_ROWLOG(GEN_ZSTD_CALL_ROW_SEARCH_FN, dictMode, mls) \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1477|      0|    case rowLog:                                                                   \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  Branch (1477:5): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1478|      0|        return ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog)(ms, ip, iend, offsetPtr);
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1405|      0|#define ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog) ZSTD_RowFindBestMatch_##dictMode##_##mls##_##rowLog
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  | 1442|      0|    X(dictMode, mls, 5)                        \
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1488|      0|            ZSTD_FOR_EACH_ROWLOG(GEN_ZSTD_CALL_ROW_SEARCH_FN, dictMode, mls) \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1477|      0|    case rowLog:                                                                   \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  Branch (1477:5): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1478|      0|        return ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog)(ms, ip, iend, offsetPtr);
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1405|      0|#define ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog) ZSTD_RowFindBestMatch_##dictMode##_##mls##_##rowLog
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  | 1443|      0|    X(dictMode, mls, 6)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1488|      0|            ZSTD_FOR_EACH_ROWLOG(GEN_ZSTD_CALL_ROW_SEARCH_FN, dictMode, mls) \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1477|      0|    case rowLog:                                                                   \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  Branch (1477:5): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1478|      0|        return ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog)(ms, ip, iend, offsetPtr);
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1405|      0|#define ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog) ZSTD_RowFindBestMatch_##dictMode##_##mls##_##rowLog
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1489|      0|        }                                                                    \
  |  |  |  |  |  |  |  |  |  | 1490|      0|        ZSTD_UNREACHABLE;                                                    \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  203|      0|#  define ZSTD_UNREACHABLE do { assert(0), __builtin_unreachable(); } while (0)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  Branch (203:78): [Folded, False: 0]
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1491|      0|        break;
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1483|      0|    }
  |  |  ------------------
  |  | 1503|      0|            break;                                                \
  |  | 1504|      0|    }                                                             \
  |  | 1505|      0|    ZSTD_UNREACHABLE;
  |  |  ------------------
  |  |  |  |  203|      0|#  define ZSTD_UNREACHABLE do { assert(0), __builtin_unreachable(); } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (203:78): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1549|      0|    }
 1550|      0|    ZSTD_UNREACHABLE;
  ------------------
  |  |  203|      0|#  define ZSTD_UNREACHABLE do { assert(0), __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  |  |  ------------------
  |  |  |  Branch (203:78): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1551|      0|    return 0;
 1552|      0|}
zstd_lazy.c:ZSTD_HcFindBestMatch_noDict_4:
 1424|   174k|    {                                                                                 \
 1425|   174k|        assert(MAX(4, MIN(6, ms->cParams.minMatch)) == mls);                          \
  ------------------
  |  |   70|   174k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1426|   174k|        return ZSTD_HcFindBestMatch(ms, ip, iLimit, offsetPtr, mls, ZSTD_##dictMode); \
 1427|   174k|    }                                                                                 \
zstd_lazy.c:ZSTD_HcFindBestMatch:
  672|   174k|{
  673|   174k|    const ZSTD_compressionParameters* const cParams = &ms->cParams;
  674|   174k|    U32* const chainTable = ms->chainTable;
  675|   174k|    const U32 chainSize = (1 << cParams->chainLog);
  676|   174k|    const U32 chainMask = chainSize-1;
  677|   174k|    const BYTE* const base = ms->window.base;
  678|   174k|    const BYTE* const dictBase = ms->window.dictBase;
  679|   174k|    const U32 dictLimit = ms->window.dictLimit;
  680|   174k|    const BYTE* const prefixStart = base + dictLimit;
  681|   174k|    const BYTE* const dictEnd = dictBase + dictLimit;
  682|   174k|    const U32 curr = (U32)(ip-base);
  683|   174k|    const U32 maxDistance = 1U << cParams->windowLog;
  684|   174k|    const U32 lowestValid = ms->window.lowLimit;
  685|   174k|    const U32 withinMaxDistance = (curr - lowestValid > maxDistance) ? curr - maxDistance : lowestValid;
  ------------------
  |  Branch (685:35): [True: 0, False: 174k]
  ------------------
  686|   174k|    const U32 isDictionary = (ms->loadedDictEnd != 0);
  687|   174k|    const U32 lowLimit = isDictionary ? lowestValid : withinMaxDistance;
  ------------------
  |  Branch (687:26): [True: 0, False: 174k]
  ------------------
  688|   174k|    const U32 minChain = curr > chainSize ? curr - chainSize : 0;
  ------------------
  |  Branch (688:26): [True: 174k, False: 847]
  ------------------
  689|   174k|    U32 nbAttempts = 1U << cParams->searchLog;
  690|   174k|    size_t ml=4-1;
  691|       |
  692|   174k|    const ZSTD_MatchState_t* const dms = ms->dictMatchState;
  693|   174k|    const U32 ddsHashLog = dictMode == ZSTD_dedicatedDictSearch
  ------------------
  |  Branch (693:28): [True: 0, False: 174k]
  ------------------
  694|   174k|                         ? dms->cParams.hashLog - ZSTD_LAZY_DDSS_BUCKET_LOG : 0;
  ------------------
  |  |   22|      0|#define ZSTD_LAZY_DDSS_BUCKET_LOG 2
  ------------------
  695|   174k|    const size_t ddsIdx = dictMode == ZSTD_dedicatedDictSearch
  ------------------
  |  Branch (695:27): [True: 0, False: 174k]
  ------------------
  696|   174k|                        ? ZSTD_hashPtr(ip, ddsHashLog, mls) << ZSTD_LAZY_DDSS_BUCKET_LOG : 0;
  ------------------
  |  |   22|      0|#define ZSTD_LAZY_DDSS_BUCKET_LOG 2
  ------------------
  697|       |
  698|   174k|    U32 matchIndex;
  699|       |
  700|   174k|    if (dictMode == ZSTD_dedicatedDictSearch) {
  ------------------
  |  Branch (700:9): [True: 0, False: 174k]
  ------------------
  701|      0|        const U32* entry = &dms->hashTable[ddsIdx];
  702|      0|        PREFETCH_L1(entry);
  ------------------
  |  |  149|      0|#    define PREFETCH_L1(ptr)  __builtin_prefetch((ptr), 0 /* rw==read */, 3 /* locality */)
  ------------------
  703|      0|    }
  704|       |
  705|       |    /* HC4 match finder */
  706|   174k|    matchIndex = ZSTD_insertAndFindFirstIndex_internal(ms, cParams, ip, mls, ms->lazySkipping);
  707|       |
  708|   223k|    for ( ; (matchIndex>=lowLimit) & (nbAttempts>0) ; nbAttempts--) {
  ------------------
  |  Branch (708:13): [True: 48.7k, False: 174k]
  ------------------
  709|  48.7k|        size_t currentMl=0;
  710|  48.7k|        if ((dictMode != ZSTD_extDict) || matchIndex >= dictLimit) {
  ------------------
  |  Branch (710:13): [True: 48.7k, False: 0]
  |  Branch (710:43): [True: 0, False: 0]
  ------------------
  711|  48.7k|            const BYTE* const match = base + matchIndex;
  712|  48.7k|            assert(matchIndex >= dictLimit);   /* ensures this is true if dictMode != ZSTD_extDict */
  ------------------
  |  |   70|  48.7k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  713|       |            /* read 4B starting from (match + ml + 1 - sizeof(U32)) */
  714|  48.7k|            if (MEM_read32(match + ml - 3) == MEM_read32(ip + ml - 3))   /* potentially better */
  ------------------
  |  Branch (714:17): [True: 8.13k, False: 40.5k]
  ------------------
  715|  8.13k|                currentMl = ZSTD_count(ip, match, iLimit);
  716|  48.7k|        } else {
  717|      0|            const BYTE* const match = dictBase + matchIndex;
  718|      0|            assert(match+4 <= dictEnd);
  ------------------
  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  719|      0|            if (MEM_read32(match) == MEM_read32(ip))   /* assumption : matchIndex <= dictLimit-4 (by table construction) */
  ------------------
  |  Branch (719:17): [True: 0, False: 0]
  ------------------
  720|      0|                currentMl = ZSTD_count_2segments(ip+4, match+4, iLimit, dictEnd, prefixStart) + 4;
  721|      0|        }
  722|       |
  723|       |        /* save best solution */
  724|  48.7k|        if (currentMl > ml) {
  ------------------
  |  Branch (724:13): [True: 8.11k, False: 40.5k]
  ------------------
  725|  8.11k|            ml = currentMl;
  726|  8.11k|            *offsetPtr = OFFSET_TO_OFFBASE(curr - matchIndex);
  ------------------
  |  |  751|  8.11k|#define OFFSET_TO_OFFBASE(o)  (assert((o)>0), o + ZSTD_REP_NUM)
  |  |  ------------------
  |  |  |  |   70|  8.11k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  |  |  ------------------
  |  |               #define OFFSET_TO_OFFBASE(o)  (assert((o)>0), o + ZSTD_REP_NUM)
  |  |  ------------------
  |  |  |  |   64|  8.11k|#define ZSTD_REP_NUM      3                 /* number of repcodes */
  |  |  ------------------
  ------------------
  727|  8.11k|            if (ip+currentMl == iLimit) break; /* best possible, avoids read overflow on next attempt */
  ------------------
  |  Branch (727:17): [True: 396, False: 7.71k]
  ------------------
  728|  8.11k|        }
  729|       |
  730|  48.3k|        if (matchIndex <= minChain) break;
  ------------------
  |  Branch (730:13): [True: 0, False: 48.3k]
  ------------------
  731|  48.3k|        matchIndex = NEXT_IN_CHAIN(matchIndex, chainMask);
  ------------------
  |  |  626|  48.3k|#define NEXT_IN_CHAIN(d, mask)   chainTable[(d) & (mask)]
  ------------------
  732|  48.3k|    }
  733|       |
  734|   174k|    assert(nbAttempts <= (1U << ZSTD_SEARCHLOG_MAX)); /* Check we haven't underflowed. */
  ------------------
  |  |   70|   174k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  735|   174k|    if (dictMode == ZSTD_dedicatedDictSearch) {
  ------------------
  |  Branch (735:9): [True: 0, False: 174k]
  ------------------
  736|      0|        ml = ZSTD_dedicatedDictSearch_lazy_search(offsetPtr, ml, nbAttempts, dms,
  737|      0|                                                  ip, iLimit, prefixStart, curr, dictLimit, ddsIdx);
  738|   174k|    } else if (dictMode == ZSTD_dictMatchState) {
  ------------------
  |  Branch (738:16): [True: 0, False: 174k]
  ------------------
  739|      0|        const U32* const dmsChainTable = dms->chainTable;
  740|      0|        const U32 dmsChainSize         = (1 << dms->cParams.chainLog);
  741|      0|        const U32 dmsChainMask         = dmsChainSize - 1;
  742|      0|        const U32 dmsLowestIndex       = dms->window.dictLimit;
  743|      0|        const BYTE* const dmsBase      = dms->window.base;
  744|      0|        const BYTE* const dmsEnd       = dms->window.nextSrc;
  745|      0|        const U32 dmsSize              = (U32)(dmsEnd - dmsBase);
  746|      0|        const U32 dmsIndexDelta        = dictLimit - dmsSize;
  747|      0|        const U32 dmsMinChain = dmsSize > dmsChainSize ? dmsSize - dmsChainSize : 0;
  ------------------
  |  Branch (747:33): [True: 0, False: 0]
  ------------------
  748|       |
  749|      0|        matchIndex = dms->hashTable[ZSTD_hashPtr(ip, dms->cParams.hashLog, mls)];
  750|       |
  751|      0|        for ( ; (matchIndex>=dmsLowestIndex) & (nbAttempts>0) ; nbAttempts--) {
  ------------------
  |  Branch (751:17): [True: 0, False: 0]
  ------------------
  752|      0|            size_t currentMl=0;
  753|      0|            const BYTE* const match = dmsBase + matchIndex;
  754|      0|            assert(match+4 <= dmsEnd);
  ------------------
  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  755|      0|            if (MEM_read32(match) == MEM_read32(ip))   /* assumption : matchIndex <= dictLimit-4 (by table construction) */
  ------------------
  |  Branch (755:17): [True: 0, False: 0]
  ------------------
  756|      0|                currentMl = ZSTD_count_2segments(ip+4, match+4, iLimit, dmsEnd, prefixStart) + 4;
  757|       |
  758|       |            /* save best solution */
  759|      0|            if (currentMl > ml) {
  ------------------
  |  Branch (759:17): [True: 0, False: 0]
  ------------------
  760|      0|                ml = currentMl;
  761|      0|                assert(curr > matchIndex + dmsIndexDelta);
  ------------------
  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  762|      0|                *offsetPtr = OFFSET_TO_OFFBASE(curr - (matchIndex + dmsIndexDelta));
  ------------------
  |  |  751|      0|#define OFFSET_TO_OFFBASE(o)  (assert((o)>0), o + ZSTD_REP_NUM)
  |  |  ------------------
  |  |  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  |  |  ------------------
  |  |               #define OFFSET_TO_OFFBASE(o)  (assert((o)>0), o + ZSTD_REP_NUM)
  |  |  ------------------
  |  |  |  |   64|      0|#define ZSTD_REP_NUM      3                 /* number of repcodes */
  |  |  ------------------
  ------------------
  763|      0|                if (ip+currentMl == iLimit) break; /* best possible, avoids read overflow on next attempt */
  ------------------
  |  Branch (763:21): [True: 0, False: 0]
  ------------------
  764|      0|            }
  765|       |
  766|      0|            if (matchIndex <= dmsMinChain) break;
  ------------------
  |  Branch (766:17): [True: 0, False: 0]
  ------------------
  767|       |
  768|      0|            matchIndex = dmsChainTable[matchIndex & dmsChainMask];
  769|      0|        }
  770|      0|    }
  771|       |
  772|   174k|    return ml;
  773|   174k|}
zstd_lazy.c:ZSTD_BtFindBestMatch_noDict_4:
 1414|  31.6k|    {                                                                                  \
 1415|  31.6k|        assert(MAX(4, MIN(6, ms->cParams.minMatch)) == mls);                           \
  ------------------
  |  |   70|  31.6k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1416|  31.6k|        return ZSTD_BtFindBestMatch(ms, ip, iLimit, offBasePtr, mls, ZSTD_##dictMode); \
 1417|  31.6k|    }                                                                                  \
zstd_lazy.c:ZSTD_BtFindBestMatch:
  400|  31.6k|{
  401|  31.6k|    DEBUGLOG(7, "ZSTD_BtFindBestMatch");
  ------------------
  |  |  104|  31.6k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 31.6k]
  |  |  ------------------
  ------------------
  402|  31.6k|    if (ip < ms->window.base + ms->nextToUpdate) return 0;   /* skipped area */
  ------------------
  |  Branch (402:9): [True: 915, False: 30.7k]
  ------------------
  403|  30.7k|    ZSTD_updateDUBT(ms, ip, iLimit, mls);
  404|  30.7k|    return ZSTD_DUBT_findBestMatch(ms, ip, iLimit, offBasePtr, mls, dictMode);
  405|  31.6k|}
zstd_lazy.c:ZSTD_updateDUBT:
   32|  30.7k|{
   33|  30.7k|    const ZSTD_compressionParameters* const cParams = &ms->cParams;
   34|  30.7k|    U32* const hashTable = ms->hashTable;
   35|  30.7k|    U32  const hashLog = cParams->hashLog;
   36|       |
   37|  30.7k|    U32* const bt = ms->chainTable;
   38|  30.7k|    U32  const btLog  = cParams->chainLog - 1;
   39|  30.7k|    U32  const btMask = (1 << btLog) - 1;
   40|       |
   41|  30.7k|    const BYTE* const base = ms->window.base;
   42|  30.7k|    U32 const target = (U32)(ip - base);
   43|  30.7k|    U32 idx = ms->nextToUpdate;
   44|       |
   45|  30.7k|    if (idx != target)
  ------------------
  |  Branch (45:9): [True: 4.09k, False: 26.6k]
  ------------------
   46|  4.09k|        DEBUGLOG(7, "ZSTD_updateDUBT, from %u to %u (dictLimit:%u)",
  ------------------
  |  |  104|  4.09k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 4.09k]
  |  |  ------------------
  ------------------
   47|  30.7k|                    idx, target, ms->window.dictLimit);
   48|  30.7k|    assert(ip + 8 <= iend);   /* condition for ZSTD_hashPtr */
  ------------------
  |  |   70|  30.7k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
   49|  30.7k|    (void)iend;
   50|       |
   51|  30.7k|    assert(idx >= ms->window.dictLimit);   /* condition for valid base+idx */
  ------------------
  |  |   70|  30.7k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
   52|  60.8k|    for ( ; idx < target ; idx++) {
  ------------------
  |  Branch (52:13): [True: 30.0k, False: 30.7k]
  ------------------
   53|  30.0k|        size_t const h  = ZSTD_hashPtr(base + idx, hashLog, mls);   /* assumption : ip + 8 <= iend */
   54|  30.0k|        U32    const matchIndex = hashTable[h];
   55|       |
   56|  30.0k|        U32*   const nextCandidatePtr = bt + 2*(idx&btMask);
   57|  30.0k|        U32*   const sortMarkPtr  = nextCandidatePtr + 1;
   58|       |
   59|  30.0k|        DEBUGLOG(8, "ZSTD_updateDUBT: insert %u", idx);
  ------------------
  |  |  104|  30.0k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 30.0k]
  |  |  ------------------
  ------------------
   60|  30.0k|        hashTable[h] = idx;   /* Update Hash Table */
   61|  30.0k|        *nextCandidatePtr = matchIndex;   /* update BT like a chain */
   62|  30.0k|        *sortMarkPtr = ZSTD_DUBT_UNSORTED_MARK;
  ------------------
  |  |   34|  30.0k|#define ZSTD_DUBT_UNSORTED_MARK 1   /* For btlazy2 strategy, index ZSTD_DUBT_UNSORTED_MARK==1 means "unsorted".
  ------------------
   63|  30.0k|    }
   64|  30.7k|    ms->nextToUpdate = target;
   65|  30.7k|}
zstd_lazy.c:ZSTD_DUBT_findBestMatch:
  248|  30.7k|{
  249|  30.7k|    const ZSTD_compressionParameters* const cParams = &ms->cParams;
  250|  30.7k|    U32*   const hashTable = ms->hashTable;
  251|  30.7k|    U32    const hashLog = cParams->hashLog;
  252|  30.7k|    size_t const h  = ZSTD_hashPtr(ip, hashLog, mls);
  253|  30.7k|    U32          matchIndex  = hashTable[h];
  254|       |
  255|  30.7k|    const BYTE* const base = ms->window.base;
  256|  30.7k|    U32    const curr = (U32)(ip-base);
  257|  30.7k|    U32    const windowLow = ZSTD_getLowestMatchIndex(ms, curr, cParams->windowLog);
  258|       |
  259|  30.7k|    U32*   const bt = ms->chainTable;
  260|  30.7k|    U32    const btLog  = cParams->chainLog - 1;
  261|  30.7k|    U32    const btMask = (1 << btLog) - 1;
  262|  30.7k|    U32    const btLow = (btMask >= curr) ? 0 : curr - btMask;
  ------------------
  |  Branch (262:26): [True: 127, False: 30.6k]
  ------------------
  263|  30.7k|    U32    const unsortLimit = MAX(btLow, windowLow);
  ------------------
  |  |   55|  30.7k|#define MAX(a,b) ((a)>(b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (55:19): [True: 0, False: 30.7k]
  |  |  ------------------
  ------------------
  264|       |
  265|  30.7k|    U32*         nextCandidate = bt + 2*(matchIndex&btMask);
  266|  30.7k|    U32*         unsortedMark = bt + 2*(matchIndex&btMask) + 1;
  267|  30.7k|    U32          nbCompares = 1U << cParams->searchLog;
  268|  30.7k|    U32          nbCandidates = nbCompares;
  269|  30.7k|    U32          previousCandidate = 0;
  270|       |
  271|  30.7k|    DEBUGLOG(7, "ZSTD_DUBT_findBestMatch (%u) ", curr);
  ------------------
  |  |  104|  30.7k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 30.7k]
  |  |  ------------------
  ------------------
  272|  30.7k|    assert(ip <= iend-8);   /* required for h calculation */
  ------------------
  |  |   70|  30.7k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  273|  30.7k|    assert(dictMode != ZSTD_dedicatedDictSearch);
  ------------------
  |  |   70|  30.7k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  274|       |
  275|       |    /* reach end of unsorted candidates list */
  276|  42.5k|    while ( (matchIndex > unsortLimit)
  ------------------
  |  Branch (276:13): [True: 23.4k, False: 19.1k]
  ------------------
  277|  23.4k|         && (*unsortedMark == ZSTD_DUBT_UNSORTED_MARK)
  ------------------
  |  |   34|  23.4k|#define ZSTD_DUBT_UNSORTED_MARK 1   /* For btlazy2 strategy, index ZSTD_DUBT_UNSORTED_MARK==1 means "unsorted".
  ------------------
  |  Branch (277:13): [True: 11.8k, False: 11.5k]
  ------------------
  278|  11.8k|         && (nbCandidates > 1) ) {
  ------------------
  |  Branch (278:13): [True: 11.8k, False: 34]
  ------------------
  279|  11.8k|        DEBUGLOG(8, "ZSTD_DUBT_findBestMatch: candidate %u is unsorted",
  ------------------
  |  |  104|  11.8k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 11.8k]
  |  |  ------------------
  ------------------
  280|  11.8k|                    matchIndex);
  281|  11.8k|        *unsortedMark = previousCandidate;  /* the unsortedMark becomes a reversed chain, to move up back to original position */
  282|  11.8k|        previousCandidate = matchIndex;
  283|  11.8k|        matchIndex = *nextCandidate;
  284|  11.8k|        nextCandidate = bt + 2*(matchIndex&btMask);
  285|  11.8k|        unsortedMark = bt + 2*(matchIndex&btMask) + 1;
  286|  11.8k|        nbCandidates --;
  287|  11.8k|    }
  288|       |
  289|       |    /* nullify last candidate if it's still unsorted
  290|       |     * simplification, detrimental to compression ratio, beneficial for speed */
  291|  30.7k|    if ( (matchIndex > unsortLimit)
  ------------------
  |  Branch (291:10): [True: 11.5k, False: 19.1k]
  ------------------
  292|  11.5k|      && (*unsortedMark==ZSTD_DUBT_UNSORTED_MARK) ) {
  ------------------
  |  |   34|  11.5k|#define ZSTD_DUBT_UNSORTED_MARK 1   /* For btlazy2 strategy, index ZSTD_DUBT_UNSORTED_MARK==1 means "unsorted".
  ------------------
  |  Branch (292:10): [True: 34, False: 11.5k]
  ------------------
  293|     34|        DEBUGLOG(7, "ZSTD_DUBT_findBestMatch: nullify last unsorted candidate %u",
  ------------------
  |  |  104|     34|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 34]
  |  |  ------------------
  ------------------
  294|     34|                    matchIndex);
  295|     34|        *nextCandidate = *unsortedMark = 0;
  296|     34|    }
  297|       |
  298|       |    /* batch sort stacked candidates */
  299|  30.7k|    matchIndex = previousCandidate;
  300|  42.5k|    while (matchIndex) {  /* will end on matchIndex == 0 */
  ------------------
  |  Branch (300:12): [True: 11.8k, False: 30.7k]
  ------------------
  301|  11.8k|        U32* const nextCandidateIdxPtr = bt + 2*(matchIndex&btMask) + 1;
  302|  11.8k|        U32 const nextCandidateIdx = *nextCandidateIdxPtr;
  303|  11.8k|        ZSTD_insertDUBT1(ms, matchIndex, iend,
  304|  11.8k|                         nbCandidates, unsortLimit, dictMode);
  305|  11.8k|        matchIndex = nextCandidateIdx;
  306|  11.8k|        nbCandidates++;
  307|  11.8k|    }
  308|       |
  309|       |    /* find longest match */
  310|  30.7k|    {   size_t commonLengthSmaller = 0, commonLengthLarger = 0;
  311|  30.7k|        const BYTE* const dictBase = ms->window.dictBase;
  312|  30.7k|        const U32 dictLimit = ms->window.dictLimit;
  313|  30.7k|        const BYTE* const dictEnd = dictBase + dictLimit;
  314|  30.7k|        const BYTE* const prefixStart = base + dictLimit;
  315|  30.7k|        U32* smallerPtr = bt + 2*(curr&btMask);
  316|  30.7k|        U32* largerPtr  = bt + 2*(curr&btMask) + 1;
  317|  30.7k|        U32 matchEndIdx = curr + 8 + 1;
  318|  30.7k|        U32 dummy32;   /* to be nullified at the end */
  319|  30.7k|        size_t bestLength = 0;
  320|       |
  321|  30.7k|        matchIndex  = hashTable[h];
  322|  30.7k|        hashTable[h] = curr;   /* Update Hash Table */
  323|       |
  324|  64.6k|        for (; nbCompares && (matchIndex > windowLow); --nbCompares) {
  ------------------
  |  Branch (324:16): [True: 64.6k, False: 0]
  |  Branch (324:30): [True: 34.3k, False: 30.3k]
  ------------------
  325|  34.3k|            U32* const nextPtr = bt + 2*(matchIndex & btMask);
  326|  34.3k|            size_t matchLength = MIN(commonLengthSmaller, commonLengthLarger);   /* guaranteed minimum nb of common bytes */
  ------------------
  |  |   54|  34.3k|#define MIN(a,b) ((a)<(b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (54:19): [True: 8.43k, False: 25.8k]
  |  |  ------------------
  ------------------
  327|  34.3k|            const BYTE* match;
  328|       |
  329|  34.3k|            if ((dictMode != ZSTD_extDict) || (matchIndex+matchLength >= dictLimit)) {
  ------------------
  |  Branch (329:17): [True: 34.3k, False: 0]
  |  Branch (329:47): [True: 0, False: 0]
  ------------------
  330|  34.3k|                match = base + matchIndex;
  331|  34.3k|                matchLength += ZSTD_count(ip+matchLength, match+matchLength, iend);
  332|  34.3k|            } else {
  333|      0|                match = dictBase + matchIndex;
  334|      0|                matchLength += ZSTD_count_2segments(ip+matchLength, match+matchLength, iend, dictEnd, prefixStart);
  335|      0|                if (matchIndex+matchLength >= dictLimit)
  ------------------
  |  Branch (335:21): [True: 0, False: 0]
  ------------------
  336|      0|                    match = base + matchIndex;   /* to prepare for next usage of match[matchLength] */
  337|      0|            }
  338|       |
  339|  34.3k|            if (matchLength > bestLength) {
  ------------------
  |  Branch (339:17): [True: 18.5k, False: 15.7k]
  ------------------
  340|  18.5k|                if (matchLength > matchEndIdx - matchIndex)
  ------------------
  |  Branch (340:21): [True: 674, False: 17.8k]
  ------------------
  341|    674|                    matchEndIdx = matchIndex + (U32)matchLength;
  342|  18.5k|                if ( (4*(int)(matchLength-bestLength)) > (int)(ZSTD_highbit32(curr - matchIndex + 1) - ZSTD_highbit32((U32)*offBasePtr)) )
  ------------------
  |  Branch (342:22): [True: 18.5k, False: 0]
  ------------------
  343|  18.5k|                    bestLength = matchLength, *offBasePtr = OFFSET_TO_OFFBASE(curr - matchIndex);
  ------------------
  |  |  751|  18.5k|#define OFFSET_TO_OFFBASE(o)  (assert((o)>0), o + ZSTD_REP_NUM)
  |  |  ------------------
  |  |  |  |   70|  18.5k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  |  |  ------------------
  |  |               #define OFFSET_TO_OFFBASE(o)  (assert((o)>0), o + ZSTD_REP_NUM)
  |  |  ------------------
  |  |  |  |   64|  18.5k|#define ZSTD_REP_NUM      3                 /* number of repcodes */
  |  |  ------------------
  ------------------
  344|  18.5k|                if (ip+matchLength == iend) {   /* equal : no way to know if inf or sup */
  ------------------
  |  Branch (344:21): [True: 360, False: 18.1k]
  ------------------
  345|    360|                    if (dictMode == ZSTD_dictMatchState) {
  ------------------
  |  Branch (345:25): [True: 0, False: 360]
  ------------------
  346|      0|                        nbCompares = 0; /* in addition to avoiding checking any
  347|       |                                         * further in this loop, make sure we
  348|       |                                         * skip checking in the dictionary. */
  349|      0|                    }
  350|    360|                    break;   /* drop, to guarantee consistency (miss a little bit of compression) */
  351|    360|                }
  352|  18.5k|            }
  353|       |
  354|  33.9k|            if (match[matchLength] < ip[matchLength]) {
  ------------------
  |  Branch (354:17): [True: 13.3k, False: 20.6k]
  ------------------
  355|       |                /* match is smaller than current */
  356|  13.3k|                *smallerPtr = matchIndex;             /* update smaller idx */
  357|  13.3k|                commonLengthSmaller = matchLength;    /* all smaller will now have at least this guaranteed common length */
  358|  13.3k|                if (matchIndex <= btLow) { smallerPtr=&dummy32; break; }   /* beyond tree size, stop the search */
  ------------------
  |  Branch (358:21): [True: 0, False: 13.3k]
  ------------------
  359|  13.3k|                smallerPtr = nextPtr+1;               /* new "smaller" => larger of match */
  360|  13.3k|                matchIndex = nextPtr[1];              /* new matchIndex larger than previous (closer to current) */
  361|  20.6k|            } else {
  362|       |                /* match is larger than current */
  363|  20.6k|                *largerPtr = matchIndex;
  364|  20.6k|                commonLengthLarger = matchLength;
  365|  20.6k|                if (matchIndex <= btLow) { largerPtr=&dummy32; break; }   /* beyond tree size, stop the search */
  ------------------
  |  Branch (365:21): [True: 0, False: 20.6k]
  ------------------
  366|  20.6k|                largerPtr = nextPtr;
  367|  20.6k|                matchIndex = nextPtr[0];
  368|  20.6k|        }   }
  369|       |
  370|  30.7k|        *smallerPtr = *largerPtr = 0;
  371|       |
  372|  30.7k|        assert(nbCompares <= (1U << ZSTD_SEARCHLOG_MAX)); /* Check we haven't underflowed. */
  ------------------
  |  |   70|  30.7k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  373|  30.7k|        if (dictMode == ZSTD_dictMatchState && nbCompares) {
  ------------------
  |  Branch (373:13): [True: 0, False: 30.7k]
  |  Branch (373:48): [True: 0, False: 0]
  ------------------
  374|      0|            bestLength = ZSTD_DUBT_findBetterDictMatch(
  375|      0|                    ms, ip, iend,
  376|      0|                    offBasePtr, bestLength, nbCompares,
  377|      0|                    mls, dictMode);
  378|      0|        }
  379|       |
  380|  30.7k|        assert(matchEndIdx > curr+8); /* ensure nextToUpdate is increased */
  ------------------
  |  |   70|  30.7k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  381|  30.7k|        ms->nextToUpdate = matchEndIdx - 8;   /* skip repetitive patterns */
  382|  30.7k|        if (bestLength >= MINMATCH) {
  ------------------
  |  |   98|  30.7k|#define MINMATCH 3
  ------------------
  |  Branch (382:13): [True: 9.65k, False: 21.0k]
  ------------------
  383|  9.65k|            U32 const mIndex = curr - (U32)OFFBASE_TO_OFFSET(*offBasePtr); (void)mIndex;
  ------------------
  |  |  754|  9.65k|#define OFFBASE_TO_OFFSET(o)  (assert(OFFBASE_IS_OFFSET(o)), (o) - ZSTD_REP_NUM)
  |  |  ------------------
  |  |  |  |   70|  9.65k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  |  |  ------------------
  |  |               #define OFFBASE_TO_OFFSET(o)  (assert(OFFBASE_IS_OFFSET(o)), (o) - ZSTD_REP_NUM)
  |  |  ------------------
  |  |  |  |   64|  9.65k|#define ZSTD_REP_NUM      3                 /* number of repcodes */
  |  |  ------------------
  ------------------
  384|  9.65k|            DEBUGLOG(8, "ZSTD_DUBT_findBestMatch(%u) : found match of length %u and offsetCode %u (pos %u)",
  ------------------
  |  |  104|  9.65k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 9.65k]
  |  |  ------------------
  ------------------
  385|  9.65k|                        curr, (U32)bestLength, (U32)*offBasePtr, mIndex);
  386|  9.65k|        }
  387|  30.7k|        return bestLength;
  388|  30.7k|    }
  389|  30.7k|}
zstd_lazy.c:ZSTD_insertDUBT1:
   78|  11.8k|{
   79|  11.8k|    const ZSTD_compressionParameters* const cParams = &ms->cParams;
   80|  11.8k|    U32* const bt = ms->chainTable;
   81|  11.8k|    U32  const btLog  = cParams->chainLog - 1;
   82|  11.8k|    U32  const btMask = (1 << btLog) - 1;
   83|  11.8k|    size_t commonLengthSmaller=0, commonLengthLarger=0;
   84|  11.8k|    const BYTE* const base = ms->window.base;
   85|  11.8k|    const BYTE* const dictBase = ms->window.dictBase;
   86|  11.8k|    const U32 dictLimit = ms->window.dictLimit;
   87|  11.8k|    const BYTE* const ip = (curr>=dictLimit) ? base + curr : dictBase + curr;
  ------------------
  |  Branch (87:28): [True: 11.8k, False: 0]
  ------------------
   88|  11.8k|    const BYTE* const iend = (curr>=dictLimit) ? inputEnd : dictBase + dictLimit;
  ------------------
  |  Branch (88:30): [True: 11.8k, False: 0]
  ------------------
   89|  11.8k|    const BYTE* const dictEnd = dictBase + dictLimit;
   90|  11.8k|    const BYTE* const prefixStart = base + dictLimit;
   91|  11.8k|    const BYTE* match;
   92|  11.8k|    U32* smallerPtr = bt + 2*(curr&btMask);
   93|  11.8k|    U32* largerPtr  = smallerPtr + 1;
   94|  11.8k|    U32 matchIndex = *smallerPtr;   /* this candidate is unsorted : next sorted candidate is reached through *smallerPtr, while *largerPtr contains previous unsorted candidate (which is already saved and can be overwritten) */
   95|  11.8k|    U32 dummy32;   /* to be nullified at the end */
   96|  11.8k|    U32 const windowValid = ms->window.lowLimit;
   97|  11.8k|    U32 const maxDistance = 1U << cParams->windowLog;
   98|  11.8k|    U32 const windowLow = (curr - windowValid > maxDistance) ? curr - maxDistance : windowValid;
  ------------------
  |  Branch (98:27): [True: 0, False: 11.8k]
  ------------------
   99|       |
  100|       |
  101|  11.8k|    DEBUGLOG(8, "ZSTD_insertDUBT1(%u) (dictLimit=%u, lowLimit=%u)",
  ------------------
  |  |  104|  11.8k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 11.8k]
  |  |  ------------------
  ------------------
  102|  11.8k|                curr, dictLimit, windowLow);
  103|  11.8k|    assert(curr >= btLow);
  ------------------
  |  |   70|  11.8k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  104|  11.8k|    assert(ip < iend);   /* condition for ZSTD_count */
  ------------------
  |  |   70|  11.8k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  105|       |
  106|  61.8k|    for (; nbCompares && (matchIndex > windowLow); --nbCompares) {
  ------------------
  |  Branch (106:12): [True: 61.7k, False: 61]
  |  Branch (106:26): [True: 50.3k, False: 11.4k]
  ------------------
  107|  50.3k|        U32* const nextPtr = bt + 2*(matchIndex & btMask);
  108|  50.3k|        size_t matchLength = MIN(commonLengthSmaller, commonLengthLarger);   /* guaranteed minimum nb of common bytes */
  ------------------
  |  |   54|  50.3k|#define MIN(a,b) ((a)<(b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (54:19): [True: 9.42k, False: 40.9k]
  |  |  ------------------
  ------------------
  109|  50.3k|        assert(matchIndex < curr);
  ------------------
  |  |   70|  50.3k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  110|       |        /* note : all candidates are now supposed sorted,
  111|       |         * but it's still possible to have nextPtr[1] == ZSTD_DUBT_UNSORTED_MARK
  112|       |         * when a real index has the same value as ZSTD_DUBT_UNSORTED_MARK */
  113|       |
  114|  50.3k|        if ( (dictMode != ZSTD_extDict)
  ------------------
  |  Branch (114:14): [True: 50.3k, False: 0]
  ------------------
  115|      0|          || (matchIndex+matchLength >= dictLimit)  /* both in current segment*/
  ------------------
  |  Branch (115:14): [True: 0, False: 0]
  ------------------
  116|  50.3k|          || (curr < dictLimit) /* both in extDict */) {
  ------------------
  |  Branch (116:14): [True: 0, False: 0]
  ------------------
  117|  50.3k|            const BYTE* const mBase = ( (dictMode != ZSTD_extDict)
  ------------------
  |  Branch (117:41): [True: 50.3k, False: 0]
  ------------------
  118|      0|                                     || (matchIndex+matchLength >= dictLimit)) ?
  ------------------
  |  Branch (118:41): [True: 0, False: 0]
  ------------------
  119|  50.3k|                                        base : dictBase;
  120|  50.3k|            assert( (matchIndex+matchLength >= dictLimit)   /* might be wrong if extDict is incorrectly set to 0 */
  ------------------
  |  |   70|  50.3k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  121|  50.3k|                 || (curr < dictLimit) );
  122|  50.3k|            match = mBase + matchIndex;
  123|  50.3k|            matchLength += ZSTD_count(ip+matchLength, match+matchLength, iend);
  124|  50.3k|        } else {
  125|      0|            match = dictBase + matchIndex;
  126|      0|            matchLength += ZSTD_count_2segments(ip+matchLength, match+matchLength, iend, dictEnd, prefixStart);
  127|      0|            if (matchIndex+matchLength >= dictLimit)
  ------------------
  |  Branch (127:17): [True: 0, False: 0]
  ------------------
  128|      0|                match = base + matchIndex;   /* preparation for next read of match[matchLength] */
  129|      0|        }
  130|       |
  131|  50.3k|        DEBUGLOG(8, "ZSTD_insertDUBT1: comparing %u with %u : found %u common bytes ",
  ------------------
  |  |  104|  50.3k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 50.3k]
  |  |  ------------------
  ------------------
  132|  50.3k|                    curr, matchIndex, (U32)matchLength);
  133|       |
  134|  50.3k|        if (ip+matchLength == iend) {   /* equal : no way to know if inf or sup */
  ------------------
  |  Branch (134:13): [True: 375, False: 49.9k]
  ------------------
  135|    375|            break;   /* drop , to guarantee consistency ; miss a bit of compression, but other solutions can corrupt tree */
  136|    375|        }
  137|       |
  138|  49.9k|        if (match[matchLength] < ip[matchLength]) {  /* necessarily within buffer */
  ------------------
  |  Branch (138:13): [True: 23.1k, False: 26.8k]
  ------------------
  139|       |            /* match is smaller than current */
  140|  23.1k|            *smallerPtr = matchIndex;             /* update smaller idx */
  141|  23.1k|            commonLengthSmaller = matchLength;    /* all smaller will now have at least this guaranteed common length */
  142|  23.1k|            if (matchIndex <= btLow) { smallerPtr=&dummy32; break; }   /* beyond tree size, stop searching */
  ------------------
  |  Branch (142:17): [True: 0, False: 23.1k]
  ------------------
  143|  23.1k|            DEBUGLOG(8, "ZSTD_insertDUBT1: %u (>btLow=%u) is smaller : next => %u",
  ------------------
  |  |  104|  23.1k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 23.1k]
  |  |  ------------------
  ------------------
  144|  23.1k|                        matchIndex, btLow, nextPtr[1]);
  145|  23.1k|            smallerPtr = nextPtr+1;               /* new "candidate" => larger than match, which was smaller than target */
  146|  23.1k|            matchIndex = nextPtr[1];              /* new matchIndex, larger than previous and closer to current */
  147|  26.8k|        } else {
  148|       |            /* match is larger than current */
  149|  26.8k|            *largerPtr = matchIndex;
  150|  26.8k|            commonLengthLarger = matchLength;
  151|  26.8k|            if (matchIndex <= btLow) { largerPtr=&dummy32; break; }   /* beyond tree size, stop searching */
  ------------------
  |  Branch (151:17): [True: 0, False: 26.8k]
  ------------------
  152|  26.8k|            DEBUGLOG(8, "ZSTD_insertDUBT1: %u (>btLow=%u) is larger => %u",
  ------------------
  |  |  104|  26.8k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 26.8k]
  |  |  ------------------
  ------------------
  153|  26.8k|                        matchIndex, btLow, nextPtr[0]);
  154|  26.8k|            largerPtr = nextPtr;
  155|  26.8k|            matchIndex = nextPtr[0];
  156|  26.8k|    }   }
  157|       |
  158|  11.8k|    *smallerPtr = *largerPtr = 0;
  159|  11.8k|}

ZSTD_ldm_getTableSize:
  170|  4.36k|{
  171|  4.36k|    size_t const ldmHSize = ((size_t)1) << params.hashLog;
  172|  4.36k|    size_t const ldmBucketSizeLog = MIN(params.bucketSizeLog, params.hashLog);
  ------------------
  |  |   54|  4.36k|#define MIN(a,b) ((a)<(b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (54:19): [True: 0, False: 4.36k]
  |  |  ------------------
  ------------------
  173|  4.36k|    size_t const ldmBucketSize = ((size_t)1) << (params.hashLog - ldmBucketSizeLog);
  174|  4.36k|    size_t const totalSize = ZSTD_cwksp_alloc_size(ldmBucketSize)
  175|  4.36k|                           + ZSTD_cwksp_alloc_size(ldmHSize * sizeof(ldmEntry_t));
  176|  4.36k|    return params.enableLdm == ZSTD_ps_enable ? totalSize : 0;
  ------------------
  |  Branch (176:12): [True: 0, False: 4.36k]
  ------------------
  177|  4.36k|}
ZSTD_ldm_getMaxNbSeq:
  180|  8.72k|{
  181|  8.72k|    return params.enableLdm == ZSTD_ps_enable ? (maxChunkSize / params.minMatchLength) : 0;
  ------------------
  |  Branch (181:12): [True: 0, False: 8.72k]
  ------------------
  182|  8.72k|}

ZSTD_compressBlock_btopt:
 1465|    256|{
 1466|    256|    DEBUGLOG(5, "ZSTD_compressBlock_btopt");
  ------------------
  |  |  104|    256|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 256]
  |  |  ------------------
  ------------------
 1467|    256|    return ZSTD_compressBlock_opt0(ms, seqStore, rep, src, srcSize, ZSTD_noDict);
 1468|    256|}
ZSTD_compressBlock_btultra:
 1510|  1.21k|{
 1511|  1.21k|    DEBUGLOG(5, "ZSTD_compressBlock_btultra (srcSize=%zu)", srcSize);
  ------------------
  |  |  104|  1.21k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 1.21k]
  |  |  ------------------
  ------------------
 1512|  1.21k|    return ZSTD_compressBlock_opt2(ms, seqStore, rep, src, srcSize, ZSTD_noDict);
 1513|  1.21k|}
ZSTD_compressBlock_btultra2:
 1518|    320|{
 1519|    320|    U32 const curr = (U32)((const BYTE*)src - ms->window.base);
 1520|    320|    DEBUGLOG(5, "ZSTD_compressBlock_btultra2 (srcSize=%zu)", srcSize);
  ------------------
  |  |  104|    320|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 320]
  |  |  ------------------
  ------------------
 1521|       |
 1522|       |    /* 2-passes strategy:
 1523|       |     * this strategy makes a first pass over first block to collect statistics
 1524|       |     * in order to seed next round's statistics with it.
 1525|       |     * After 1st pass, function forgets history, and starts a new block.
 1526|       |     * Consequently, this can only work if no data has been previously loaded in tables,
 1527|       |     * aka, no dictionary, no prefix, no ldm preprocessing.
 1528|       |     * The compression ratio gain is generally small (~0.5% on first block),
 1529|       |     * the cost is 2x cpu time on first block. */
 1530|    320|    assert(srcSize <= ZSTD_BLOCKSIZE_MAX);
  ------------------
  |  |   70|    320|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1531|    320|    if ( (ms->opt.litLengthSum==0)   /* first block */
  ------------------
  |  Branch (1531:10): [True: 320, False: 0]
  ------------------
 1532|    320|      && (seqStore->sequences == seqStore->sequencesStart)  /* no ldm */
  ------------------
  |  Branch (1532:10): [True: 320, False: 0]
  ------------------
 1533|    320|      && (ms->window.dictLimit == ms->window.lowLimit)   /* no dictionary */
  ------------------
  |  Branch (1533:10): [True: 320, False: 0]
  ------------------
 1534|    320|      && (curr == ms->window.dictLimit)    /* start of frame, nothing already loaded nor skipped */
  ------------------
  |  Branch (1534:10): [True: 320, False: 0]
  ------------------
 1535|    320|      && (srcSize > ZSTD_PREDEF_THRESHOLD) /* input large enough to not employ default stats */
  ------------------
  |  |   22|    320|#define ZSTD_PREDEF_THRESHOLD 8   /* if srcSize < ZSTD_PREDEF_THRESHOLD, symbols' cost is assumed static, directly determined by pre-defined distributions */
  ------------------
  |  Branch (1535:10): [True: 320, False: 0]
  ------------------
 1536|    320|      ) {
 1537|    320|        ZSTD_initStats_ultra(ms, seqStore, rep, src, srcSize);
 1538|    320|    }
 1539|       |
 1540|    320|    return ZSTD_compressBlock_opt2(ms, seqStore, rep, src, srcSize, ZSTD_noDict);
 1541|    320|}
zstd_opt.c:ZSTD_updateTree_internal:
  572|   215k|{
  573|   215k|    const BYTE* const base = ms->window.base;
  574|   215k|    U32 const target = (U32)(ip - base);
  575|   215k|    U32 idx = ms->nextToUpdate;
  576|   215k|    DEBUGLOG(7, "ZSTD_updateTree_internal, from %u to %u  (dictMode:%u)",
  ------------------
  |  |  104|   215k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 215k]
  |  |  ------------------
  ------------------
  577|   215k|                idx, target, dictMode);
  578|       |
  579|   222k|    while(idx < target) {
  ------------------
  |  Branch (579:11): [True: 6.54k, False: 215k]
  ------------------
  580|  6.54k|        U32 const forward = ZSTD_insertBt1(ms, base+idx, iend, target, mls, dictMode == ZSTD_extDict);
  581|  6.54k|        assert(idx < (U32)(idx + forward));
  ------------------
  |  |   70|  6.54k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  582|  6.54k|        idx += forward;
  583|  6.54k|    }
  584|   215k|    assert((size_t)(ip - base) <= (size_t)(U32)(-1));
  ------------------
  |  |   70|   215k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  585|   215k|    assert((size_t)(iend - base) <= (size_t)(U32)(-1));
  ------------------
  |  |   70|   215k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  586|   215k|    ms->nextToUpdate = target;
  587|   215k|}
zstd_opt.c:ZSTD_insertBt1:
  453|  6.54k|{
  454|  6.54k|    const ZSTD_compressionParameters* const cParams = &ms->cParams;
  455|  6.54k|    U32*   const hashTable = ms->hashTable;
  456|  6.54k|    U32    const hashLog = cParams->hashLog;
  457|  6.54k|    size_t const h  = ZSTD_hashPtr(ip, hashLog, mls);
  458|  6.54k|    U32*   const bt = ms->chainTable;
  459|  6.54k|    U32    const btLog  = cParams->chainLog - 1;
  460|  6.54k|    U32    const btMask = (1 << btLog) - 1;
  461|  6.54k|    U32 matchIndex = hashTable[h];
  462|  6.54k|    size_t commonLengthSmaller=0, commonLengthLarger=0;
  463|  6.54k|    const BYTE* const base = ms->window.base;
  464|  6.54k|    const BYTE* const dictBase = ms->window.dictBase;
  465|  6.54k|    const U32 dictLimit = ms->window.dictLimit;
  466|  6.54k|    const BYTE* const dictEnd = dictBase + dictLimit;
  467|  6.54k|    const BYTE* const prefixStart = base + dictLimit;
  468|  6.54k|    const BYTE* match;
  469|  6.54k|    const U32 curr = (U32)(ip-base);
  470|  6.54k|    const U32 btLow = btMask >= curr ? 0 : curr - btMask;
  ------------------
  |  Branch (470:23): [True: 27, False: 6.51k]
  ------------------
  471|  6.54k|    U32* smallerPtr = bt + 2*(curr&btMask);
  472|  6.54k|    U32* largerPtr  = smallerPtr + 1;
  473|  6.54k|    U32 dummy32;   /* to be nullified at the end */
  474|       |    /* windowLow is based on target because
  475|       |     * we only need positions that will be in the window at the end of the tree update.
  476|       |     */
  477|  6.54k|    U32 const windowLow = ZSTD_getLowestMatchIndex(ms, target, cParams->windowLog);
  478|  6.54k|    U32 matchEndIdx = curr+8+1;
  479|  6.54k|    size_t bestLength = 8;
  480|  6.54k|    U32 nbCompares = 1U << cParams->searchLog;
  481|       |#ifdef ZSTD_C_PREDICT
  482|       |    U32 predictedSmall = *(bt + 2*((curr-1)&btMask) + 0);
  483|       |    U32 predictedLarge = *(bt + 2*((curr-1)&btMask) + 1);
  484|       |    predictedSmall += (predictedSmall>0);
  485|       |    predictedLarge += (predictedLarge>0);
  486|       |#endif /* ZSTD_C_PREDICT */
  487|       |
  488|  6.54k|    DEBUGLOG(8, "ZSTD_insertBt1 (%u)", curr);
  ------------------
  |  |  104|  6.54k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 6.54k]
  |  |  ------------------
  ------------------
  489|       |
  490|  6.54k|    assert(curr <= target);
  ------------------
  |  |   70|  6.54k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  491|  6.54k|    assert(ip <= iend-8);   /* required for h calculation */
  ------------------
  |  |   70|  6.54k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  492|  6.54k|    hashTable[h] = curr;   /* Update Hash Table */
  493|       |
  494|  6.54k|    assert(windowLow > 0);
  ------------------
  |  |   70|  6.54k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  495|  14.3k|    for (; nbCompares && (matchIndex >= windowLow); --nbCompares) {
  ------------------
  |  Branch (495:12): [True: 14.2k, False: 77]
  |  Branch (495:26): [True: 7.97k, False: 6.30k]
  ------------------
  496|  7.97k|        U32* const nextPtr = bt + 2*(matchIndex & btMask);
  497|  7.97k|        size_t matchLength = MIN(commonLengthSmaller, commonLengthLarger);   /* guaranteed minimum nb of common bytes */
  ------------------
  |  |   54|  7.97k|#define MIN(a,b) ((a)<(b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (54:19): [True: 827, False: 7.14k]
  |  |  ------------------
  ------------------
  498|  7.97k|        assert(matchIndex < curr);
  ------------------
  |  |   70|  7.97k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  499|       |
  500|       |#ifdef ZSTD_C_PREDICT   /* note : can create issues when hlog small <= 11 */
  501|       |        const U32* predictPtr = bt + 2*((matchIndex-1) & btMask);   /* written this way, as bt is a roll buffer */
  502|       |        if (matchIndex == predictedSmall) {
  503|       |            /* no need to check length, result known */
  504|       |            *smallerPtr = matchIndex;
  505|       |            if (matchIndex <= btLow) { smallerPtr=&dummy32; break; }   /* beyond tree size, stop the search */
  506|       |            smallerPtr = nextPtr+1;               /* new "smaller" => larger of match */
  507|       |            matchIndex = nextPtr[1];              /* new matchIndex larger than previous (closer to current) */
  508|       |            predictedSmall = predictPtr[1] + (predictPtr[1]>0);
  509|       |            continue;
  510|       |        }
  511|       |        if (matchIndex == predictedLarge) {
  512|       |            *largerPtr = matchIndex;
  513|       |            if (matchIndex <= btLow) { largerPtr=&dummy32; break; }   /* beyond tree size, stop the search */
  514|       |            largerPtr = nextPtr;
  515|       |            matchIndex = nextPtr[0];
  516|       |            predictedLarge = predictPtr[0] + (predictPtr[0]>0);
  517|       |            continue;
  518|       |        }
  519|       |#endif
  520|       |
  521|  7.97k|        if (!extDict || (matchIndex+matchLength >= dictLimit)) {
  ------------------
  |  Branch (521:13): [True: 7.97k, False: 0]
  |  Branch (521:25): [True: 0, False: 0]
  ------------------
  522|  7.97k|            assert(matchIndex+matchLength >= dictLimit);   /* might be wrong if actually extDict */
  ------------------
  |  |   70|  7.97k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  523|  7.97k|            match = base + matchIndex;
  524|  7.97k|            matchLength += ZSTD_count(ip+matchLength, match+matchLength, iend);
  525|  7.97k|        } else {
  526|      0|            match = dictBase + matchIndex;
  527|      0|            matchLength += ZSTD_count_2segments(ip+matchLength, match+matchLength, iend, dictEnd, prefixStart);
  528|      0|            if (matchIndex+matchLength >= dictLimit)
  ------------------
  |  Branch (528:17): [True: 0, False: 0]
  ------------------
  529|      0|                match = base + matchIndex;   /* to prepare for next usage of match[matchLength] */
  530|      0|        }
  531|       |
  532|  7.97k|        if (matchLength > bestLength) {
  ------------------
  |  Branch (532:13): [True: 1.88k, False: 6.08k]
  ------------------
  533|  1.88k|            bestLength = matchLength;
  534|  1.88k|            if (matchLength > matchEndIdx - matchIndex)
  ------------------
  |  Branch (534:17): [True: 489, False: 1.39k]
  ------------------
  535|    489|                matchEndIdx = matchIndex + (U32)matchLength;
  536|  1.88k|        }
  537|       |
  538|  7.97k|        if (ip+matchLength == iend) {   /* equal : no way to know if inf or sup */
  ------------------
  |  Branch (538:13): [True: 157, False: 7.81k]
  ------------------
  539|    157|            break;   /* drop , to guarantee consistency ; miss a bit of compression, but other solutions can corrupt tree */
  540|    157|        }
  541|       |
  542|  7.81k|        if (match[matchLength] < ip[matchLength]) {  /* necessarily within buffer */
  ------------------
  |  Branch (542:13): [True: 4.02k, False: 3.78k]
  ------------------
  543|       |            /* match is smaller than current */
  544|  4.02k|            *smallerPtr = matchIndex;             /* update smaller idx */
  545|  4.02k|            commonLengthSmaller = matchLength;    /* all smaller will now have at least this guaranteed common length */
  546|  4.02k|            if (matchIndex <= btLow) { smallerPtr=&dummy32; break; }   /* beyond tree size, stop searching */
  ------------------
  |  Branch (546:17): [True: 0, False: 4.02k]
  ------------------
  547|  4.02k|            smallerPtr = nextPtr+1;               /* new "candidate" => larger than match, which was smaller than target */
  548|  4.02k|            matchIndex = nextPtr[1];              /* new matchIndex, larger than previous and closer to current */
  549|  4.02k|        } else {
  550|       |            /* match is larger than current */
  551|  3.78k|            *largerPtr = matchIndex;
  552|  3.78k|            commonLengthLarger = matchLength;
  553|  3.78k|            if (matchIndex <= btLow) { largerPtr=&dummy32; break; }   /* beyond tree size, stop searching */
  ------------------
  |  Branch (553:17): [True: 0, False: 3.78k]
  ------------------
  554|  3.78k|            largerPtr = nextPtr;
  555|  3.78k|            matchIndex = nextPtr[0];
  556|  3.78k|    }   }
  557|       |
  558|  6.54k|    *smallerPtr = *largerPtr = 0;
  559|  6.54k|    {   U32 positions = 0;
  560|  6.54k|        if (bestLength > 384) positions = MIN(192, (U32)(bestLength - 384));   /* speed optimization */
  ------------------
  |  |   54|      0|#define MIN(a,b) ((a)<(b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (54:19): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (560:13): [True: 0, False: 6.54k]
  ------------------
  561|  6.54k|        assert(matchEndIdx > curr + 8);
  ------------------
  |  |   70|  6.54k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  562|  6.54k|        return MAX(positions, matchEndIdx - (curr + 8));
  ------------------
  |  |   55|  6.54k|#define MAX(a,b) ((a)>(b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (55:19): [True: 0, False: 6.54k]
  |  |  ------------------
  ------------------
  563|  6.54k|    }
  564|  6.54k|}
zstd_opt.c:ZSTD_compressBlock_opt0:
 1447|    256|{
 1448|    256|    return ZSTD_compressBlock_opt_generic(ms, seqStore, rep, src, srcSize, 0 /* optLevel */, dictMode);
 1449|    256|}
zstd_opt.c:ZSTD_compressBlock_opt_generic:
 1089|  2.11k|{
 1090|  2.11k|    optState_t* const optStatePtr = &ms->opt;
 1091|  2.11k|    const BYTE* const istart = (const BYTE*)src;
 1092|  2.11k|    const BYTE* ip = istart;
 1093|  2.11k|    const BYTE* anchor = istart;
 1094|  2.11k|    const BYTE* const iend = istart + srcSize;
 1095|  2.11k|    const BYTE* const ilimit = iend - 8;
 1096|  2.11k|    const BYTE* const base = ms->window.base;
 1097|  2.11k|    const BYTE* const prefixStart = base + ms->window.dictLimit;
 1098|  2.11k|    const ZSTD_compressionParameters* const cParams = &ms->cParams;
 1099|       |
 1100|  2.11k|    ZSTD_getAllMatchesFn getAllMatches = ZSTD_selectBtGetAllMatches(ms, dictMode);
 1101|       |
 1102|  2.11k|    U32 const sufficient_len = MIN(cParams->targetLength, ZSTD_OPT_NUM -1);
  ------------------
  |  |   54|  2.11k|#define MIN(a,b) ((a)<(b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (54:19): [True: 2.11k, False: 0]
  |  |  ------------------
  ------------------
 1103|  2.11k|    U32 const minMatch = (cParams->minMatch == 3) ? 3 : 4;
  ------------------
  |  Branch (1103:26): [True: 1.85k, False: 256]
  ------------------
 1104|  2.11k|    U32 nextToUpdate3 = ms->nextToUpdate;
 1105|       |
 1106|  2.11k|    ZSTD_optimal_t* const opt = optStatePtr->priceTable;
 1107|  2.11k|    ZSTD_match_t* const matches = optStatePtr->matchTable;
 1108|  2.11k|    ZSTD_optimal_t lastStretch;
 1109|  2.11k|    ZSTD_optLdm_t optLdm;
 1110|       |
 1111|  2.11k|    ZSTD_memset(&lastStretch, 0, sizeof(ZSTD_optimal_t));
  ------------------
  |  |   46|  2.11k|# define ZSTD_memset(p,v,l) __builtin_memset((p),(v),(l))
  ------------------
 1112|       |
 1113|  2.11k|    optLdm.seqStore = ms->ldmSeqStore ? *ms->ldmSeqStore : kNullRawSeqStore;
  ------------------
  |  Branch (1113:23): [True: 0, False: 2.11k]
  ------------------
 1114|  2.11k|    optLdm.endPosInBlock = optLdm.startPosInBlock = optLdm.offset = 0;
 1115|  2.11k|    ZSTD_opt_getNextMatchAndUpdateSeqStore(&optLdm, (U32)(ip-istart), (U32)(iend-ip));
 1116|       |
 1117|       |    /* init */
 1118|  2.11k|    DEBUGLOG(5, "ZSTD_compressBlock_opt_generic: current=%u, prefix=%u, nextToUpdate=%u",
  ------------------
  |  |  104|  2.11k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 2.11k]
  |  |  ------------------
  ------------------
 1119|  2.11k|                (U32)(ip - base), ms->window.dictLimit, ms->nextToUpdate);
 1120|  2.11k|    assert(optLevel <= 2);
  ------------------
  |  |   70|  2.11k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1121|  2.11k|    ZSTD_rescaleFreqs(optStatePtr, (const BYTE*)src, srcSize, optLevel);
 1122|  2.11k|    ip += (ip==prefixStart);
 1123|       |
 1124|       |    /* Match Loop */
 1125|   153k|    while (ip < ilimit) {
  ------------------
  |  Branch (1125:12): [True: 151k, False: 2.11k]
  ------------------
 1126|   151k|        U32 cur, last_pos = 0;
 1127|       |
 1128|       |        /* find first match */
 1129|   151k|        {   U32 const litlen = (U32)(ip - anchor);
 1130|   151k|            U32 const ll0 = !litlen;
 1131|   151k|            U32 nbMatches = getAllMatches(matches, ms, &nextToUpdate3, ip, iend, rep, ll0, minMatch);
 1132|   151k|            ZSTD_optLdm_processMatchCandidate(&optLdm, matches, &nbMatches,
 1133|   151k|                                              (U32)(ip-istart), (U32)(iend-ip),
 1134|   151k|                                              minMatch);
 1135|   151k|            if (!nbMatches) {
  ------------------
  |  Branch (1135:17): [True: 139k, False: 12.3k]
  ------------------
 1136|   139k|                DEBUGLOG(8, "no match found at cPos %u", (unsigned)(ip-istart));
  ------------------
  |  |  104|   139k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 139k]
  |  |  ------------------
  ------------------
 1137|   139k|                ip++;
 1138|   139k|                continue;
 1139|   139k|            }
 1140|       |
 1141|       |            /* Match found: let's store this solution, and eventually find more candidates.
 1142|       |             * During this forward pass, @opt is used to store stretches,
 1143|       |             * defined as "a match followed by N literals".
 1144|       |             * Note how this is different from a Sequence, which is "N literals followed by a match".
 1145|       |             * Storing stretches allows us to store different match predecessors
 1146|       |             * for each literal position part of a literals run. */
 1147|       |
 1148|       |            /* initialize opt[0] */
 1149|  12.3k|            opt[0].mlen = 0;  /* there are only literals so far */
 1150|  12.3k|            opt[0].litlen = litlen;
 1151|       |            /* No need to include the actual price of the literals before the first match
 1152|       |             * because it is static for the duration of the forward pass, and is included
 1153|       |             * in every subsequent price. But, we include the literal length because
 1154|       |             * the cost variation of litlen depends on the value of litlen.
 1155|       |             */
 1156|  12.3k|            opt[0].price = LL_PRICE(litlen);
  ------------------
  |  | 1077|  12.3k|#define LL_PRICE(_l) (int)ZSTD_litLengthPrice(_l, optStatePtr, optLevel)
  ------------------
 1157|  12.3k|            ZSTD_STATIC_ASSERT(sizeof(opt[0].rep[0]) == sizeof(rep[0]));
  ------------------
  |  |   43|  12.3k|#define ZSTD_STATIC_ASSERT(c) DEBUG_STATIC_ASSERT(c)
  |  |  ------------------
  |  |  |  |   39|  12.3k|#define DEBUG_STATIC_ASSERT(c) (void)sizeof(char[(c) ? 1 : -1])
  |  |  ------------------
  ------------------
 1158|  12.3k|            ZSTD_memcpy(&opt[0].rep, rep, sizeof(opt[0].rep));
  ------------------
  |  |   44|  12.3k|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  ------------------
 1159|       |
 1160|       |            /* large match -> immediate encoding */
 1161|  12.3k|            {   U32 const maxML = matches[nbMatches-1].len;
 1162|  12.3k|                U32 const maxOffBase = matches[nbMatches-1].off;
 1163|  12.3k|                DEBUGLOG(6, "found %u matches of maxLength=%u and maxOffBase=%u at cPos=%u => start new series",
  ------------------
  |  |  104|  12.3k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 12.3k]
  |  |  ------------------
  ------------------
 1164|  12.3k|                            nbMatches, maxML, maxOffBase, (U32)(ip-prefixStart));
 1165|       |
 1166|  12.3k|                if (maxML > sufficient_len) {
  ------------------
  |  Branch (1166:21): [True: 682, False: 11.6k]
  ------------------
 1167|    682|                    lastStretch.litlen = 0;
 1168|    682|                    lastStretch.mlen = maxML;
 1169|    682|                    lastStretch.off = maxOffBase;
 1170|    682|                    DEBUGLOG(6, "large match (%u>%u) => immediate encoding",
  ------------------
  |  |  104|    682|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 682]
  |  |  ------------------
  ------------------
 1171|    682|                                maxML, sufficient_len);
 1172|    682|                    cur = 0;
 1173|    682|                    last_pos = maxML;
 1174|    682|                    goto _shortestPath;
 1175|    682|            }   }
 1176|       |
 1177|       |            /* set prices for first matches starting position == 0 */
 1178|  11.6k|            assert(opt[0].price >= 0);
  ------------------
  |  |   70|  11.6k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1179|  11.6k|            {   U32 pos;
 1180|  11.6k|                U32 matchNb;
 1181|  35.1k|                for (pos = 1; pos < minMatch; pos++) {
  ------------------
  |  Branch (1181:31): [True: 23.4k, False: 11.6k]
  ------------------
 1182|  23.4k|                    opt[pos].price = ZSTD_MAX_PRICE;
  ------------------
  |  |   20|  23.4k|#define ZSTD_MAX_PRICE     (1<<30)
  ------------------
 1183|  23.4k|                    opt[pos].mlen = 0;
 1184|  23.4k|                    opt[pos].litlen = litlen + pos;
 1185|  23.4k|                }
 1186|  27.4k|                for (matchNb = 0; matchNb < nbMatches; matchNb++) {
  ------------------
  |  Branch (1186:35): [True: 15.7k, False: 11.6k]
  ------------------
 1187|  15.7k|                    U32 const offBase = matches[matchNb].off;
 1188|  15.7k|                    U32 const end = matches[matchNb].len;
 1189|  50.9k|                    for ( ; pos <= end ; pos++ ) {
  ------------------
  |  Branch (1189:29): [True: 35.2k, False: 15.7k]
  ------------------
 1190|  35.2k|                        int const matchPrice = (int)ZSTD_getMatchPrice(offBase, pos, optStatePtr, optLevel);
 1191|  35.2k|                        int const sequencePrice = opt[0].price + matchPrice;
 1192|  35.2k|                        DEBUGLOG(7, "rPos:%u => set initial price : %.2f",
  ------------------
  |  |  104|  35.2k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 35.2k]
  |  |  ------------------
  ------------------
 1193|  35.2k|                                    pos, ZSTD_fCost(sequencePrice));
 1194|  35.2k|                        opt[pos].mlen = pos;
 1195|  35.2k|                        opt[pos].off = offBase;
 1196|  35.2k|                        opt[pos].litlen = 0; /* end of match */
 1197|  35.2k|                        opt[pos].price = sequencePrice + LL_PRICE(0);
  ------------------
  |  | 1077|  35.2k|#define LL_PRICE(_l) (int)ZSTD_litLengthPrice(_l, optStatePtr, optLevel)
  ------------------
 1198|  35.2k|                    }
 1199|  15.7k|                }
 1200|  11.6k|                last_pos = pos-1;
 1201|  11.6k|                opt[pos].price = ZSTD_MAX_PRICE;
  ------------------
  |  |   20|  11.6k|#define ZSTD_MAX_PRICE     (1<<30)
  ------------------
 1202|  11.6k|            }
 1203|  11.6k|        }
 1204|       |
 1205|       |        /* check further positions */
 1206|  79.1k|        for (cur = 1; cur <= last_pos; cur++) {
  ------------------
  |  Branch (1206:23): [True: 78.7k, False: 443]
  ------------------
 1207|  78.7k|            const BYTE* const inr = ip + cur;
 1208|  78.7k|            assert(cur <= ZSTD_OPT_NUM);
  ------------------
  |  |   70|  78.7k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1209|  78.7k|            DEBUGLOG(7, "cPos:%i==rPos:%u", (int)(inr-istart), cur);
  ------------------
  |  |  104|  78.7k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 78.7k]
  |  |  ------------------
  ------------------
 1210|       |
 1211|       |            /* Fix current position with one literal if cheaper */
 1212|  78.7k|            {   U32 const litlen = opt[cur-1].litlen + 1;
 1213|  78.7k|                int const price = opt[cur-1].price
 1214|  78.7k|                                + LIT_PRICE(ip+cur-1)
  ------------------
  |  | 1076|  78.7k|#define LIT_PRICE(_p) (int)ZSTD_rawLiteralsCost(_p, 1, optStatePtr, optLevel)
  ------------------
 1215|  78.7k|                                + LL_INCPRICE(litlen);
  ------------------
  |  | 1078|  78.7k|#define LL_INCPRICE(_l) (LL_PRICE(_l) - LL_PRICE(_l-1))
  |  |  ------------------
  |  |  |  | 1077|  78.7k|#define LL_PRICE(_l) (int)ZSTD_litLengthPrice(_l, optStatePtr, optLevel)
  |  |  ------------------
  |  |               #define LL_INCPRICE(_l) (LL_PRICE(_l) - LL_PRICE(_l-1))
  |  |  ------------------
  |  |  |  | 1077|  78.7k|#define LL_PRICE(_l) (int)ZSTD_litLengthPrice(_l, optStatePtr, optLevel)
  |  |  ------------------
  ------------------
 1216|  78.7k|                assert(price < 1000000000); /* overflow check */
  ------------------
  |  |   70|  78.7k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1217|  78.7k|                if (price <= opt[cur].price) {
  ------------------
  |  Branch (1217:21): [True: 57.5k, False: 21.1k]
  ------------------
 1218|  57.5k|                    ZSTD_optimal_t const prevMatch = opt[cur];
 1219|  57.5k|                    DEBUGLOG(7, "cPos:%i==rPos:%u : better price (%.2f<=%.2f) using literal (ll==%u) (hist:%u,%u,%u)",
  ------------------
  |  |  104|  57.5k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 57.5k]
  |  |  ------------------
  ------------------
 1220|  57.5k|                                (int)(inr-istart), cur, ZSTD_fCost(price), ZSTD_fCost(opt[cur].price), litlen,
 1221|  57.5k|                                opt[cur-1].rep[0], opt[cur-1].rep[1], opt[cur-1].rep[2]);
 1222|  57.5k|                    opt[cur] = opt[cur-1];
 1223|  57.5k|                    opt[cur].litlen = litlen;
 1224|  57.5k|                    opt[cur].price = price;
 1225|  57.5k|                    if ( (optLevel >= 1) /* additional check only for higher modes */
  ------------------
  |  Branch (1225:26): [True: 57.2k, False: 363]
  ------------------
 1226|  57.2k|                      && (prevMatch.litlen == 0) /* replace a match */
  ------------------
  |  Branch (1226:26): [True: 30.9k, False: 26.2k]
  ------------------
 1227|  30.9k|                      && (LL_INCPRICE(1) < 0) /* ll1 is cheaper than ll0 */
  ------------------
  |  | 1078|  30.9k|#define LL_INCPRICE(_l) (LL_PRICE(_l) - LL_PRICE(_l-1))
  |  |  ------------------
  |  |  |  | 1077|  30.9k|#define LL_PRICE(_l) (int)ZSTD_litLengthPrice(_l, optStatePtr, optLevel)
  |  |  ------------------
  |  |               #define LL_INCPRICE(_l) (LL_PRICE(_l) - LL_PRICE(_l-1))
  |  |  ------------------
  |  |  |  | 1077|  30.9k|#define LL_PRICE(_l) (int)ZSTD_litLengthPrice(_l, optStatePtr, optLevel)
  |  |  ------------------
  ------------------
  |  Branch (1227:26): [True: 593, False: 30.3k]
  ------------------
 1228|    593|                      && LIKELY(ip + cur < iend)
  ------------------
  |  |  195|    593|#define LIKELY(x) (__builtin_expect((x), 1))
  |  |  ------------------
  |  |  |  Branch (195:19): [True: 569, False: 24]
  |  |  ------------------
  ------------------
 1229|  57.5k|                    ) {
 1230|       |                        /* check next position, in case it would be cheaper */
 1231|    569|                        int with1literal = prevMatch.price + LIT_PRICE(ip+cur) + LL_INCPRICE(1);
  ------------------
  |  | 1076|    569|#define LIT_PRICE(_p) (int)ZSTD_rawLiteralsCost(_p, 1, optStatePtr, optLevel)
  ------------------
                                      int with1literal = prevMatch.price + LIT_PRICE(ip+cur) + LL_INCPRICE(1);
  ------------------
  |  | 1078|    569|#define LL_INCPRICE(_l) (LL_PRICE(_l) - LL_PRICE(_l-1))
  |  |  ------------------
  |  |  |  | 1077|    569|#define LL_PRICE(_l) (int)ZSTD_litLengthPrice(_l, optStatePtr, optLevel)
  |  |  ------------------
  |  |               #define LL_INCPRICE(_l) (LL_PRICE(_l) - LL_PRICE(_l-1))
  |  |  ------------------
  |  |  |  | 1077|    569|#define LL_PRICE(_l) (int)ZSTD_litLengthPrice(_l, optStatePtr, optLevel)
  |  |  ------------------
  ------------------
 1232|    569|                        int withMoreLiterals = price + LIT_PRICE(ip+cur) + LL_INCPRICE(litlen+1);
  ------------------
  |  | 1076|    569|#define LIT_PRICE(_p) (int)ZSTD_rawLiteralsCost(_p, 1, optStatePtr, optLevel)
  ------------------
                                      int withMoreLiterals = price + LIT_PRICE(ip+cur) + LL_INCPRICE(litlen+1);
  ------------------
  |  | 1078|    569|#define LL_INCPRICE(_l) (LL_PRICE(_l) - LL_PRICE(_l-1))
  |  |  ------------------
  |  |  |  | 1077|    569|#define LL_PRICE(_l) (int)ZSTD_litLengthPrice(_l, optStatePtr, optLevel)
  |  |  ------------------
  |  |               #define LL_INCPRICE(_l) (LL_PRICE(_l) - LL_PRICE(_l-1))
  |  |  ------------------
  |  |  |  | 1077|    569|#define LL_PRICE(_l) (int)ZSTD_litLengthPrice(_l, optStatePtr, optLevel)
  |  |  ------------------
  ------------------
 1233|    569|                        DEBUGLOG(7, "then at next rPos %u : match+1lit %.2f vs %ulits %.2f",
  ------------------
  |  |  104|    569|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 569]
  |  |  ------------------
  ------------------
 1234|    569|                                cur+1, ZSTD_fCost(with1literal), litlen+1, ZSTD_fCost(withMoreLiterals));
 1235|    569|                        if ( (with1literal < withMoreLiterals)
  ------------------
  |  Branch (1235:30): [True: 52, False: 517]
  ------------------
 1236|     52|                          && (with1literal < opt[cur+1].price) ) {
  ------------------
  |  Branch (1236:30): [True: 3, False: 49]
  ------------------
 1237|       |                            /* update offset history - before it disappears */
 1238|      3|                            U32 const prev = cur - prevMatch.mlen;
 1239|      3|                            Repcodes_t const newReps = ZSTD_newRep(opt[prev].rep, prevMatch.off, opt[prev].litlen==0);
 1240|      3|                            assert(cur >= prevMatch.mlen);
  ------------------
  |  |   70|      3|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1241|      3|                            DEBUGLOG(7, "==> match+1lit is cheaper (%.2f < %.2f) (hist:%u,%u,%u) !",
  ------------------
  |  |  104|      3|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 3]
  |  |  ------------------
  ------------------
 1242|      3|                                        ZSTD_fCost(with1literal), ZSTD_fCost(withMoreLiterals),
 1243|      3|                                        newReps.rep[0], newReps.rep[1], newReps.rep[2] );
 1244|      3|                            opt[cur+1] = prevMatch;  /* mlen & offbase */
 1245|      3|                            ZSTD_memcpy(opt[cur+1].rep, &newReps, sizeof(Repcodes_t));
  ------------------
  |  |   44|      3|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  ------------------
 1246|      3|                            opt[cur+1].litlen = 1;
 1247|      3|                            opt[cur+1].price = with1literal;
 1248|      3|                            if (last_pos < cur+1) last_pos = cur+1;
  ------------------
  |  Branch (1248:33): [True: 3, False: 0]
  ------------------
 1249|      3|                        }
 1250|    569|                    }
 1251|  57.5k|                } else {
 1252|  21.1k|                    DEBUGLOG(7, "cPos:%i==rPos:%u : literal would cost more (%.2f>%.2f)",
  ------------------
  |  |  104|  21.1k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 21.1k]
  |  |  ------------------
  ------------------
 1253|  21.1k|                                (int)(inr-istart), cur, ZSTD_fCost(price), ZSTD_fCost(opt[cur].price));
 1254|  21.1k|                }
 1255|  78.7k|            }
 1256|       |
 1257|       |            /* Offset history is not updated during match comparison.
 1258|       |             * Do it here, now that the match is selected and confirmed.
 1259|       |             */
 1260|  78.7k|            ZSTD_STATIC_ASSERT(sizeof(opt[cur].rep) == sizeof(Repcodes_t));
  ------------------
  |  |   43|  78.7k|#define ZSTD_STATIC_ASSERT(c) DEBUG_STATIC_ASSERT(c)
  |  |  ------------------
  |  |  |  |   39|  78.7k|#define DEBUG_STATIC_ASSERT(c) (void)sizeof(char[(c) ? 1 : -1])
  |  |  ------------------
  ------------------
 1261|  78.7k|            assert(cur >= opt[cur].mlen);
  ------------------
  |  |   70|  78.7k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1262|  78.7k|            if (opt[cur].litlen == 0) {
  ------------------
  |  Branch (1262:17): [True: 21.1k, False: 57.5k]
  ------------------
 1263|       |                /* just finished a match => alter offset history */
 1264|  21.1k|                U32 const prev = cur - opt[cur].mlen;
 1265|  21.1k|                Repcodes_t const newReps = ZSTD_newRep(opt[prev].rep, opt[cur].off, opt[prev].litlen==0);
 1266|  21.1k|                ZSTD_memcpy(opt[cur].rep, &newReps, sizeof(Repcodes_t));
  ------------------
  |  |   44|  21.1k|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  ------------------
 1267|  21.1k|            }
 1268|       |
 1269|       |            /* last match must start at a minimum distance of 8 from oend */
 1270|  78.7k|            if (inr > ilimit) continue;
  ------------------
  |  Branch (1270:17): [True: 1.35k, False: 77.3k]
  ------------------
 1271|       |
 1272|  77.3k|            if (cur == last_pos) break;
  ------------------
  |  Branch (1272:17): [True: 10.9k, False: 66.4k]
  ------------------
 1273|       |
 1274|  66.4k|            if ( (optLevel==0) /*static_test*/
  ------------------
  |  Branch (1274:18): [True: 311, False: 66.1k]
  ------------------
 1275|    311|              && (opt[cur+1].price <= opt[cur].price + (BITCOST_MULTIPLIER/2)) ) {
  ------------------
  |  |   39|    311|#  define BITCOST_MULTIPLIER (1 << BITCOST_ACCURACY)
  |  |  ------------------
  |  |  |  |   38|    311|#  define BITCOST_ACCURACY 8
  |  |  ------------------
  ------------------
  |  Branch (1275:18): [True: 5, False: 306]
  ------------------
 1276|      5|                DEBUGLOG(7, "skip current position : next rPos(%u) price is cheaper", cur+1);
  ------------------
  |  |  104|      5|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 5]
  |  |  ------------------
  ------------------
 1277|      5|                continue;  /* skip unpromising positions; about ~+6% speed, -0.01 ratio */
 1278|      5|            }
 1279|       |
 1280|  66.4k|            assert(opt[cur].price >= 0);
  ------------------
  |  |   70|  66.4k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1281|  66.4k|            {   U32 const ll0 = (opt[cur].litlen == 0);
 1282|  66.4k|                int const previousPrice = opt[cur].price;
 1283|  66.4k|                int const basePrice = previousPrice + LL_PRICE(0);
  ------------------
  |  | 1077|  66.4k|#define LL_PRICE(_l) (int)ZSTD_litLengthPrice(_l, optStatePtr, optLevel)
  ------------------
 1284|  66.4k|                U32 nbMatches = getAllMatches(matches, ms, &nextToUpdate3, inr, iend, opt[cur].rep, ll0, minMatch);
 1285|  66.4k|                U32 matchNb;
 1286|       |
 1287|  66.4k|                ZSTD_optLdm_processMatchCandidate(&optLdm, matches, &nbMatches,
 1288|  66.4k|                                                  (U32)(inr-istart), (U32)(iend-inr),
 1289|  66.4k|                                                  minMatch);
 1290|       |
 1291|  66.4k|                if (!nbMatches) {
  ------------------
  |  Branch (1291:21): [True: 26.3k, False: 40.1k]
  ------------------
 1292|  26.3k|                    DEBUGLOG(7, "rPos:%u : no match found", cur);
  ------------------
  |  |  104|  26.3k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 26.3k]
  |  |  ------------------
  ------------------
 1293|  26.3k|                    continue;
 1294|  26.3k|                }
 1295|       |
 1296|  40.1k|                {   U32 const longestML = matches[nbMatches-1].len;
 1297|  40.1k|                    DEBUGLOG(7, "cPos:%i==rPos:%u, found %u matches, of longest ML=%u",
  ------------------
  |  |  104|  40.1k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 40.1k]
  |  |  ------------------
  ------------------
 1298|  40.1k|                                (int)(inr-istart), cur, nbMatches, longestML);
 1299|       |
 1300|  40.1k|                    if ( (longestML > sufficient_len)
  ------------------
  |  Branch (1300:26): [True: 24, False: 40.0k]
  ------------------
 1301|  40.0k|                      || (cur + longestML >= ZSTD_OPT_NUM)
  ------------------
  |  |   62|  40.0k|#define ZSTD_OPT_NUM    (1<<12)
  ------------------
  |  Branch (1301:26): [True: 0, False: 40.0k]
  ------------------
 1302|  40.0k|                      || (ip + cur + longestML >= iend) ) {
  ------------------
  |  Branch (1302:26): [True: 278, False: 39.8k]
  ------------------
 1303|    302|                        lastStretch.mlen = longestML;
 1304|    302|                        lastStretch.off = matches[nbMatches-1].off;
 1305|    302|                        lastStretch.litlen = 0;
 1306|    302|                        last_pos = cur + longestML;
 1307|    302|                        goto _shortestPath;
 1308|    302|                }   }
 1309|       |
 1310|       |                /* set prices using matches found at position == cur */
 1311|  91.3k|                for (matchNb = 0; matchNb < nbMatches; matchNb++) {
  ------------------
  |  Branch (1311:35): [True: 51.5k, False: 39.8k]
  ------------------
 1312|  51.5k|                    U32 const offset = matches[matchNb].off;
 1313|  51.5k|                    U32 const lastML = matches[matchNb].len;
 1314|  51.5k|                    U32 const startML = (matchNb>0) ? matches[matchNb-1].len+1 : minMatch;
  ------------------
  |  Branch (1314:41): [True: 11.7k, False: 39.8k]
  ------------------
 1315|  51.5k|                    U32 mlen;
 1316|       |
 1317|  51.5k|                    DEBUGLOG(7, "testing match %u => offBase=%4u, mlen=%2u, llen=%2u",
  ------------------
  |  |  104|  51.5k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 51.5k]
  |  |  ------------------
  ------------------
 1318|  51.5k|                                matchNb, matches[matchNb].off, lastML, opt[cur].litlen);
 1319|       |
 1320|   308k|                    for (mlen = lastML; mlen >= startML; mlen--) {  /* scan downward */
  ------------------
  |  Branch (1320:41): [True: 256k, False: 51.4k]
  ------------------
 1321|   256k|                        U32 const pos = cur + mlen;
 1322|   256k|                        int const price = basePrice + (int)ZSTD_getMatchPrice(offset, mlen, optStatePtr, optLevel);
 1323|       |
 1324|   256k|                        if ((pos > last_pos) || (price < opt[pos].price)) {
  ------------------
  |  Branch (1324:29): [True: 9.74k, False: 246k]
  |  Branch (1324:49): [True: 17.0k, False: 229k]
  ------------------
 1325|  26.8k|                            DEBUGLOG(7, "rPos:%u (ml=%2u) => new better price (%.2f<%.2f)",
  ------------------
  |  |  104|  26.8k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 26.8k]
  |  |  ------------------
  ------------------
 1326|  26.8k|                                        pos, mlen, ZSTD_fCost(price), ZSTD_fCost(opt[pos].price));
 1327|  50.0k|                            while (last_pos < pos) {
  ------------------
  |  Branch (1327:36): [True: 23.2k, False: 26.8k]
  ------------------
 1328|       |                                /* fill empty positions, for future comparisons */
 1329|  23.2k|                                last_pos++;
 1330|  23.2k|                                opt[last_pos].price = ZSTD_MAX_PRICE;
  ------------------
  |  |   20|  23.2k|#define ZSTD_MAX_PRICE     (1<<30)
  ------------------
 1331|  23.2k|                                opt[last_pos].litlen = !0;  /* just needs to be != 0, to mean "not an end of match" */
 1332|  23.2k|                            }
 1333|  26.8k|                            opt[pos].mlen = mlen;
 1334|  26.8k|                            opt[pos].off = offset;
 1335|  26.8k|                            opt[pos].litlen = 0;
 1336|  26.8k|                            opt[pos].price = price;
 1337|   229k|                        } else {
 1338|   229k|                            DEBUGLOG(7, "rPos:%u (ml=%2u) => new price is worse (%.2f>=%.2f)",
  ------------------
  |  |  104|   229k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 229k]
  |  |  ------------------
  ------------------
 1339|   229k|                                        pos, mlen, ZSTD_fCost(price), ZSTD_fCost(opt[pos].price));
 1340|   229k|                            if (optLevel==0) break;  /* early update abort; gets ~+10% speed for about -0.01 ratio loss */
  ------------------
  |  Branch (1340:33): [True: 88, False: 229k]
  ------------------
 1341|   229k|                        }
 1342|   256k|            }   }   }
 1343|  39.8k|            opt[last_pos+1].price = ZSTD_MAX_PRICE;
  ------------------
  |  |   20|  39.8k|#define ZSTD_MAX_PRICE     (1<<30)
  ------------------
 1344|  39.8k|        }  /* for (cur = 1; cur <= last_pos; cur++) */
 1345|       |
 1346|  11.3k|        lastStretch = opt[last_pos];
 1347|  11.3k|        assert(cur >= lastStretch.mlen);
  ------------------
  |  |   70|  11.3k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1348|  11.3k|        cur = last_pos - lastStretch.mlen;
 1349|       |
 1350|  12.3k|_shortestPath:   /* cur, last_pos, best_mlen, best_off have to be set */
 1351|  12.3k|        assert(opt[0].mlen == 0);
  ------------------
  |  |   70|  12.3k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1352|  12.3k|        assert(last_pos >= lastStretch.mlen);
  ------------------
  |  |   70|  12.3k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1353|  12.3k|        assert(cur == last_pos - lastStretch.mlen);
  ------------------
  |  |   70|  12.3k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1354|       |
 1355|  12.3k|        if (lastStretch.mlen==0) {
  ------------------
  |  Branch (1355:13): [True: 8.13k, False: 4.23k]
  ------------------
 1356|       |            /* no solution : all matches have been converted into literals */
 1357|  8.13k|            assert(lastStretch.litlen == (ip - anchor) + last_pos);
  ------------------
  |  |   70|  8.13k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1358|  8.13k|            ip += last_pos;
 1359|  8.13k|            continue;
 1360|  8.13k|        }
 1361|  4.23k|        assert(lastStretch.off > 0);
  ------------------
  |  |   70|  4.23k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1362|       |
 1363|       |        /* Update offset history */
 1364|  4.23k|        if (lastStretch.litlen == 0) {
  ------------------
  |  Branch (1364:13): [True: 3.69k, False: 541]
  ------------------
 1365|       |            /* finishing on a match : update offset history */
 1366|  3.69k|            Repcodes_t const reps = ZSTD_newRep(opt[cur].rep, lastStretch.off, opt[cur].litlen==0);
 1367|  3.69k|            ZSTD_memcpy(rep, &reps, sizeof(Repcodes_t));
  ------------------
  |  |   44|  3.69k|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  ------------------
 1368|  3.69k|        } else {
 1369|    541|            ZSTD_memcpy(rep, lastStretch.rep, sizeof(Repcodes_t));
  ------------------
  |  |   44|    541|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  ------------------
 1370|    541|            assert(cur >= lastStretch.litlen);
  ------------------
  |  |   70|    541|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1371|    541|            cur -= lastStretch.litlen;
 1372|    541|        }
 1373|       |
 1374|       |        /* Let's write the shortest path solution.
 1375|       |         * It is stored in @opt in reverse order,
 1376|       |         * starting from @storeEnd (==cur+2),
 1377|       |         * effectively partially @opt overwriting.
 1378|       |         * Content is changed too:
 1379|       |         * - So far, @opt stored stretches, aka a match followed by literals
 1380|       |         * - Now, it will store sequences, aka literals followed by a match
 1381|       |         */
 1382|  4.23k|        {   U32 const storeEnd = cur + 2;
 1383|  4.23k|            U32 storeStart = storeEnd;
 1384|  4.23k|            U32 stretchPos = cur;
 1385|       |
 1386|  4.23k|            DEBUGLOG(6, "start reverse traversal (last_pos:%u, cur:%u)",
  ------------------
  |  |  104|  4.23k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 4.23k]
  |  |  ------------------
  ------------------
 1387|  4.23k|                        last_pos, cur); (void)last_pos;
 1388|  4.23k|            assert(storeEnd < ZSTD_OPT_SIZE);
  ------------------
  |  |   70|  4.23k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1389|  4.23k|            DEBUGLOG(6, "last stretch copied into pos=%u (llen=%u,mlen=%u,ofc=%u)",
  ------------------
  |  |  104|  4.23k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 4.23k]
  |  |  ------------------
  ------------------
 1390|  4.23k|                        storeEnd, lastStretch.litlen, lastStretch.mlen, lastStretch.off);
 1391|  4.23k|            opt[storeEnd] = lastStretch;  /* note: litlen will be fixed */
 1392|  4.23k|            storeStart = storeEnd;
 1393|  4.59k|            while (1) {
  ------------------
  |  Branch (1393:20): [True: 4.59k, Folded]
  ------------------
 1394|  4.59k|                ZSTD_optimal_t nextStretch = opt[stretchPos];
 1395|  4.59k|                opt[storeStart].litlen = nextStretch.litlen;
 1396|  4.59k|                DEBUGLOG(6, "selected sequence (llen=%u,mlen=%u,ofc=%u)",
  ------------------
  |  |  104|  4.59k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 4.59k]
  |  |  ------------------
  ------------------
 1397|  4.59k|                            opt[storeStart].litlen, opt[storeStart].mlen, opt[storeStart].off);
 1398|  4.59k|                if (nextStretch.mlen == 0) {
  ------------------
  |  Branch (1398:21): [True: 4.23k, False: 361]
  ------------------
 1399|       |                    /* reaching beginning of segment */
 1400|  4.23k|                    break;
 1401|  4.23k|                }
 1402|    361|                storeStart--;
 1403|    361|                opt[storeStart] = nextStretch; /* note: litlen will be fixed */
 1404|    361|                assert(nextStretch.litlen + nextStretch.mlen <= stretchPos);
  ------------------
  |  |   70|    361|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1405|    361|                stretchPos -= nextStretch.litlen + nextStretch.mlen;
 1406|    361|            }
 1407|       |
 1408|       |            /* save sequences */
 1409|  4.23k|            DEBUGLOG(6, "sending selected sequences into seqStore");
  ------------------
  |  |  104|  4.23k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 4.23k]
  |  |  ------------------
  ------------------
 1410|  4.23k|            {   U32 storePos;
 1411|  8.82k|                for (storePos=storeStart; storePos <= storeEnd; storePos++) {
  ------------------
  |  Branch (1411:43): [True: 4.59k, False: 4.23k]
  ------------------
 1412|  4.59k|                    U32 const llen = opt[storePos].litlen;
 1413|  4.59k|                    U32 const mlen = opt[storePos].mlen;
 1414|  4.59k|                    U32 const offBase = opt[storePos].off;
 1415|  4.59k|                    U32 const advance = llen + mlen;
 1416|  4.59k|                    DEBUGLOG(6, "considering seq starting at %i, llen=%u, mlen=%u",
  ------------------
  |  |  104|  4.59k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 4.59k]
  |  |  ------------------
  ------------------
 1417|  4.59k|                                (int)(anchor - istart), (unsigned)llen, (unsigned)mlen);
 1418|       |
 1419|  4.59k|                    if (mlen==0) {  /* only literals => must be last "sequence", actually starting a new stream of sequences */
  ------------------
  |  Branch (1419:25): [True: 0, False: 4.59k]
  ------------------
 1420|      0|                        assert(storePos == storeEnd);   /* must be last sequence */
  ------------------
  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1421|      0|                        ip = anchor + llen;     /* last "sequence" is a bunch of literals => don't progress anchor */
 1422|      0|                        continue;   /* will finish */
 1423|      0|                    }
 1424|       |
 1425|  4.59k|                    assert(anchor + llen <= iend);
  ------------------
  |  |   70|  4.59k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1426|  4.59k|                    ZSTD_updateStats(optStatePtr, llen, anchor, offBase, mlen);
 1427|  4.59k|                    ZSTD_storeSeq(seqStore, llen, anchor, iend, offBase, mlen);
 1428|  4.59k|                    anchor += advance;
 1429|  4.59k|                    ip = anchor;
 1430|  4.59k|            }   }
 1431|  4.23k|            DEBUGLOG(7, "new offset history : %u, %u, %u", rep[0], rep[1], rep[2]);
  ------------------
  |  |  104|  4.23k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 4.23k]
  |  |  ------------------
  ------------------
 1432|       |
 1433|       |            /* update all costs */
 1434|  4.23k|            ZSTD_setBasePrices(optStatePtr, optLevel);
 1435|  4.23k|        }
 1436|  4.23k|    }   /* while (ip < ilimit) */
 1437|       |
 1438|       |    /* Return the last literals size */
 1439|  2.11k|    return (size_t)(iend - anchor);
 1440|  2.11k|}
zstd_opt.c:ZSTD_selectBtGetAllMatches:
  896|  2.11k|{
  897|  2.11k|    ZSTD_getAllMatchesFn const getAllMatchesFns[3][4] = {
  898|  2.11k|        ZSTD_BT_GET_ALL_MATCHES_ARRAY(noDict),
  ------------------
  |  |  887|  2.11k|    {                                            \
  |  |  888|  2.11k|        ZSTD_BT_GET_ALL_MATCHES_FN(dictMode, 3), \
  |  |  ------------------
  |  |  |  |  858|  2.11k|#define ZSTD_BT_GET_ALL_MATCHES_FN(dictMode, mls) ZSTD_btGetAllMatches_##dictMode##_##mls
  |  |  ------------------
  |  |  889|  2.11k|        ZSTD_BT_GET_ALL_MATCHES_FN(dictMode, 4), \
  |  |  ------------------
  |  |  |  |  858|  2.11k|#define ZSTD_BT_GET_ALL_MATCHES_FN(dictMode, mls) ZSTD_btGetAllMatches_##dictMode##_##mls
  |  |  ------------------
  |  |  890|  2.11k|        ZSTD_BT_GET_ALL_MATCHES_FN(dictMode, 5), \
  |  |  ------------------
  |  |  |  |  858|  2.11k|#define ZSTD_BT_GET_ALL_MATCHES_FN(dictMode, mls) ZSTD_btGetAllMatches_##dictMode##_##mls
  |  |  ------------------
  |  |  891|  2.11k|        ZSTD_BT_GET_ALL_MATCHES_FN(dictMode, 6)  \
  |  |  ------------------
  |  |  |  |  858|  2.11k|#define ZSTD_BT_GET_ALL_MATCHES_FN(dictMode, mls) ZSTD_btGetAllMatches_##dictMode##_##mls
  |  |  ------------------
  |  |  892|  2.11k|    }
  ------------------
  899|  2.11k|        ZSTD_BT_GET_ALL_MATCHES_ARRAY(extDict),
  ------------------
  |  |  887|  2.11k|    {                                            \
  |  |  888|  2.11k|        ZSTD_BT_GET_ALL_MATCHES_FN(dictMode, 3), \
  |  |  ------------------
  |  |  |  |  858|  2.11k|#define ZSTD_BT_GET_ALL_MATCHES_FN(dictMode, mls) ZSTD_btGetAllMatches_##dictMode##_##mls
  |  |  ------------------
  |  |  889|  2.11k|        ZSTD_BT_GET_ALL_MATCHES_FN(dictMode, 4), \
  |  |  ------------------
  |  |  |  |  858|  2.11k|#define ZSTD_BT_GET_ALL_MATCHES_FN(dictMode, mls) ZSTD_btGetAllMatches_##dictMode##_##mls
  |  |  ------------------
  |  |  890|  2.11k|        ZSTD_BT_GET_ALL_MATCHES_FN(dictMode, 5), \
  |  |  ------------------
  |  |  |  |  858|  2.11k|#define ZSTD_BT_GET_ALL_MATCHES_FN(dictMode, mls) ZSTD_btGetAllMatches_##dictMode##_##mls
  |  |  ------------------
  |  |  891|  2.11k|        ZSTD_BT_GET_ALL_MATCHES_FN(dictMode, 6)  \
  |  |  ------------------
  |  |  |  |  858|  2.11k|#define ZSTD_BT_GET_ALL_MATCHES_FN(dictMode, mls) ZSTD_btGetAllMatches_##dictMode##_##mls
  |  |  ------------------
  |  |  892|  2.11k|    }
  ------------------
  900|  2.11k|        ZSTD_BT_GET_ALL_MATCHES_ARRAY(dictMatchState)
  ------------------
  |  |  887|  2.11k|    {                                            \
  |  |  888|  2.11k|        ZSTD_BT_GET_ALL_MATCHES_FN(dictMode, 3), \
  |  |  ------------------
  |  |  |  |  858|  2.11k|#define ZSTD_BT_GET_ALL_MATCHES_FN(dictMode, mls) ZSTD_btGetAllMatches_##dictMode##_##mls
  |  |  ------------------
  |  |  889|  2.11k|        ZSTD_BT_GET_ALL_MATCHES_FN(dictMode, 4), \
  |  |  ------------------
  |  |  |  |  858|  2.11k|#define ZSTD_BT_GET_ALL_MATCHES_FN(dictMode, mls) ZSTD_btGetAllMatches_##dictMode##_##mls
  |  |  ------------------
  |  |  890|  2.11k|        ZSTD_BT_GET_ALL_MATCHES_FN(dictMode, 5), \
  |  |  ------------------
  |  |  |  |  858|  2.11k|#define ZSTD_BT_GET_ALL_MATCHES_FN(dictMode, mls) ZSTD_btGetAllMatches_##dictMode##_##mls
  |  |  ------------------
  |  |  891|  2.11k|        ZSTD_BT_GET_ALL_MATCHES_FN(dictMode, 6)  \
  |  |  ------------------
  |  |  |  |  858|  2.11k|#define ZSTD_BT_GET_ALL_MATCHES_FN(dictMode, mls) ZSTD_btGetAllMatches_##dictMode##_##mls
  |  |  ------------------
  |  |  892|  2.11k|    }
  ------------------
  901|  2.11k|    };
  902|  2.11k|    U32 const mls = BOUNDED(3, ms->cParams.minMatch, 6);
  ------------------
  |  |   56|  2.11k|#define BOUNDED(min,val,max) (MAX(min,MIN(val,max)))
  |  |  ------------------
  |  |  |  |   55|  4.23k|#define MAX(a,b) ((a)>(b) ? (a) : (b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (55:19): [True: 0, False: 2.11k]
  |  |  |  |  |  Branch (55:24): [True: 2.11k, False: 0]
  |  |  |  |  |  Branch (55:36): [True: 2.11k, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  903|  2.11k|    assert((U32)dictMode < 3);
  ------------------
  |  |   70|  2.11k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  904|  2.11k|    assert(mls - 3 < 4);
  ------------------
  |  |   70|  2.11k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  905|  2.11k|    return getAllMatchesFns[(int)dictMode][mls - 3];
  906|  2.11k|}
zstd_opt.c:ZSTD_btGetAllMatches_noDict_3:
  870|   214k|    {                                                          \
  871|   214k|        return ZSTD_btGetAllMatches_internal(                  \
  872|   214k|                matches, ms, nextToUpdate3, ip, iHighLimit,    \
  873|   214k|                rep, ll0, lengthToBeat, ZSTD_##dictMode, mls); \
  874|   214k|    }
zstd_opt.c:ZSTD_btGetAllMatches_internal:
  849|   217k|{
  850|   217k|    assert(BOUNDED(3, ms->cParams.minMatch, 6) == mls);
  ------------------
  |  |   70|   217k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  851|   217k|    DEBUGLOG(8, "ZSTD_BtGetAllMatches(dictMode=%d, mls=%u)", (int)dictMode, mls);
  ------------------
  |  |  104|   217k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 217k]
  |  |  ------------------
  ------------------
  852|   217k|    if (ip < ms->window.base + ms->nextToUpdate)
  ------------------
  |  Branch (852:9): [True: 2.49k, False: 215k]
  ------------------
  853|  2.49k|        return 0;   /* skipped area */
  854|   215k|    ZSTD_updateTree_internal(ms, ip, iHighLimit, mls, dictMode);
  855|   215k|    return ZSTD_insertBtAndGetAllMatches(matches, ms, nextToUpdate3, ip, iHighLimit, dictMode, rep, ll0, lengthToBeat, mls);
  856|   217k|}
zstd_opt.c:ZSTD_insertBtAndGetAllMatches:
  606|   215k|{
  607|   215k|    const ZSTD_compressionParameters* const cParams = &ms->cParams;
  608|   215k|    U32 const sufficient_len = MIN(cParams->targetLength, ZSTD_OPT_NUM -1);
  ------------------
  |  |   54|   215k|#define MIN(a,b) ((a)<(b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (54:19): [True: 215k, False: 0]
  |  |  ------------------
  ------------------
  609|   215k|    const BYTE* const base = ms->window.base;
  610|   215k|    U32 const curr = (U32)(ip-base);
  611|   215k|    U32 const hashLog = cParams->hashLog;
  612|   215k|    U32 const minMatch = (mls==3) ? 3 : 4;
  ------------------
  |  Branch (612:26): [True: 212k, False: 3.07k]
  ------------------
  613|   215k|    U32* const hashTable = ms->hashTable;
  614|   215k|    size_t const h  = ZSTD_hashPtr(ip, hashLog, mls);
  615|   215k|    U32 matchIndex  = hashTable[h];
  616|   215k|    U32* const bt   = ms->chainTable;
  617|   215k|    U32 const btLog = cParams->chainLog - 1;
  618|   215k|    U32 const btMask= (1U << btLog) - 1;
  619|   215k|    size_t commonLengthSmaller=0, commonLengthLarger=0;
  620|   215k|    const BYTE* const dictBase = ms->window.dictBase;
  621|   215k|    U32 const dictLimit = ms->window.dictLimit;
  622|   215k|    const BYTE* const dictEnd = dictBase + dictLimit;
  623|   215k|    const BYTE* const prefixStart = base + dictLimit;
  624|   215k|    U32 const btLow = (btMask >= curr) ? 0 : curr - btMask;
  ------------------
  |  Branch (624:23): [True: 1.21k, False: 214k]
  ------------------
  625|   215k|    U32 const windowLow = ZSTD_getLowestMatchIndex(ms, curr, cParams->windowLog);
  626|   215k|    U32 const matchLow = windowLow ? windowLow : 1;
  ------------------
  |  Branch (626:26): [True: 215k, False: 0]
  ------------------
  627|   215k|    U32* smallerPtr = bt + 2*(curr&btMask);
  628|   215k|    U32* largerPtr  = bt + 2*(curr&btMask) + 1;
  629|   215k|    U32 matchEndIdx = curr+8+1;   /* farthest referenced position of any match => detects repetitive patterns */
  630|   215k|    U32 dummy32;   /* to be nullified at the end */
  631|   215k|    U32 mnum = 0;
  632|   215k|    U32 nbCompares = 1U << cParams->searchLog;
  633|       |
  634|   215k|    const ZSTD_MatchState_t* dms    = dictMode == ZSTD_dictMatchState ? ms->dictMatchState : NULL;
  ------------------
  |  Branch (634:39): [True: 0, False: 215k]
  ------------------
  635|   215k|    const ZSTD_compressionParameters* const dmsCParams =
  636|   215k|                                      dictMode == ZSTD_dictMatchState ? &dms->cParams : NULL;
  ------------------
  |  Branch (636:39): [True: 0, False: 215k]
  ------------------
  637|   215k|    const BYTE* const dmsBase       = dictMode == ZSTD_dictMatchState ? dms->window.base : NULL;
  ------------------
  |  Branch (637:39): [True: 0, False: 215k]
  ------------------
  638|   215k|    const BYTE* const dmsEnd        = dictMode == ZSTD_dictMatchState ? dms->window.nextSrc : NULL;
  ------------------
  |  Branch (638:39): [True: 0, False: 215k]
  ------------------
  639|   215k|    U32         const dmsHighLimit  = dictMode == ZSTD_dictMatchState ? (U32)(dmsEnd - dmsBase) : 0;
  ------------------
  |  Branch (639:39): [True: 0, False: 215k]
  ------------------
  640|   215k|    U32         const dmsLowLimit   = dictMode == ZSTD_dictMatchState ? dms->window.lowLimit : 0;
  ------------------
  |  Branch (640:39): [True: 0, False: 215k]
  ------------------
  641|   215k|    U32         const dmsIndexDelta = dictMode == ZSTD_dictMatchState ? windowLow - dmsHighLimit : 0;
  ------------------
  |  Branch (641:39): [True: 0, False: 215k]
  ------------------
  642|   215k|    U32         const dmsHashLog    = dictMode == ZSTD_dictMatchState ? dmsCParams->hashLog : hashLog;
  ------------------
  |  Branch (642:39): [True: 0, False: 215k]
  ------------------
  643|   215k|    U32         const dmsBtLog      = dictMode == ZSTD_dictMatchState ? dmsCParams->chainLog - 1 : btLog;
  ------------------
  |  Branch (643:39): [True: 0, False: 215k]
  ------------------
  644|   215k|    U32         const dmsBtMask     = dictMode == ZSTD_dictMatchState ? (1U << dmsBtLog) - 1 : 0;
  ------------------
  |  Branch (644:39): [True: 0, False: 215k]
  ------------------
  645|   215k|    U32         const dmsBtLow      = dictMode == ZSTD_dictMatchState && dmsBtMask < dmsHighLimit - dmsLowLimit ? dmsHighLimit - dmsBtMask : dmsLowLimit;
  ------------------
  |  Branch (645:39): [True: 0, False: 215k]
  |  Branch (645:74): [True: 0, False: 0]
  ------------------
  646|       |
  647|   215k|    size_t bestLength = lengthToBeat-1;
  648|   215k|    DEBUGLOG(8, "ZSTD_insertBtAndGetAllMatches: current=%u", curr);
  ------------------
  |  |  104|   215k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 215k]
  |  |  ------------------
  ------------------
  649|       |
  650|       |    /* check repCode */
  651|   215k|    assert(ll0 <= 1);   /* necessarily 1 or 0 */
  ------------------
  |  |   70|   215k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  652|   215k|    {   U32 const lastR = ZSTD_REP_NUM + ll0;
  ------------------
  |  |   64|   215k|#define ZSTD_REP_NUM      3                 /* number of repcodes */
  ------------------
  653|   215k|        U32 repCode;
  654|   860k|        for (repCode = ll0; repCode < lastR; repCode++) {
  ------------------
  |  Branch (654:29): [True: 645k, False: 214k]
  ------------------
  655|   645k|            U32 const repOffset = (repCode==ZSTD_REP_NUM) ? (rep[0] - 1) : rep[repCode];
  ------------------
  |  |   64|   645k|#define ZSTD_REP_NUM      3                 /* number of repcodes */
  ------------------
  |  Branch (655:35): [True: 20.3k, False: 625k]
  ------------------
  656|   645k|            U32 const repIndex = curr - repOffset;
  657|   645k|            U32 repLen = 0;
  658|   645k|            assert(curr >= dictLimit);
  ------------------
  |  |   70|   645k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  659|   645k|            if (repOffset-1 /* intentional overflow, discards 0 and -1 */ < curr-dictLimit) {  /* equivalent to `curr > repIndex >= dictLimit` */
  ------------------
  |  Branch (659:17): [True: 616k, False: 28.9k]
  ------------------
  660|       |                /* We must validate the repcode offset because when we're using a dictionary the
  661|       |                 * valid offset range shrinks when the dictionary goes out of bounds.
  662|       |                 */
  663|   616k|                if ((repIndex >= windowLow) & (ZSTD_readMINMATCH(ip, minMatch) == ZSTD_readMINMATCH(ip - repOffset, minMatch))) {
  ------------------
  |  Branch (663:21): [True: 40.7k, False: 575k]
  ------------------
  664|  40.7k|                    repLen = (U32)ZSTD_count(ip+minMatch, ip+minMatch-repOffset, iLimit) + minMatch;
  665|  40.7k|                }
  666|   616k|            } else {  /* repIndex < dictLimit || repIndex >= curr */
  667|  28.9k|                const BYTE* const repMatch = dictMode == ZSTD_dictMatchState ?
  ------------------
  |  Branch (667:46): [True: 0, False: 28.9k]
  ------------------
  668|      0|                                             dmsBase + repIndex - dmsIndexDelta :
  669|  28.9k|                                             dictBase + repIndex;
  670|  28.9k|                assert(curr >= windowLow);
  ------------------
  |  |   70|  28.9k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  671|  28.9k|                if ( dictMode == ZSTD_extDict
  ------------------
  |  Branch (671:22): [True: 0, False: 28.9k]
  ------------------
  672|      0|                  && ( ((repOffset-1) /*intentional overflow*/ < curr - windowLow)  /* equivalent to `curr > repIndex >= windowLow` */
  ------------------
  |  Branch (672:22): [True: 0, False: 0]
  ------------------
  673|      0|                     & (ZSTD_index_overlap_check(dictLimit, repIndex)) )
  674|      0|                  && (ZSTD_readMINMATCH(ip, minMatch) == ZSTD_readMINMATCH(repMatch, minMatch)) ) {
  ------------------
  |  Branch (674:22): [True: 0, False: 0]
  ------------------
  675|      0|                    repLen = (U32)ZSTD_count_2segments(ip+minMatch, repMatch+minMatch, iLimit, dictEnd, prefixStart) + minMatch;
  676|      0|                }
  677|  28.9k|                if (dictMode == ZSTD_dictMatchState
  ------------------
  |  Branch (677:21): [True: 0, False: 28.9k]
  ------------------
  678|      0|                  && ( ((repOffset-1) /*intentional overflow*/ < curr - (dmsLowLimit + dmsIndexDelta))  /* equivalent to `curr > repIndex >= dmsLowLimit` */
  ------------------
  |  Branch (678:22): [True: 0, False: 0]
  ------------------
  679|      0|                     & (ZSTD_index_overlap_check(dictLimit, repIndex)) )
  680|      0|                  && (ZSTD_readMINMATCH(ip, minMatch) == ZSTD_readMINMATCH(repMatch, minMatch)) ) {
  ------------------
  |  Branch (680:22): [True: 0, False: 0]
  ------------------
  681|      0|                    repLen = (U32)ZSTD_count_2segments(ip+minMatch, repMatch+minMatch, iLimit, dmsEnd, prefixStart) + minMatch;
  682|      0|            }   }
  683|       |            /* save longer solution */
  684|   645k|            if (repLen > bestLength) {
  ------------------
  |  Branch (684:17): [True: 27.4k, False: 618k]
  ------------------
  685|  27.4k|                DEBUGLOG(8, "found repCode %u (ll0:%u, offset:%u) of length %u",
  ------------------
  |  |  104|  27.4k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 27.4k]
  |  |  ------------------
  ------------------
  686|  27.4k|                            repCode, ll0, repOffset, repLen);
  687|  27.4k|                bestLength = repLen;
  688|  27.4k|                matches[mnum].off = REPCODE_TO_OFFBASE(repCode - ll0 + 1);  /* expect value between 1 and 3 */
  ------------------
  |  |  750|  27.4k|#define REPCODE_TO_OFFBASE(r) (assert((r)>=1), assert((r)<=ZSTD_REP_NUM), (r)) /* accepts IDs 1,2,3 */
  |  |  ------------------
  |  |  |  |   70|  27.4k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  |  |  ------------------
  |  |               #define REPCODE_TO_OFFBASE(r) (assert((r)>=1), assert((r)<=ZSTD_REP_NUM), (r)) /* accepts IDs 1,2,3 */
  |  |  ------------------
  |  |  |  |   70|  27.4k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  |  |  ------------------
  ------------------
  689|  27.4k|                matches[mnum].len = (U32)repLen;
  690|  27.4k|                mnum++;
  691|  27.4k|                if ( (repLen > sufficient_len)
  ------------------
  |  Branch (691:22): [True: 596, False: 26.8k]
  ------------------
  692|  27.4k|                   | (ip+repLen == iLimit) ) {  /* best possible */
  693|    596|                    return mnum;
  694|    596|    }   }   }   }
  695|       |
  696|       |    /* HC3 match finder */
  697|   214k|    if ((mls == 3) /*static*/ && (bestLength < mls)) {
  ------------------
  |  Branch (697:9): [True: 212k, False: 2.65k]
  |  Branch (697:34): [True: 186k, False: 25.9k]
  ------------------
  698|   186k|        U32 const matchIndex3 = ZSTD_insertAndFindFirstIndexHash3(ms, nextToUpdate3, ip);
  699|   186k|        if ((matchIndex3 >= matchLow)
  ------------------
  |  Branch (699:13): [True: 32.3k, False: 153k]
  ------------------
  700|   186k|          & (curr - matchIndex3 < (1<<18)) /*heuristic : longer distance likely too expensive*/ ) {
  701|  32.3k|            size_t mlen;
  702|  32.3k|            if ((dictMode == ZSTD_noDict) /*static*/ || (dictMode == ZSTD_dictMatchState) /*static*/ || (matchIndex3 >= dictLimit)) {
  ------------------
  |  Branch (702:17): [True: 32.3k, False: 0]
  |  Branch (702:57): [True: 0, False: 0]
  |  Branch (702:105): [True: 0, False: 0]
  ------------------
  703|  32.3k|                const BYTE* const match = base + matchIndex3;
  704|  32.3k|                mlen = ZSTD_count(ip, match, iLimit);
  705|  32.3k|            } else {
  706|      0|                const BYTE* const match = dictBase + matchIndex3;
  707|      0|                mlen = ZSTD_count_2segments(ip, match, iLimit, dictEnd, prefixStart);
  708|      0|            }
  709|       |
  710|       |            /* save best solution */
  711|  32.3k|            if (mlen >= mls /* == 3 > bestLength */) {
  ------------------
  |  Branch (711:17): [True: 25.3k, False: 6.93k]
  ------------------
  712|  25.3k|                DEBUGLOG(8, "found small match with hlog3, of length %u",
  ------------------
  |  |  104|  25.3k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 25.3k]
  |  |  ------------------
  ------------------
  713|  25.3k|                            (U32)mlen);
  714|  25.3k|                bestLength = mlen;
  715|  25.3k|                assert(curr > matchIndex3);
  ------------------
  |  |   70|  25.3k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  716|  25.3k|                assert(mnum==0);  /* no prior solution */
  ------------------
  |  |   70|  25.3k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  717|  25.3k|                matches[0].off = OFFSET_TO_OFFBASE(curr - matchIndex3);
  ------------------
  |  |  751|  25.3k|#define OFFSET_TO_OFFBASE(o)  (assert((o)>0), o + ZSTD_REP_NUM)
  |  |  ------------------
  |  |  |  |   70|  25.3k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  |  |  ------------------
  |  |               #define OFFSET_TO_OFFBASE(o)  (assert((o)>0), o + ZSTD_REP_NUM)
  |  |  ------------------
  |  |  |  |   64|  25.3k|#define ZSTD_REP_NUM      3                 /* number of repcodes */
  |  |  ------------------
  ------------------
  718|  25.3k|                matches[0].len = (U32)mlen;
  719|  25.3k|                mnum = 1;
  720|  25.3k|                if ( (mlen > sufficient_len) |
  ------------------
  |  Branch (720:22): [True: 92, False: 25.3k]
  ------------------
  721|  25.3k|                     (ip+mlen == iLimit) ) {  /* best possible length */
  722|     92|                    ms->nextToUpdate = curr+1;  /* skip insertion */
  723|     92|                    return 1;
  724|     92|        }   }   }
  725|       |        /* no dictMatchState lookup: dicts don't have a populated HC3 table */
  726|   186k|    }  /* if (mls == 3) */
  727|       |
  728|   214k|    hashTable[h] = curr;   /* Update Hash Table */
  729|       |
  730|   345k|    for (; nbCompares && (matchIndex >= matchLow); --nbCompares) {
  ------------------
  |  Branch (730:12): [True: 345k, False: 145]
  |  Branch (730:26): [True: 131k, False: 214k]
  ------------------
  731|   131k|        U32* const nextPtr = bt + 2*(matchIndex & btMask);
  732|   131k|        const BYTE* match;
  733|   131k|        size_t matchLength = MIN(commonLengthSmaller, commonLengthLarger);   /* guaranteed minimum nb of common bytes */
  ------------------
  |  |   54|   131k|#define MIN(a,b) ((a)<(b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (54:19): [True: 30.4k, False: 100k]
  |  |  ------------------
  ------------------
  734|   131k|        assert(curr > matchIndex);
  ------------------
  |  |   70|   131k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  735|       |
  736|   131k|        if ((dictMode == ZSTD_noDict) || (dictMode == ZSTD_dictMatchState) || (matchIndex+matchLength >= dictLimit)) {
  ------------------
  |  Branch (736:13): [True: 131k, False: 0]
  |  Branch (736:42): [True: 0, False: 0]
  |  Branch (736:79): [True: 0, False: 0]
  ------------------
  737|   131k|            assert(matchIndex+matchLength >= dictLimit);  /* ensure the condition is correct when !extDict */
  ------------------
  |  |   70|   131k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  738|   131k|            match = base + matchIndex;
  739|   131k|            if (matchIndex >= dictLimit) assert(memcmp(match, ip, matchLength) == 0);  /* ensure early section of match is equal as expected */
  ------------------
  |  |   70|   131k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  |  Branch (739:17): [True: 131k, False: 0]
  ------------------
  740|   131k|            matchLength += ZSTD_count(ip+matchLength, match+matchLength, iLimit);
  741|   131k|        } else {
  742|      0|            match = dictBase + matchIndex;
  743|      0|            assert(memcmp(match, ip, matchLength) == 0);  /* ensure early section of match is equal as expected */
  ------------------
  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  744|      0|            matchLength += ZSTD_count_2segments(ip+matchLength, match+matchLength, iLimit, dictEnd, prefixStart);
  745|      0|            if (matchIndex+matchLength >= dictLimit)
  ------------------
  |  Branch (745:17): [True: 0, False: 0]
  ------------------
  746|      0|                match = base + matchIndex;   /* prepare for match[matchLength] read */
  747|      0|        }
  748|       |
  749|   131k|        if (matchLength > bestLength) {
  ------------------
  |  Branch (749:13): [True: 17.0k, False: 113k]
  ------------------
  750|  17.0k|            DEBUGLOG(8, "found match of length %u at distance %u (offBase=%u)",
  ------------------
  |  |  104|  17.0k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 17.0k]
  |  |  ------------------
  ------------------
  751|  17.0k|                    (U32)matchLength, curr - matchIndex, OFFSET_TO_OFFBASE(curr - matchIndex));
  752|  17.0k|            assert(matchEndIdx > matchIndex);
  ------------------
  |  |   70|  17.0k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  753|  17.0k|            if (matchLength > matchEndIdx - matchIndex)
  ------------------
  |  Branch (753:17): [True: 43, False: 17.0k]
  ------------------
  754|     43|                matchEndIdx = matchIndex + (U32)matchLength;
  755|  17.0k|            bestLength = matchLength;
  756|  17.0k|            matches[mnum].off = OFFSET_TO_OFFBASE(curr - matchIndex);
  ------------------
  |  |  751|  17.0k|#define OFFSET_TO_OFFBASE(o)  (assert((o)>0), o + ZSTD_REP_NUM)
  |  |  ------------------
  |  |  |  |   70|  17.0k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  |  |  ------------------
  |  |               #define OFFSET_TO_OFFBASE(o)  (assert((o)>0), o + ZSTD_REP_NUM)
  |  |  ------------------
  |  |  |  |   64|  17.0k|#define ZSTD_REP_NUM      3                 /* number of repcodes */
  |  |  ------------------
  ------------------
  757|  17.0k|            matches[mnum].len = (U32)matchLength;
  758|  17.0k|            mnum++;
  759|  17.0k|            if ( (matchLength > ZSTD_OPT_NUM)
  ------------------
  |  |   62|  17.0k|#define ZSTD_OPT_NUM    (1<<12)
  ------------------
  |  Branch (759:18): [True: 241, False: 16.8k]
  ------------------
  760|  17.0k|               | (ip+matchLength == iLimit) /* equal : no way to know if inf or sup */) {
  761|    241|                if (dictMode == ZSTD_dictMatchState) nbCompares = 0; /* break should also skip searching dms */
  ------------------
  |  Branch (761:21): [True: 0, False: 241]
  ------------------
  762|    241|                break; /* drop, to preserve bt consistency (miss a little bit of compression) */
  763|    241|        }   }
  764|       |
  765|   130k|        if (match[matchLength] < ip[matchLength]) {
  ------------------
  |  Branch (765:13): [True: 68.9k, False: 61.8k]
  ------------------
  766|       |            /* match smaller than current */
  767|  68.9k|            *smallerPtr = matchIndex;             /* update smaller idx */
  768|  68.9k|            commonLengthSmaller = matchLength;    /* all smaller will now have at least this guaranteed common length */
  769|  68.9k|            if (matchIndex <= btLow) { smallerPtr=&dummy32; break; }   /* beyond tree size, stop the search */
  ------------------
  |  Branch (769:17): [True: 0, False: 68.9k]
  ------------------
  770|  68.9k|            smallerPtr = nextPtr+1;               /* new candidate => larger than match, which was smaller than current */
  771|  68.9k|            matchIndex = nextPtr[1];              /* new matchIndex, larger than previous, closer to current */
  772|  68.9k|        } else {
  773|  61.8k|            *largerPtr = matchIndex;
  774|  61.8k|            commonLengthLarger = matchLength;
  775|  61.8k|            if (matchIndex <= btLow) { largerPtr=&dummy32; break; }   /* beyond tree size, stop the search */
  ------------------
  |  Branch (775:17): [True: 0, False: 61.8k]
  ------------------
  776|  61.8k|            largerPtr = nextPtr;
  777|  61.8k|            matchIndex = nextPtr[0];
  778|  61.8k|    }   }
  779|       |
  780|   214k|    *smallerPtr = *largerPtr = 0;
  781|       |
  782|   214k|    assert(nbCompares <= (1U << ZSTD_SEARCHLOG_MAX)); /* Check we haven't underflowed. */
  ------------------
  |  |   70|   214k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  783|   214k|    if (dictMode == ZSTD_dictMatchState && nbCompares) {
  ------------------
  |  Branch (783:9): [True: 0, False: 214k]
  |  Branch (783:44): [True: 0, False: 0]
  ------------------
  784|      0|        size_t const dmsH = ZSTD_hashPtr(ip, dmsHashLog, mls);
  785|      0|        U32 dictMatchIndex = dms->hashTable[dmsH];
  786|      0|        const U32* const dmsBt = dms->chainTable;
  787|      0|        commonLengthSmaller = commonLengthLarger = 0;
  788|      0|        for (; nbCompares && (dictMatchIndex > dmsLowLimit); --nbCompares) {
  ------------------
  |  Branch (788:16): [True: 0, False: 0]
  |  Branch (788:30): [True: 0, False: 0]
  ------------------
  789|      0|            const U32* const nextPtr = dmsBt + 2*(dictMatchIndex & dmsBtMask);
  790|      0|            size_t matchLength = MIN(commonLengthSmaller, commonLengthLarger);   /* guaranteed minimum nb of common bytes */
  ------------------
  |  |   54|      0|#define MIN(a,b) ((a)<(b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (54:19): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  791|      0|            const BYTE* match = dmsBase + dictMatchIndex;
  792|      0|            matchLength += ZSTD_count_2segments(ip+matchLength, match+matchLength, iLimit, dmsEnd, prefixStart);
  793|      0|            if (dictMatchIndex+matchLength >= dmsHighLimit)
  ------------------
  |  Branch (793:17): [True: 0, False: 0]
  ------------------
  794|      0|                match = base + dictMatchIndex + dmsIndexDelta;   /* to prepare for next usage of match[matchLength] */
  795|       |
  796|      0|            if (matchLength > bestLength) {
  ------------------
  |  Branch (796:17): [True: 0, False: 0]
  ------------------
  797|      0|                matchIndex = dictMatchIndex + dmsIndexDelta;
  798|      0|                DEBUGLOG(8, "found dms match of length %u at distance %u (offBase=%u)",
  ------------------
  |  |  104|      0|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 0]
  |  |  ------------------
  ------------------
  799|      0|                        (U32)matchLength, curr - matchIndex, OFFSET_TO_OFFBASE(curr - matchIndex));
  800|      0|                if (matchLength > matchEndIdx - matchIndex)
  ------------------
  |  Branch (800:21): [True: 0, False: 0]
  ------------------
  801|      0|                    matchEndIdx = matchIndex + (U32)matchLength;
  802|      0|                bestLength = matchLength;
  803|      0|                matches[mnum].off = OFFSET_TO_OFFBASE(curr - matchIndex);
  ------------------
  |  |  751|      0|#define OFFSET_TO_OFFBASE(o)  (assert((o)>0), o + ZSTD_REP_NUM)
  |  |  ------------------
  |  |  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  |  |  ------------------
  |  |               #define OFFSET_TO_OFFBASE(o)  (assert((o)>0), o + ZSTD_REP_NUM)
  |  |  ------------------
  |  |  |  |   64|      0|#define ZSTD_REP_NUM      3                 /* number of repcodes */
  |  |  ------------------
  ------------------
  804|      0|                matches[mnum].len = (U32)matchLength;
  805|      0|                mnum++;
  806|      0|                if ( (matchLength > ZSTD_OPT_NUM)
  ------------------
  |  |   62|      0|#define ZSTD_OPT_NUM    (1<<12)
  ------------------
  |  Branch (806:22): [True: 0, False: 0]
  ------------------
  807|      0|                   | (ip+matchLength == iLimit) /* equal : no way to know if inf or sup */) {
  808|      0|                    break;   /* drop, to guarantee consistency (miss a little bit of compression) */
  809|      0|            }   }
  810|       |
  811|      0|            if (dictMatchIndex <= dmsBtLow) { break; }   /* beyond tree size, stop the search */
  ------------------
  |  Branch (811:17): [True: 0, False: 0]
  ------------------
  812|      0|            if (match[matchLength] < ip[matchLength]) {
  ------------------
  |  Branch (812:17): [True: 0, False: 0]
  ------------------
  813|      0|                commonLengthSmaller = matchLength;    /* all smaller will now have at least this guaranteed common length */
  814|      0|                dictMatchIndex = nextPtr[1];              /* new matchIndex larger than previous (closer to current) */
  815|      0|            } else {
  816|       |                /* match is larger than current */
  817|      0|                commonLengthLarger = matchLength;
  818|      0|                dictMatchIndex = nextPtr[0];
  819|      0|    }   }   }  /* if (dictMode == ZSTD_dictMatchState) */
  820|       |
  821|   214k|    assert(matchEndIdx > curr+8);
  ------------------
  |  |   70|   214k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  822|   214k|    ms->nextToUpdate = matchEndIdx - 8;  /* skip repetitive patterns */
  823|   214k|    return mnum;
  824|   214k|}
zstd_opt.c:ZSTD_readMINMATCH:
  400|  1.23M|{
  401|  1.23M|    switch (length)
  402|  1.23M|    {
  403|      0|    default :
  ------------------
  |  Branch (403:5): [True: 0, False: 1.23M]
  ------------------
  404|  15.5k|    case 4 : return MEM_read32(memPtr);
  ------------------
  |  Branch (404:5): [True: 15.5k, False: 1.21M]
  ------------------
  405|  1.21M|    case 3 : if (MEM_isLittleEndian())
  ------------------
  |  Branch (405:5): [True: 1.21M, False: 15.5k]
  |  Branch (405:18): [True: 1.21M, False: 0]
  ------------------
  406|  1.21M|                return MEM_read32(memPtr)<<8;
  407|      0|             else
  408|      0|                return MEM_read32(memPtr)>>8;
  409|  1.23M|    }
  410|  1.23M|}
zstd_opt.c:ZSTD_insertAndFindFirstIndexHash3:
  420|   186k|{
  421|   186k|    U32* const hashTable3 = ms->hashTable3;
  422|   186k|    U32 const hashLog3 = ms->hashLog3;
  423|   186k|    const BYTE* const base = ms->window.base;
  424|   186k|    U32 idx = *nextToUpdate3;
  425|   186k|    U32 const target = (U32)(ip - base);
  426|   186k|    size_t const hash3 = ZSTD_hash3Ptr(ip, hashLog3);
  427|   186k|    assert(hashLog3 > 0);
  ------------------
  |  |   70|   186k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  428|       |
  429|   399k|    while(idx < target) {
  ------------------
  |  Branch (429:11): [True: 213k, False: 186k]
  ------------------
  430|   213k|        hashTable3[ZSTD_hash3Ptr(base+idx, hashLog3)] = idx;
  431|   213k|        idx++;
  432|   213k|    }
  433|       |
  434|   186k|    *nextToUpdate3 = target;
  435|   186k|    return hashTable3[hash3];
  436|   186k|}
zstd_opt.c:ZSTD_btGetAllMatches_noDict_4:
  870|  3.07k|    {                                                          \
  871|  3.07k|        return ZSTD_btGetAllMatches_internal(                  \
  872|  3.07k|                matches, ms, nextToUpdate3, ip, iHighLimit,    \
  873|  3.07k|                rep, ll0, lengthToBeat, ZSTD_##dictMode, mls); \
  874|  3.07k|    }
zstd_opt.c:ZSTD_opt_getNextMatchAndUpdateSeqStore:
  949|  2.11k|{
  950|  2.11k|    rawSeq currSeq;
  951|  2.11k|    U32 currBlockEndPos;
  952|  2.11k|    U32 literalsBytesRemaining;
  953|  2.11k|    U32 matchBytesRemaining;
  954|       |
  955|       |    /* Setting match end position to MAX to ensure we never use an LDM during this block */
  956|  2.11k|    if (optLdm->seqStore.size == 0 || optLdm->seqStore.pos >= optLdm->seqStore.size) {
  ------------------
  |  Branch (956:9): [True: 2.11k, False: 0]
  |  Branch (956:39): [True: 0, False: 0]
  ------------------
  957|  2.11k|        optLdm->startPosInBlock = UINT_MAX;
  958|  2.11k|        optLdm->endPosInBlock = UINT_MAX;
  959|  2.11k|        return;
  960|  2.11k|    }
  961|       |    /* Calculate appropriate bytes left in matchLength and litLength
  962|       |     * after adjusting based on ldmSeqStore->posInSequence */
  963|      0|    currSeq = optLdm->seqStore.seq[optLdm->seqStore.pos];
  964|      0|    assert(optLdm->seqStore.posInSequence <= currSeq.litLength + currSeq.matchLength);
  ------------------
  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  965|      0|    currBlockEndPos = currPosInBlock + blockBytesRemaining;
  966|      0|    literalsBytesRemaining = (optLdm->seqStore.posInSequence < currSeq.litLength) ?
  ------------------
  |  Branch (966:30): [True: 0, False: 0]
  ------------------
  967|      0|            currSeq.litLength - (U32)optLdm->seqStore.posInSequence :
  968|      0|            0;
  969|      0|    matchBytesRemaining = (literalsBytesRemaining == 0) ?
  ------------------
  |  Branch (969:27): [True: 0, False: 0]
  ------------------
  970|      0|            currSeq.matchLength - ((U32)optLdm->seqStore.posInSequence - currSeq.litLength) :
  971|      0|            currSeq.matchLength;
  972|       |
  973|       |    /* If there are more literal bytes than bytes remaining in block, no ldm is possible */
  974|      0|    if (literalsBytesRemaining >= blockBytesRemaining) {
  ------------------
  |  Branch (974:9): [True: 0, False: 0]
  ------------------
  975|      0|        optLdm->startPosInBlock = UINT_MAX;
  976|      0|        optLdm->endPosInBlock = UINT_MAX;
  977|      0|        ZSTD_optLdm_skipRawSeqStoreBytes(&optLdm->seqStore, blockBytesRemaining);
  978|      0|        return;
  979|      0|    }
  980|       |
  981|       |    /* Matches may be < minMatch by this process. In that case, we will reject them
  982|       |       when we are deciding whether or not to add the ldm */
  983|      0|    optLdm->startPosInBlock = currPosInBlock + literalsBytesRemaining;
  984|      0|    optLdm->endPosInBlock = optLdm->startPosInBlock + matchBytesRemaining;
  985|      0|    optLdm->offset = currSeq.offset;
  986|       |
  987|      0|    if (optLdm->endPosInBlock > currBlockEndPos) {
  ------------------
  |  Branch (987:9): [True: 0, False: 0]
  ------------------
  988|       |        /* Match ends after the block ends, we can't use the whole match */
  989|      0|        optLdm->endPosInBlock = currBlockEndPos;
  990|      0|        ZSTD_optLdm_skipRawSeqStoreBytes(&optLdm->seqStore, currBlockEndPos - currPosInBlock);
  991|      0|    } else {
  992|       |        /* Consume nb of bytes equal to size of sequence left */
  993|      0|        ZSTD_optLdm_skipRawSeqStoreBytes(&optLdm->seqStore, literalsBytesRemaining + matchBytesRemaining);
  994|      0|    }
  995|      0|}
zstd_opt.c:ZSTD_rescaleFreqs:
  154|  2.11k|{
  155|  2.11k|    int const compressedLiterals = ZSTD_compressedLiterals(optPtr);
  156|  2.11k|    DEBUGLOG(5, "ZSTD_rescaleFreqs (srcSize=%u)", (unsigned)srcSize);
  ------------------
  |  |  104|  2.11k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 2.11k]
  |  |  ------------------
  ------------------
  157|  2.11k|    optPtr->priceType = zop_dynamic;
  158|       |
  159|  2.11k|    if (optPtr->litLengthSum == 0) {  /* no literals stats collected -> first block assumed -> init */
  ------------------
  |  Branch (159:9): [True: 1.79k, False: 320]
  ------------------
  160|       |
  161|       |        /* heuristic: use pre-defined stats for too small inputs */
  162|  1.79k|        if (srcSize <= ZSTD_PREDEF_THRESHOLD) {
  ------------------
  |  |   22|  1.79k|#define ZSTD_PREDEF_THRESHOLD 8   /* if srcSize < ZSTD_PREDEF_THRESHOLD, symbols' cost is assumed static, directly determined by pre-defined distributions */
  ------------------
  |  Branch (162:13): [True: 0, False: 1.79k]
  ------------------
  163|      0|            DEBUGLOG(5, "srcSize <= %i : use predefined stats", ZSTD_PREDEF_THRESHOLD);
  ------------------
  |  |  104|      0|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 0]
  |  |  ------------------
  ------------------
  164|      0|            optPtr->priceType = zop_predef;
  165|      0|        }
  166|       |
  167|  1.79k|        assert(optPtr->symbolCosts != NULL);
  ------------------
  |  |   70|  1.79k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  168|  1.79k|        if (optPtr->symbolCosts->huf.repeatMode == HUF_repeat_valid) {
  ------------------
  |  Branch (168:13): [True: 0, False: 1.79k]
  ------------------
  169|       |
  170|       |            /* huffman stats covering the full value set : table presumed generated by dictionary */
  171|      0|            optPtr->priceType = zop_dynamic;
  172|       |
  173|      0|            if (compressedLiterals) {
  ------------------
  |  Branch (173:17): [True: 0, False: 0]
  ------------------
  174|       |                /* generate literals statistics from huffman table */
  175|      0|                unsigned lit;
  176|      0|                assert(optPtr->litFreq != NULL);
  ------------------
  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  177|      0|                optPtr->litSum = 0;
  178|      0|                for (lit=0; lit<=MaxLit; lit++) {
  ------------------
  |  |  102|      0|#define MaxLit ((1<<Litbits) - 1)
  |  |  ------------------
  |  |  |  |  100|      0|#define Litbits  8
  |  |  ------------------
  ------------------
  |  Branch (178:29): [True: 0, False: 0]
  ------------------
  179|      0|                    U32 const scaleLog = 11;   /* scale to 2K */
  180|      0|                    U32 const bitCost = HUF_getNbBitsFromCTable(optPtr->symbolCosts->huf.CTable, lit);
  181|      0|                    optPtr->litFreq[lit] = ZSTD_freqFromBitCost(bitCost, scaleLog);
  182|      0|                    optPtr->litSum += optPtr->litFreq[lit];
  183|      0|            }   }
  184|       |
  185|      0|            {   unsigned ll;
  186|      0|                FSE_CState_t llstate;
  187|      0|                FSE_initCState(&llstate, optPtr->symbolCosts->fse.litlengthCTable);
  188|      0|                optPtr->litLengthSum = 0;
  189|      0|                for (ll=0; ll<=MaxLL; ll++) {
  ------------------
  |  |  104|      0|#define MaxLL   35
  ------------------
  |  Branch (189:28): [True: 0, False: 0]
  ------------------
  190|      0|                    U32 const scaleLog = 10;   /* scale to 1K */
  191|      0|                    U32 const bitCost = FSE_getMaxNbBits(llstate.symbolTT, ll);
  192|      0|                    optPtr->litLengthFreq[ll] = ZSTD_freqFromBitCost(bitCost, scaleLog);
  193|      0|                    optPtr->litLengthSum += optPtr->litLengthFreq[ll];
  194|      0|            }   }
  195|       |
  196|      0|            {   unsigned ml;
  197|      0|                FSE_CState_t mlstate;
  198|      0|                FSE_initCState(&mlstate, optPtr->symbolCosts->fse.matchlengthCTable);
  199|      0|                optPtr->matchLengthSum = 0;
  200|      0|                for (ml=0; ml<=MaxML; ml++) {
  ------------------
  |  |  103|      0|#define MaxML   52
  ------------------
  |  Branch (200:28): [True: 0, False: 0]
  ------------------
  201|      0|                    U32 const scaleLog = 10;
  202|      0|                    U32 const bitCost = FSE_getMaxNbBits(mlstate.symbolTT, ml);
  203|      0|                    optPtr->matchLengthFreq[ml] = ZSTD_freqFromBitCost(bitCost, scaleLog);
  204|      0|                    optPtr->matchLengthSum += optPtr->matchLengthFreq[ml];
  205|      0|            }   }
  206|       |
  207|      0|            {   unsigned of;
  208|      0|                FSE_CState_t ofstate;
  209|      0|                FSE_initCState(&ofstate, optPtr->symbolCosts->fse.offcodeCTable);
  210|      0|                optPtr->offCodeSum = 0;
  211|      0|                for (of=0; of<=MaxOff; of++) {
  ------------------
  |  |  106|      0|#define MaxOff  31
  ------------------
  |  Branch (211:28): [True: 0, False: 0]
  ------------------
  212|      0|                    U32 const scaleLog = 10;
  213|      0|                    U32 const bitCost = FSE_getMaxNbBits(ofstate.symbolTT, of);
  214|      0|                    optPtr->offCodeFreq[of] = ZSTD_freqFromBitCost(bitCost, scaleLog);
  215|      0|                    optPtr->offCodeSum += optPtr->offCodeFreq[of];
  216|      0|            }   }
  217|       |
  218|  1.79k|        } else {  /* first block, no dictionary */
  219|       |
  220|  1.79k|            assert(optPtr->litFreq != NULL);
  ------------------
  |  |   70|  1.79k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  221|  1.79k|            if (compressedLiterals) {
  ------------------
  |  Branch (221:17): [True: 1.79k, False: 0]
  ------------------
  222|       |                /* base initial cost of literals on direct frequency within src */
  223|  1.79k|                unsigned lit = MaxLit;
  ------------------
  |  |  102|  1.79k|#define MaxLit ((1<<Litbits) - 1)
  |  |  ------------------
  |  |  |  |  100|  1.79k|#define Litbits  8
  |  |  ------------------
  ------------------
  224|  1.79k|                HIST_count_simple(optPtr->litFreq, &lit, src, srcSize);   /* use raw first block to init statistics */
  225|  1.79k|                optPtr->litSum = ZSTD_downscaleStats(optPtr->litFreq, MaxLit, 8, base_0possible);
  ------------------
  |  |  102|  1.79k|#define MaxLit ((1<<Litbits) - 1)
  |  |  ------------------
  |  |  |  |  100|  1.79k|#define Litbits  8
  |  |  ------------------
  ------------------
  226|  1.79k|            }
  227|       |
  228|  1.79k|            {   unsigned const baseLLfreqs[MaxLL+1] = {
  229|  1.79k|                    4, 2, 1, 1, 1, 1, 1, 1,
  230|  1.79k|                    1, 1, 1, 1, 1, 1, 1, 1,
  231|  1.79k|                    1, 1, 1, 1, 1, 1, 1, 1,
  232|  1.79k|                    1, 1, 1, 1, 1, 1, 1, 1,
  233|  1.79k|                    1, 1, 1, 1
  234|  1.79k|                };
  235|  1.79k|                ZSTD_memcpy(optPtr->litLengthFreq, baseLLfreqs, sizeof(baseLLfreqs));
  ------------------
  |  |   44|  1.79k|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  ------------------
  236|  1.79k|                optPtr->litLengthSum = sum_u32(baseLLfreqs, MaxLL+1);
  ------------------
  |  |  104|  1.79k|#define MaxLL   35
  ------------------
  237|  1.79k|            }
  238|       |
  239|  1.79k|            {   unsigned ml;
  240|  96.9k|                for (ml=0; ml<=MaxML; ml++)
  ------------------
  |  |  103|  96.9k|#define MaxML   52
  ------------------
  |  Branch (240:28): [True: 95.1k, False: 1.79k]
  ------------------
  241|  95.1k|                    optPtr->matchLengthFreq[ml] = 1;
  242|  1.79k|            }
  243|  1.79k|            optPtr->matchLengthSum = MaxML+1;
  ------------------
  |  |  103|  1.79k|#define MaxML   52
  ------------------
  244|       |
  245|  1.79k|            {   unsigned const baseOFCfreqs[MaxOff+1] = {
  246|  1.79k|                    6, 2, 1, 1, 2, 3, 4, 4,
  247|  1.79k|                    4, 3, 2, 1, 1, 1, 1, 1,
  248|  1.79k|                    1, 1, 1, 1, 1, 1, 1, 1,
  249|  1.79k|                    1, 1, 1, 1, 1, 1, 1, 1
  250|  1.79k|                };
  251|  1.79k|                ZSTD_memcpy(optPtr->offCodeFreq, baseOFCfreqs, sizeof(baseOFCfreqs));
  ------------------
  |  |   44|  1.79k|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  ------------------
  252|  1.79k|                optPtr->offCodeSum = sum_u32(baseOFCfreqs, MaxOff+1);
  ------------------
  |  |  106|  1.79k|#define MaxOff  31
  ------------------
  253|  1.79k|            }
  254|       |
  255|  1.79k|        }
  256|       |
  257|  1.79k|    } else {   /* new block : scale down accumulated statistics */
  258|       |
  259|    320|        if (compressedLiterals)
  ------------------
  |  Branch (259:13): [True: 320, False: 0]
  ------------------
  260|    320|            optPtr->litSum = ZSTD_scaleStats(optPtr->litFreq, MaxLit, 12);
  ------------------
  |  |  102|    320|#define MaxLit ((1<<Litbits) - 1)
  |  |  ------------------
  |  |  |  |  100|    320|#define Litbits  8
  |  |  ------------------
  ------------------
  261|    320|        optPtr->litLengthSum = ZSTD_scaleStats(optPtr->litLengthFreq, MaxLL, 11);
  ------------------
  |  |  104|    320|#define MaxLL   35
  ------------------
  262|    320|        optPtr->matchLengthSum = ZSTD_scaleStats(optPtr->matchLengthFreq, MaxML, 11);
  ------------------
  |  |  103|    320|#define MaxML   52
  ------------------
  263|    320|        optPtr->offCodeSum = ZSTD_scaleStats(optPtr->offCodeFreq, MaxOff, 11);
  ------------------
  |  |  106|    320|#define MaxOff  31
  ------------------
  264|    320|    }
  265|       |
  266|  2.11k|    ZSTD_setBasePrices(optPtr, optLevel);
  267|  2.11k|}
zstd_opt.c:ZSTD_compressedLiterals:
   78|  92.9k|{
   79|  92.9k|    return optPtr->literalCompressionMode != ZSTD_ps_disable;
   80|  92.9k|}
zstd_opt.c:ZSTD_downscaleStats:
  106|  1.79k|{
  107|  1.79k|    U32 s, sum=0;
  108|  1.79k|    DEBUGLOG(5, "ZSTD_downscaleStats (nbElts=%u, shift=%u)",
  ------------------
  |  |  104|  1.79k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 1.79k]
  |  |  ------------------
  ------------------
  109|  1.79k|            (unsigned)lastEltIndex+1, (unsigned)shift );
  110|  1.79k|    assert(shift < 30);
  ------------------
  |  |   70|  1.79k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  111|   461k|    for (s=0; s<lastEltIndex+1; s++) {
  ------------------
  |  Branch (111:15): [True: 459k, False: 1.79k]
  ------------------
  112|   459k|        unsigned const base = base1 ? 1 : (table[s]>0);
  ------------------
  |  Branch (112:31): [True: 0, False: 459k]
  ------------------
  113|   459k|        unsigned const newStat = base + (table[s] >> shift);
  114|   459k|        sum += newStat;
  115|   459k|        table[s] = newStat;
  116|   459k|    }
  117|  1.79k|    return sum;
  118|  1.79k|}
zstd_opt.c:sum_u32:
   93|  4.87k|{
   94|  4.87k|    size_t n;
   95|  4.87k|    U32 total = 0;
   96|   247k|    for (n=0; n<nbElts; n++) {
  ------------------
  |  Branch (96:15): [True: 242k, False: 4.87k]
  ------------------
   97|   242k|        total += table[n];
   98|   242k|    }
   99|  4.87k|    return total;
  100|  4.87k|}
zstd_opt.c:ZSTD_scaleStats:
  124|  1.28k|{
  125|  1.28k|    U32 const prevsum = sum_u32(table, lastEltIndex+1);
  126|  1.28k|    U32 const factor = prevsum >> logTarget;
  127|  1.28k|    DEBUGLOG(5, "ZSTD_scaleStats (nbElts=%u, target=%u)", (unsigned)lastEltIndex+1, (unsigned)logTarget);
  ------------------
  |  |  104|  1.28k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 1.28k]
  |  |  ------------------
  ------------------
  128|  1.28k|    assert(logTarget < 30);
  ------------------
  |  |   70|  1.28k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  129|  1.28k|    if (factor <= 1) return prevsum;
  ------------------
  |  Branch (129:9): [True: 1.28k, False: 0]
  ------------------
  130|      0|    return ZSTD_downscaleStats(table, lastEltIndex, ZSTD_highbit32(factor), base_1guaranteed);
  131|  1.28k|}
zstd_opt.c:ZSTD_optLdm_processMatchCandidate:
 1035|   217k|{
 1036|   217k|    if (optLdm->seqStore.size == 0 || optLdm->seqStore.pos >= optLdm->seqStore.size) {
  ------------------
  |  Branch (1036:9): [True: 217k, False: 0]
  |  Branch (1036:39): [True: 0, False: 0]
  ------------------
 1037|   217k|        return;
 1038|   217k|    }
 1039|       |
 1040|      0|    if (currPosInBlock >= optLdm->endPosInBlock) {
  ------------------
  |  Branch (1040:9): [True: 0, False: 0]
  ------------------
 1041|      0|        if (currPosInBlock > optLdm->endPosInBlock) {
  ------------------
  |  Branch (1041:13): [True: 0, False: 0]
  ------------------
 1042|       |            /* The position at which ZSTD_optLdm_processMatchCandidate() is called is not necessarily
 1043|       |             * at the end of a match from the ldm seq store, and will often be some bytes
 1044|       |             * over beyond matchEndPosInBlock. As such, we need to correct for these "overshoots"
 1045|       |             */
 1046|      0|            U32 const posOvershoot = currPosInBlock - optLdm->endPosInBlock;
 1047|      0|            ZSTD_optLdm_skipRawSeqStoreBytes(&optLdm->seqStore, posOvershoot);
 1048|      0|        }
 1049|      0|        ZSTD_opt_getNextMatchAndUpdateSeqStore(optLdm, currPosInBlock, remainingBytes);
 1050|      0|    }
 1051|      0|    ZSTD_optLdm_maybeAddMatch(matches, nbMatches, optLdm, currPosInBlock, minMatch);
 1052|      0|}
zstd_opt.c:ZSTD_litLengthPrice:
  302|   335k|{
  303|   335k|    assert(litLength <= ZSTD_BLOCKSIZE_MAX);
  ------------------
  |  |   70|   335k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  304|   335k|    if (optPtr->priceType == zop_predef)
  ------------------
  |  Branch (304:9): [True: 0, False: 335k]
  ------------------
  305|      0|        return WEIGHT(litLength, optLevel);
  ------------------
  |  |   40|      0|#  define WEIGHT(stat,opt) ((opt) ? ZSTD_fracWeight(stat) : ZSTD_bitWeight(stat))
  |  |  ------------------
  |  |  |  Branch (40:29): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  306|       |
  307|       |    /* ZSTD_LLcode() can't compute litLength price for sizes >= ZSTD_BLOCKSIZE_MAX
  308|       |     * because it isn't representable in the zstd format.
  309|       |     * So instead just pretend it would cost 1 bit more than ZSTD_BLOCKSIZE_MAX - 1.
  310|       |     * In such a case, the block would be all literals.
  311|       |     */
  312|   335k|    if (litLength == ZSTD_BLOCKSIZE_MAX)
  ------------------
  |  |  148|   335k|#define ZSTD_BLOCKSIZE_MAX     (1<<ZSTD_BLOCKSIZELOG_MAX)
  |  |  ------------------
  |  |  |  |  147|   335k|#define ZSTD_BLOCKSIZELOG_MAX  17
  |  |  ------------------
  ------------------
  |  Branch (312:9): [True: 0, False: 335k]
  ------------------
  313|      0|        return BITCOST_MULTIPLIER + ZSTD_litLengthPrice(ZSTD_BLOCKSIZE_MAX - 1, optPtr, optLevel);
  ------------------
  |  |   39|      0|#  define BITCOST_MULTIPLIER (1 << BITCOST_ACCURACY)
  |  |  ------------------
  |  |  |  |   38|      0|#  define BITCOST_ACCURACY 8
  |  |  ------------------
  ------------------
                      return BITCOST_MULTIPLIER + ZSTD_litLengthPrice(ZSTD_BLOCKSIZE_MAX - 1, optPtr, optLevel);
  ------------------
  |  |  148|      0|#define ZSTD_BLOCKSIZE_MAX     (1<<ZSTD_BLOCKSIZELOG_MAX)
  |  |  ------------------
  |  |  |  |  147|      0|#define ZSTD_BLOCKSIZELOG_MAX  17
  |  |  ------------------
  ------------------
  314|       |
  315|       |    /* dynamic statistics */
  316|   335k|    {   U32 const llCode = ZSTD_LLcode(litLength);
  317|   335k|        return (LL_bits[llCode] * BITCOST_MULTIPLIER)
  ------------------
  |  |   39|   335k|#  define BITCOST_MULTIPLIER (1 << BITCOST_ACCURACY)
  |  |  ------------------
  |  |  |  |   38|   335k|#  define BITCOST_ACCURACY 8
  |  |  ------------------
  ------------------
  318|   335k|             + optPtr->litLengthSumBasePrice
  319|   335k|             - WEIGHT(optPtr->litLengthFreq[llCode], optLevel);
  ------------------
  |  |   40|   335k|#  define WEIGHT(stat,opt) ((opt) ? ZSTD_fracWeight(stat) : ZSTD_bitWeight(stat))
  |  |  ------------------
  |  |  |  Branch (40:29): [True: 333k, False: 2.23k]
  |  |  ------------------
  ------------------
  320|   335k|    }
  321|   335k|}
zstd_opt.c:ZSTD_fracWeight:
   54|  1.01M|{
   55|  1.01M|    U32 const stat = rawStat + 1;
   56|  1.01M|    U32 const hb = ZSTD_highbit32(stat);
   57|  1.01M|    U32 const BWeight = hb * BITCOST_MULTIPLIER;
  ------------------
  |  |   39|  1.01M|#  define BITCOST_MULTIPLIER (1 << BITCOST_ACCURACY)
  |  |  ------------------
  |  |  |  |   38|  1.01M|#  define BITCOST_ACCURACY 8
  |  |  ------------------
  ------------------
   58|       |    /* Fweight was meant for "Fractional weight"
   59|       |     * but it's effectively a value between 1 and 2
   60|       |     * using fixed point arithmetic */
   61|  1.01M|    U32 const FWeight = (stat << BITCOST_ACCURACY) >> hb;
  ------------------
  |  |   38|  1.01M|#  define BITCOST_ACCURACY 8
  ------------------
   62|  1.01M|    U32 const weight = BWeight + FWeight;
   63|  1.01M|    assert(hb + BITCOST_ACCURACY < 31);
  ------------------
  |  |   70|  1.01M|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
   64|  1.01M|    return weight;
   65|  1.01M|}
zstd_opt.c:ZSTD_bitWeight:
   46|  7.48k|{
   47|  7.48k|    return (ZSTD_highbit32(stat+1) * BITCOST_MULTIPLIER);
  ------------------
  |  |   39|  7.48k|#  define BITCOST_MULTIPLIER (1 << BITCOST_ACCURACY)
  |  |  ------------------
  |  |  |  |   38|  7.48k|#  define BITCOST_ACCURACY 8
  |  |  ------------------
  ------------------
   48|  7.48k|}
zstd_opt.c:ZSTD_getMatchPrice:
  334|   291k|{
  335|   291k|    U32 price;
  336|   291k|    U32 const offCode = ZSTD_highbit32(offBase);
  337|   291k|    U32 const mlBase = matchLength - MINMATCH;
  ------------------
  |  |   98|   291k|#define MINMATCH 3
  ------------------
  338|   291k|    assert(matchLength >= MINMATCH);
  ------------------
  |  |   70|   291k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  339|       |
  340|   291k|    if (optPtr->priceType == zop_predef)  /* fixed scheme, does not use statistics */
  ------------------
  |  Branch (340:9): [True: 0, False: 291k]
  ------------------
  341|      0|        return WEIGHT(mlBase, optLevel)
  ------------------
  |  |   40|      0|#  define WEIGHT(stat,opt) ((opt) ? ZSTD_fracWeight(stat) : ZSTD_bitWeight(stat))
  |  |  ------------------
  |  |  |  Branch (40:29): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  342|      0|             + ((16 + offCode) * BITCOST_MULTIPLIER); /* emulated offset cost */
  ------------------
  |  |   39|      0|#  define BITCOST_MULTIPLIER (1 << BITCOST_ACCURACY)
  |  |  ------------------
  |  |  |  |   38|      0|#  define BITCOST_ACCURACY 8
  |  |  ------------------
  ------------------
  343|       |
  344|       |    /* dynamic statistics */
  345|   291k|    price = (offCode * BITCOST_MULTIPLIER) + (optPtr->offCodeSumBasePrice - WEIGHT(optPtr->offCodeFreq[offCode], optLevel));
  ------------------
  |  |   39|   291k|#  define BITCOST_MULTIPLIER (1 << BITCOST_ACCURACY)
  |  |  ------------------
  |  |  |  |   38|   291k|#  define BITCOST_ACCURACY 8
  |  |  ------------------
  ------------------
                  price = (offCode * BITCOST_MULTIPLIER) + (optPtr->offCodeSumBasePrice - WEIGHT(optPtr->offCodeFreq[offCode], optLevel));
  ------------------
  |  |   40|   291k|#  define WEIGHT(stat,opt) ((opt) ? ZSTD_fracWeight(stat) : ZSTD_bitWeight(stat))
  |  |  ------------------
  |  |  |  Branch (40:29): [True: 291k, False: 533]
  |  |  ------------------
  ------------------
  346|   291k|    if ((optLevel<2) /*static*/ && offCode >= 20)
  ------------------
  |  Branch (346:9): [True: 533, False: 291k]
  |  Branch (346:36): [True: 0, False: 533]
  ------------------
  347|      0|        price += (offCode-19)*2 * BITCOST_MULTIPLIER; /* handicap for long distance offsets, favor decompression speed */
  ------------------
  |  |   39|      0|#  define BITCOST_MULTIPLIER (1 << BITCOST_ACCURACY)
  |  |  ------------------
  |  |  |  |   38|      0|#  define BITCOST_ACCURACY 8
  |  |  ------------------
  ------------------
  348|       |
  349|       |    /* match Length */
  350|   291k|    {   U32 const mlCode = ZSTD_MLcode(mlBase);
  351|   291k|        price += (ML_bits[mlCode] * BITCOST_MULTIPLIER) + (optPtr->matchLengthSumBasePrice - WEIGHT(optPtr->matchLengthFreq[mlCode], optLevel));
  ------------------
  |  |   39|   291k|#  define BITCOST_MULTIPLIER (1 << BITCOST_ACCURACY)
  |  |  ------------------
  |  |  |  |   38|   291k|#  define BITCOST_ACCURACY 8
  |  |  ------------------
  ------------------
                      price += (ML_bits[mlCode] * BITCOST_MULTIPLIER) + (optPtr->matchLengthSumBasePrice - WEIGHT(optPtr->matchLengthFreq[mlCode], optLevel));
  ------------------
  |  |   40|   291k|#  define WEIGHT(stat,opt) ((opt) ? ZSTD_fracWeight(stat) : ZSTD_bitWeight(stat))
  |  |  ------------------
  |  |  |  Branch (40:29): [True: 291k, False: 533]
  |  |  ------------------
  ------------------
  352|   291k|    }
  353|       |
  354|   291k|    price += BITCOST_MULTIPLIER / 5;   /* heuristic : make matches a bit more costly to favor less sequences -> faster decompression speed */
  ------------------
  |  |   39|   291k|#  define BITCOST_MULTIPLIER (1 << BITCOST_ACCURACY)
  |  |  ------------------
  |  |  |  |   38|   291k|#  define BITCOST_ACCURACY 8
  |  |  ------------------
  ------------------
  355|       |
  356|   291k|    DEBUGLOG(8, "ZSTD_getMatchPrice(ml:%u) = %u", matchLength, price);
  ------------------
  |  |  104|   291k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 291k]
  |  |  ------------------
  ------------------
  357|   291k|    return price;
  358|   291k|}
zstd_opt.c:ZSTD_rawLiteralsCost:
  275|  79.8k|{
  276|  79.8k|    DEBUGLOG(8, "ZSTD_rawLiteralsCost (%u literals)", litLength);
  ------------------
  |  |  104|  79.8k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 79.8k]
  |  |  ------------------
  ------------------
  277|  79.8k|    if (litLength == 0) return 0;
  ------------------
  |  Branch (277:9): [True: 0, False: 79.8k]
  ------------------
  278|       |
  279|  79.8k|    if (!ZSTD_compressedLiterals(optPtr))
  ------------------
  |  Branch (279:9): [True: 0, False: 79.8k]
  ------------------
  280|      0|        return (litLength << 3) * BITCOST_MULTIPLIER;  /* Uncompressed - 8 bytes per literal. */
  ------------------
  |  |   39|      0|#  define BITCOST_MULTIPLIER (1 << BITCOST_ACCURACY)
  |  |  ------------------
  |  |  |  |   38|      0|#  define BITCOST_ACCURACY 8
  |  |  ------------------
  ------------------
  281|       |
  282|  79.8k|    if (optPtr->priceType == zop_predef)
  ------------------
  |  Branch (282:9): [True: 0, False: 79.8k]
  ------------------
  283|      0|        return (litLength*6) * BITCOST_MULTIPLIER;  /* 6 bit per literal - no statistic used */
  ------------------
  |  |   39|      0|#  define BITCOST_MULTIPLIER (1 << BITCOST_ACCURACY)
  |  |  ------------------
  |  |  |  |   38|      0|#  define BITCOST_ACCURACY 8
  |  |  ------------------
  ------------------
  284|       |
  285|       |    /* dynamic statistics */
  286|  79.8k|    {   U32 price = optPtr->litSumBasePrice * litLength;
  287|  79.8k|        U32 const litPriceMax = optPtr->litSumBasePrice - BITCOST_MULTIPLIER;
  ------------------
  |  |   39|  79.8k|#  define BITCOST_MULTIPLIER (1 << BITCOST_ACCURACY)
  |  |  ------------------
  |  |  |  |   38|  79.8k|#  define BITCOST_ACCURACY 8
  |  |  ------------------
  ------------------
  288|  79.8k|        U32 u;
  289|  79.8k|        assert(optPtr->litSumBasePrice >= BITCOST_MULTIPLIER);
  ------------------
  |  |   70|  79.8k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  290|   159k|        for (u=0; u < litLength; u++) {
  ------------------
  |  Branch (290:19): [True: 79.8k, False: 79.8k]
  ------------------
  291|  79.8k|            U32 litPrice = WEIGHT(optPtr->litFreq[literals[u]], optLevel);
  ------------------
  |  |   40|  79.8k|#  define WEIGHT(stat,opt) ((opt) ? ZSTD_fracWeight(stat) : ZSTD_bitWeight(stat))
  |  |  ------------------
  |  |  |  Branch (40:29): [True: 79.4k, False: 368]
  |  |  ------------------
  ------------------
  292|  79.8k|            if (UNLIKELY(litPrice > litPriceMax)) litPrice = litPriceMax;
  ------------------
  |  |  196|  79.8k|#define UNLIKELY(x) (__builtin_expect((x), 0))
  |  |  ------------------
  |  |  |  Branch (196:21): [True: 4.11k, False: 75.7k]
  |  |  ------------------
  ------------------
  293|  79.8k|            price -= litPrice;
  294|  79.8k|        }
  295|  79.8k|        return price;
  296|  79.8k|    }
  297|  79.8k|}
zstd_opt.c:ZSTD_updateStats:
  365|  4.59k|{
  366|       |    /* literals */
  367|  4.59k|    if (ZSTD_compressedLiterals(optPtr)) {
  ------------------
  |  Branch (367:9): [True: 4.59k, False: 0]
  ------------------
  368|  4.59k|        U32 u;
  369|  82.8k|        for (u=0; u < litLength; u++)
  ------------------
  |  Branch (369:19): [True: 78.2k, False: 4.59k]
  ------------------
  370|  78.2k|            optPtr->litFreq[literals[u]] += ZSTD_LITFREQ_ADD;
  ------------------
  |  |   19|  78.2k|#define ZSTD_LITFREQ_ADD    2   /* scaling factor for litFreq, so that frequencies adapt faster to new stats */
  ------------------
  371|  4.59k|        optPtr->litSum += litLength*ZSTD_LITFREQ_ADD;
  ------------------
  |  |   19|  4.59k|#define ZSTD_LITFREQ_ADD    2   /* scaling factor for litFreq, so that frequencies adapt faster to new stats */
  ------------------
  372|  4.59k|    }
  373|       |
  374|       |    /* literal Length */
  375|  4.59k|    {   U32 const llCode = ZSTD_LLcode(litLength);
  376|  4.59k|        optPtr->litLengthFreq[llCode]++;
  377|  4.59k|        optPtr->litLengthSum++;
  378|  4.59k|    }
  379|       |
  380|       |    /* offset code : follows storeSeq() numeric representation */
  381|  4.59k|    {   U32 const offCode = ZSTD_highbit32(offBase);
  382|  4.59k|        assert(offCode <= MaxOff);
  ------------------
  |  |   70|  4.59k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  383|  4.59k|        optPtr->offCodeFreq[offCode]++;
  384|  4.59k|        optPtr->offCodeSum++;
  385|  4.59k|    }
  386|       |
  387|       |    /* match Length */
  388|  4.59k|    {   U32 const mlBase = matchLength - MINMATCH;
  ------------------
  |  |   98|  4.59k|#define MINMATCH 3
  ------------------
  389|  4.59k|        U32 const mlCode = ZSTD_MLcode(mlBase);
  390|  4.59k|        optPtr->matchLengthFreq[mlCode]++;
  391|  4.59k|        optPtr->matchLengthSum++;
  392|  4.59k|    }
  393|  4.59k|}
zstd_opt.c:ZSTD_setBasePrices:
   83|  6.34k|{
   84|  6.34k|    if (ZSTD_compressedLiterals(optPtr))
  ------------------
  |  Branch (84:9): [True: 6.34k, False: 0]
  ------------------
   85|  6.34k|        optPtr->litSumBasePrice = WEIGHT(optPtr->litSum, optLevel);
  ------------------
  |  |   40|  6.34k|#  define WEIGHT(stat,opt) ((opt) ? ZSTD_fracWeight(stat) : ZSTD_bitWeight(stat))
  |  |  ------------------
  |  |  |  Branch (40:29): [True: 5.39k, False: 954]
  |  |  ------------------
  ------------------
   86|  6.34k|    optPtr->litLengthSumBasePrice = WEIGHT(optPtr->litLengthSum, optLevel);
  ------------------
  |  |   40|  6.34k|#  define WEIGHT(stat,opt) ((opt) ? ZSTD_fracWeight(stat) : ZSTD_bitWeight(stat))
  |  |  ------------------
  |  |  |  Branch (40:29): [True: 5.39k, False: 954]
  |  |  ------------------
  ------------------
   87|  6.34k|    optPtr->matchLengthSumBasePrice = WEIGHT(optPtr->matchLengthSum, optLevel);
  ------------------
  |  |   40|  6.34k|#  define WEIGHT(stat,opt) ((opt) ? ZSTD_fracWeight(stat) : ZSTD_bitWeight(stat))
  |  |  ------------------
  |  |  |  Branch (40:29): [True: 5.39k, False: 954]
  |  |  ------------------
  ------------------
   88|  6.34k|    optPtr->offCodeSumBasePrice = WEIGHT(optPtr->offCodeSum, optLevel);
  ------------------
  |  |   40|  6.34k|#  define WEIGHT(stat,opt) ((opt) ? ZSTD_fracWeight(stat) : ZSTD_bitWeight(stat))
  |  |  ------------------
  |  |  |  Branch (40:29): [True: 5.39k, False: 954]
  |  |  ------------------
  ------------------
   89|  6.34k|}
zstd_opt.c:ZSTD_compressBlock_opt2:
 1456|  1.85k|{
 1457|  1.85k|    return ZSTD_compressBlock_opt_generic(ms, seqStore, rep, src, srcSize, 2 /* optLevel */, dictMode);
 1458|  1.85k|}
zstd_opt.c:ZSTD_initStats_ultra:
 1486|    320|{
 1487|    320|    U32 tmpRep[ZSTD_REP_NUM];  /* updated rep codes will sink here */
 1488|    320|    ZSTD_memcpy(tmpRep, rep, sizeof(tmpRep));
  ------------------
  |  |   44|    320|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  ------------------
 1489|       |
 1490|    320|    DEBUGLOG(4, "ZSTD_initStats_ultra (srcSize=%zu)", srcSize);
  ------------------
  |  |  104|    320|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 320]
  |  |  ------------------
  ------------------
 1491|    320|    assert(ms->opt.litLengthSum == 0);    /* first block */
  ------------------
  |  |   70|    320|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1492|    320|    assert(seqStore->sequences == seqStore->sequencesStart);   /* no ldm */
  ------------------
  |  |   70|    320|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1493|    320|    assert(ms->window.dictLimit == ms->window.lowLimit);   /* no dictionary */
  ------------------
  |  |   70|    320|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1494|    320|    assert(ms->window.dictLimit - ms->nextToUpdate <= 1);  /* no prefix (note: intentional overflow, defined as 2-complement) */
  ------------------
  |  |   70|    320|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1495|       |
 1496|    320|    ZSTD_compressBlock_opt2(ms, seqStore, tmpRep, src, srcSize, ZSTD_noDict);   /* generate stats into ms->opt*/
 1497|       |
 1498|       |    /* invalidate first scan from history, only keep entropy stats */
 1499|    320|    ZSTD_resetSeqStore(seqStore);
 1500|    320|    ms->window.base -= srcSize;
 1501|    320|    ms->window.dictLimit += (U32)srcSize;
 1502|    320|    ms->window.lowLimit = ms->window.dictLimit;
 1503|    320|    ms->nextToUpdate = ms->window.dictLimit;
 1504|       |
 1505|    320|}

HUF_readDTableX1_wksp:
  390|  2.76k|{
  391|  2.76k|    U32 tableLog = 0;
  392|  2.76k|    U32 nbSymbols = 0;
  393|  2.76k|    size_t iSize;
  394|  2.76k|    void* const dtPtr = DTable + 1;
  395|  2.76k|    HUF_DEltX1* const dt = (HUF_DEltX1*)dtPtr;
  396|  2.76k|    HUF_ReadDTableX1_Workspace* wksp = (HUF_ReadDTableX1_Workspace*)workSpace;
  397|       |
  398|  2.76k|    DEBUG_STATIC_ASSERT(HUF_DECOMPRESS_WORKSPACE_SIZE >= sizeof(*wksp));
  ------------------
  |  |   39|  2.76k|#define DEBUG_STATIC_ASSERT(c) (void)sizeof(char[(c) ? 1 : -1])
  ------------------
  399|  2.76k|    if (sizeof(*wksp) > wkspSize) return ERROR(tableLog_tooLarge);
  ------------------
  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (399:9): [True: 0, False: 2.76k]
  ------------------
  400|       |
  401|  2.76k|    DEBUG_STATIC_ASSERT(sizeof(DTableDesc) == sizeof(HUF_DTable));
  ------------------
  |  |   39|  2.76k|#define DEBUG_STATIC_ASSERT(c) (void)sizeof(char[(c) ? 1 : -1])
  ------------------
  402|       |    /* ZSTD_memset(huffWeight, 0, sizeof(huffWeight)); */   /* is not necessary, even though some analyzer complain ... */
  403|       |
  404|  2.76k|    iSize = HUF_readStats_wksp(wksp->huffWeight, HUF_SYMBOLVALUE_MAX + 1, wksp->rankVal, &nbSymbols, &tableLog, src, srcSize, wksp->statsWksp, sizeof(wksp->statsWksp), flags);
  ------------------
  |  |   39|  2.76k|#define HUF_SYMBOLVALUE_MAX  255
  ------------------
  405|  2.76k|    if (HUF_isError(iSize)) return iSize;
  ------------------
  |  |   80|  2.76k|#define HUF_isError ERR_isError
  ------------------
  |  Branch (405:9): [True: 17, False: 2.74k]
  ------------------
  406|       |
  407|       |
  408|       |    /* Table header */
  409|  2.74k|    {   DTableDesc dtd = HUF_getDTableDesc(DTable);
  410|  2.74k|        U32 const maxTableLog = dtd.maxTableLog + 1;
  411|  2.74k|        U32 const targetTableLog = MIN(maxTableLog, HUF_DECODER_FAST_TABLELOG);
  ------------------
  |  |   54|  2.74k|#define MIN(a,b) ((a)<(b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (54:19): [True: 0, False: 2.74k]
  |  |  ------------------
  ------------------
  412|  2.74k|        tableLog = HUF_rescaleStats(wksp->huffWeight, wksp->rankVal, nbSymbols, tableLog, targetTableLog);
  413|  2.74k|        if (tableLog > (U32)(dtd.maxTableLog+1)) return ERROR(tableLog_tooLarge);   /* DTable too small, Huffman tree cannot fit in */
  ------------------
  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (413:13): [True: 0, False: 2.74k]
  ------------------
  414|  2.74k|        dtd.tableType = 0;
  415|  2.74k|        dtd.tableLog = (BYTE)tableLog;
  416|  2.74k|        ZSTD_memcpy(DTable, &dtd, sizeof(dtd));
  ------------------
  |  |   44|  2.74k|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  ------------------
  417|  2.74k|    }
  418|       |
  419|       |    /* Compute symbols and rankStart given rankVal:
  420|       |     *
  421|       |     * rankVal already contains the number of values of each weight.
  422|       |     *
  423|       |     * symbols contains the symbols ordered by weight. First are the rankVal[0]
  424|       |     * weight 0 symbols, followed by the rankVal[1] weight 1 symbols, and so on.
  425|       |     * symbols[0] is filled (but unused) to avoid a branch.
  426|       |     *
  427|       |     * rankStart contains the offset where each rank belongs in the DTable.
  428|       |     * rankStart[0] is not filled because there are no entries in the table for
  429|       |     * weight 0.
  430|       |     */
  431|      0|    {   int n;
  432|  2.74k|        U32 nextRankStart = 0;
  433|  2.74k|        int const unroll = 4;
  434|  2.74k|        int const nLimit = (int)nbSymbols - unroll + 1;
  435|  35.6k|        for (n=0; n<(int)tableLog+1; n++) {
  ------------------
  |  Branch (435:19): [True: 32.9k, False: 2.74k]
  ------------------
  436|  32.9k|            U32 const curr = nextRankStart;
  437|  32.9k|            nextRankStart += wksp->rankVal[n];
  438|  32.9k|            wksp->rankStart[n] = curr;
  439|  32.9k|        }
  440|   107k|        for (n=0; n < nLimit; n += unroll) {
  ------------------
  |  Branch (440:19): [True: 105k, False: 2.74k]
  ------------------
  441|   105k|            int u;
  442|   525k|            for (u=0; u < unroll; ++u) {
  ------------------
  |  Branch (442:23): [True: 420k, False: 105k]
  ------------------
  443|   420k|                size_t const w = wksp->huffWeight[n+u];
  444|   420k|                wksp->symbols[wksp->rankStart[w]++] = (BYTE)(n+u);
  445|   420k|            }
  446|   105k|        }
  447|  6.31k|        for (; n < (int)nbSymbols; ++n) {
  ------------------
  |  Branch (447:16): [True: 3.57k, False: 2.74k]
  ------------------
  448|  3.57k|            size_t const w = wksp->huffWeight[n];
  449|  3.57k|            wksp->symbols[wksp->rankStart[w]++] = (BYTE)n;
  450|  3.57k|        }
  451|  2.74k|    }
  452|       |
  453|       |    /* fill DTable
  454|       |     * We fill all entries of each weight in order.
  455|       |     * That way length is a constant for each iteration of the outer loop.
  456|       |     * We can switch based on the length to a different inner loop which is
  457|       |     * optimized for that particular case.
  458|       |     */
  459|  2.74k|    {   U32 w;
  460|  2.74k|        int symbol = wksp->rankVal[0];
  461|  2.74k|        int rankStart = 0;
  462|  32.9k|        for (w=1; w<tableLog+1; ++w) {
  ------------------
  |  Branch (462:19): [True: 30.2k, False: 2.74k]
  ------------------
  463|  30.2k|            int const symbolCount = wksp->rankVal[w];
  464|  30.2k|            int const length = (1 << w) >> 1;
  465|  30.2k|            int uStart = rankStart;
  466|  30.2k|            BYTE const nbBits = (BYTE)(tableLog + 1 - w);
  467|  30.2k|            int s;
  468|  30.2k|            int u;
  469|  30.2k|            switch (length) {
  470|  2.74k|            case 1:
  ------------------
  |  Branch (470:13): [True: 2.74k, False: 27.4k]
  ------------------
  471|  2.74k|                for (s=0; s<symbolCount; ++s) {
  ------------------
  |  Branch (471:27): [True: 0, False: 2.74k]
  ------------------
  472|      0|                    HUF_DEltX1 D;
  473|      0|                    D.byte = wksp->symbols[symbol + s];
  474|      0|                    D.nbBits = nbBits;
  475|      0|                    dt[uStart] = D;
  476|      0|                    uStart += 1;
  477|      0|                }
  478|  2.74k|                break;
  479|  2.74k|            case 2:
  ------------------
  |  Branch (479:13): [True: 2.74k, False: 27.4k]
  ------------------
  480|  2.74k|                for (s=0; s<symbolCount; ++s) {
  ------------------
  |  Branch (480:27): [True: 0, False: 2.74k]
  ------------------
  481|      0|                    HUF_DEltX1 D;
  482|      0|                    D.byte = wksp->symbols[symbol + s];
  483|      0|                    D.nbBits = nbBits;
  484|      0|                    dt[uStart+0] = D;
  485|      0|                    dt[uStart+1] = D;
  486|      0|                    uStart += 2;
  487|      0|                }
  488|  2.74k|                break;
  489|  2.74k|            case 4:
  ------------------
  |  Branch (489:13): [True: 2.74k, False: 27.4k]
  ------------------
  490|  2.83k|                for (s=0; s<symbolCount; ++s) {
  ------------------
  |  Branch (490:27): [True: 88, False: 2.74k]
  ------------------
  491|     88|                    U64 const D4 = HUF_DEltX1_set4(wksp->symbols[symbol + s], nbBits);
  492|     88|                    MEM_write64(dt + uStart, D4);
  493|     88|                    uStart += 4;
  494|     88|                }
  495|  2.74k|                break;
  496|  2.74k|            case 8:
  ------------------
  |  Branch (496:13): [True: 2.74k, False: 27.4k]
  ------------------
  497|  2.89k|                for (s=0; s<symbolCount; ++s) {
  ------------------
  |  Branch (497:27): [True: 144, False: 2.74k]
  ------------------
  498|    144|                    U64 const D4 = HUF_DEltX1_set4(wksp->symbols[symbol + s], nbBits);
  499|    144|                    MEM_write64(dt + uStart, D4);
  500|    144|                    MEM_write64(dt + uStart + 4, D4);
  501|    144|                    uStart += 8;
  502|    144|                }
  503|  2.74k|                break;
  504|  19.2k|            default:
  ------------------
  |  Branch (504:13): [True: 19.2k, False: 10.9k]
  ------------------
  505|  77.3k|                for (s=0; s<symbolCount; ++s) {
  ------------------
  |  Branch (505:27): [True: 58.1k, False: 19.2k]
  ------------------
  506|  58.1k|                    U64 const D4 = HUF_DEltX1_set4(wksp->symbols[symbol + s], nbBits);
  507|   409k|                    for (u=0; u < length; u += 16) {
  ------------------
  |  Branch (507:31): [True: 351k, False: 58.1k]
  ------------------
  508|   351k|                        MEM_write64(dt + uStart + u + 0, D4);
  509|   351k|                        MEM_write64(dt + uStart + u + 4, D4);
  510|   351k|                        MEM_write64(dt + uStart + u + 8, D4);
  511|   351k|                        MEM_write64(dt + uStart + u + 12, D4);
  512|   351k|                    }
  513|  58.1k|                    assert(u == length);
  ------------------
  |  |   70|  58.1k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  514|  58.1k|                    uStart += length;
  515|  58.1k|                }
  516|  19.2k|                break;
  517|  30.2k|            }
  518|  30.2k|            symbol += symbolCount;
  519|  30.2k|            rankStart += symbolCount * length;
  520|  30.2k|        }
  521|  2.74k|    }
  522|  2.74k|    return iSize;
  523|  2.74k|}
HUF_selectDecoder:
 1836|      5|{
 1837|      5|    assert(dstSize > 0);
  ------------------
  |  |   70|      5|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1838|      5|    assert(dstSize <= 128*1024);
  ------------------
  |  |   70|      5|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1839|       |#if defined(HUF_FORCE_DECOMPRESS_X1)
 1840|       |    (void)dstSize;
 1841|       |    (void)cSrcSize;
 1842|       |    return 0;
 1843|       |#elif defined(HUF_FORCE_DECOMPRESS_X2)
 1844|       |    (void)dstSize;
 1845|       |    (void)cSrcSize;
 1846|       |    return 1;
 1847|       |#else
 1848|       |    /* decoder timing evaluation */
 1849|      5|    {   U32 const Q = (cSrcSize >= dstSize) ? 15 : (U32)(cSrcSize * 16 / dstSize);   /* Q < 16 */
  ------------------
  |  Branch (1849:23): [True: 0, False: 5]
  ------------------
 1850|      5|        U32 const D256 = (U32)(dstSize >> 8);
 1851|      5|        U32 const DTime0 = algoTime[Q][0].tableTime + (algoTime[Q][0].decode256Time * D256);
 1852|      5|        U32 DTime1 = algoTime[Q][1].tableTime + (algoTime[Q][1].decode256Time * D256);
 1853|      5|        DTime1 += DTime1 >> 5;  /* small advantage to algorithm using less memory, to reduce cache eviction */
 1854|      5|        return DTime1 < DTime0;
 1855|      5|    }
 1856|      5|#endif
 1857|      5|}
HUF_decompress1X1_DCtx_wksp:
 1909|  2.75k|{
 1910|  2.75k|    const BYTE* ip = (const BYTE*) cSrc;
 1911|       |
 1912|  2.75k|    size_t const hSize = HUF_readDTableX1_wksp(dctx, cSrc, cSrcSize, workSpace, wkspSize, flags);
 1913|  2.75k|    if (HUF_isError(hSize)) return hSize;
  ------------------
  |  |   80|  2.75k|#define HUF_isError ERR_isError
  ------------------
  |  Branch (1913:9): [True: 12, False: 2.74k]
  ------------------
 1914|  2.74k|    if (hSize >= cSrcSize) return ERROR(srcSize_wrong);
  ------------------
  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1914:9): [True: 0, False: 2.74k]
  ------------------
 1915|  2.74k|    ip += hSize; cSrcSize -= hSize;
 1916|       |
 1917|  2.74k|    return HUF_decompress1X1_usingDTable_internal(dst, dstSize, ip, cSrcSize, dctx, flags);
 1918|  2.74k|}
HUF_decompress4X_hufOnly_wksp:
 1939|      7|{
 1940|       |    /* validation checks */
 1941|      7|    if (dstSize == 0) return ERROR(dstSize_tooSmall);
  ------------------
  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1941:9): [True: 0, False: 7]
  ------------------
 1942|      7|    if (cSrcSize == 0) return ERROR(corruption_detected);
  ------------------
  |  |   49|      2|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      2|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      2|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1942:9): [True: 2, False: 5]
  ------------------
 1943|       |
 1944|      5|    {   U32 const algoNb = HUF_selectDecoder(dstSize, cSrcSize);
 1945|       |#if defined(HUF_FORCE_DECOMPRESS_X1)
 1946|       |        (void)algoNb;
 1947|       |        assert(algoNb == 0);
 1948|       |        return HUF_decompress4X1_DCtx_wksp(dctx, dst, dstSize, cSrc, cSrcSize, workSpace, wkspSize, flags);
 1949|       |#elif defined(HUF_FORCE_DECOMPRESS_X2)
 1950|       |        (void)algoNb;
 1951|       |        assert(algoNb == 1);
 1952|       |        return HUF_decompress4X2_DCtx_wksp(dctx, dst, dstSize, cSrc, cSrcSize, workSpace, wkspSize, flags);
 1953|       |#else
 1954|      5|        return algoNb ? HUF_decompress4X2_DCtx_wksp(dctx, dst, dstSize, cSrc, cSrcSize, workSpace, wkspSize, flags) :
  ------------------
  |  Branch (1954:16): [True: 0, False: 5]
  ------------------
 1955|      5|                        HUF_decompress4X1_DCtx_wksp(dctx, dst, dstSize, cSrc, cSrcSize, workSpace, wkspSize, flags);
 1956|      7|#endif
 1957|      7|    }
 1958|      7|}
huf_decompress.c:HUF_getDTableDesc:
  147|  5.49k|{
  148|  5.49k|    DTableDesc dtd;
  149|  5.49k|    ZSTD_memcpy(&dtd, table, sizeof(dtd));
  ------------------
  |  |   44|  5.49k|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  ------------------
  150|  5.49k|    return dtd;
  151|  5.49k|}
huf_decompress.c:HUF_rescaleStats:
  357|  2.74k|{
  358|  2.74k|    if (tableLog > targetTableLog)
  ------------------
  |  Branch (358:9): [True: 0, False: 2.74k]
  ------------------
  359|      0|        return tableLog;
  360|  2.74k|    if (tableLog < targetTableLog) {
  ------------------
  |  Branch (360:9): [True: 2.74k, False: 0]
  ------------------
  361|  2.74k|        U32 const scale = targetTableLog - tableLog;
  362|  2.74k|        U32 s;
  363|       |        /* Increase the weight for all non-zero probability symbols by scale. */
  364|   426k|        for (s = 0; s < nbSymbols; ++s) {
  ------------------
  |  Branch (364:21): [True: 424k, False: 2.74k]
  ------------------
  365|   424k|            huffWeight[s] += (BYTE)((huffWeight[s] == 0) ? 0 : scale);
  ------------------
  |  Branch (365:37): [True: 365k, False: 58.3k]
  ------------------
  366|   424k|        }
  367|       |        /* Update rankVal to reflect the new weights.
  368|       |         * All weights except 0 get moved to weight + scale.
  369|       |         * Weights [1, scale] are empty.
  370|       |         */
  371|  18.2k|        for (s = targetTableLog; s > scale; --s) {
  ------------------
  |  Branch (371:34): [True: 15.5k, False: 2.74k]
  ------------------
  372|  15.5k|            rankVal[s] = rankVal[s - scale];
  373|  15.5k|        }
  374|  17.4k|        for (s = scale; s > 0; --s) {
  ------------------
  |  Branch (374:25): [True: 14.6k, False: 2.74k]
  ------------------
  375|  14.6k|            rankVal[s] = 0;
  376|  14.6k|        }
  377|  2.74k|    }
  378|  2.74k|    return targetTableLog;
  379|  2.74k|}
huf_decompress.c:HUF_DEltX1_set4:
  339|  58.3k|static U64 HUF_DEltX1_set4(BYTE symbol, BYTE nbBits) {
  340|  58.3k|    U64 D4;
  341|  58.3k|    if (MEM_isLittleEndian()) {
  ------------------
  |  Branch (341:9): [True: 58.3k, False: 0]
  ------------------
  342|  58.3k|        D4 = (U64)((symbol << 8) + nbBits);
  343|  58.3k|    } else {
  344|      0|        D4 = (U64)(symbol + (nbBits << 8));
  345|      0|    }
  346|  58.3k|    assert(D4 < (1U << 16));
  ------------------
  |  |   70|  58.3k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  347|  58.3k|    D4 *= 0x0001000100010001ULL;
  348|  58.3k|    return D4;
  349|  58.3k|}
huf_decompress.c:HUF_decompress1X1_usingDTable_internal:
  120|  2.74k|    {                                                                       \
  121|  2.74k|        if (ZSTD_USE_BMI2(flags & HUF_flags_bmi2)) {                        \
  ------------------
  |  |   36|  2.74k|#  define ZSTD_USE_BMI2(bmi2) (bmi2)
  |  |  ------------------
  |  |  |  Branch (36:31): [True: 2.74k, False: 0]
  |  |  ------------------
  ------------------
  122|  2.74k|            return fn##_bmi2(dst, dstSize, cSrc, cSrcSize, DTable);         \
  123|  2.74k|        }                                                                   \
  124|  2.74k|        (void)flags;                                                        \
  125|      0|        return fn##_default(dst, dstSize, cSrc, cSrcSize, DTable);          \
  126|  2.74k|    }
huf_decompress.c:HUF_decompress1X1_usingDTable_internal_bmi2:
  114|  2.74k|    {                                                                       \
  115|  2.74k|        return fn##_body(dst, dstSize, cSrc, cSrcSize, DTable);             \
  116|  2.74k|    }                                                                       \
huf_decompress.c:HUF_decompress1X1_usingDTable_internal_body:
  583|  2.74k|{
  584|  2.74k|    BYTE* op = (BYTE*)dst;
  585|  2.74k|    BYTE* const oend = (BYTE*)ZSTD_maybeNullPtrAdd(op, (ptrdiff_t)dstSize);
  586|  2.74k|    const void* dtPtr = DTable + 1;
  587|  2.74k|    const HUF_DEltX1* const dt = (const HUF_DEltX1*)dtPtr;
  588|  2.74k|    BIT_DStream_t bitD;
  589|  2.74k|    DTableDesc const dtd = HUF_getDTableDesc(DTable);
  590|  2.74k|    U32 const dtLog = dtd.tableLog;
  591|       |
  592|  2.74k|    CHECK_F( BIT_initDStream(&bitD, cSrc, cSrcSize) );
  ------------------
  |  |   63|  2.74k|#define CHECK_F(f)   do { CHECK_V_F(_var_err__, f); } while (0)
  |  |  ------------------
  |  |  |  |   58|  2.74k|    size_t const e = f;     \
  |  |  |  |   59|  2.74k|    do {                    \
  |  |  |  |   60|  2.74k|        if (ERR_isError(e)) \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (60:13): [True: 0, False: 2.74k]
  |  |  |  |  ------------------
  |  |  |  |   61|  2.74k|            return e;       \
  |  |  |  |   62|  2.74k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (62:14): [Folded, False: 2.74k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (63:62): [Folded, False: 2.74k]
  |  |  ------------------
  ------------------
  593|       |
  594|  2.74k|    HUF_decodeStreamX1(op, &bitD, oend, dt, dtLog);
  595|       |
  596|  2.74k|    if (!BIT_endOfDStream(&bitD)) return ERROR(corruption_detected);
  ------------------
  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (596:9): [True: 0, False: 2.74k]
  ------------------
  597|       |
  598|  2.74k|    return dstSize;
  599|  2.74k|}
huf_decompress.c:HUF_decodeStreamX1:
  551|  2.74k|{
  552|  2.74k|    BYTE* const pStart = p;
  553|       |
  554|       |    /* up to 4 symbols at a time */
  555|  2.74k|    if ((pEnd - p) > 3) {
  ------------------
  |  Branch (555:9): [True: 2.74k, False: 0]
  ------------------
  556|  72.6k|        while ((BIT_reloadDStream(bitDPtr) == BIT_DStream_unfinished) & (p < pEnd-3)) {
  ------------------
  |  Branch (556:16): [True: 69.8k, False: 2.74k]
  ------------------
  557|  69.8k|            HUF_DECODE_SYMBOLX1_2(p, bitDPtr);
  ------------------
  |  |  544|  69.8k|    do {                                            \
  |  |  545|  69.8k|        if (MEM_64bits())                           \
  |  |  ------------------
  |  |  |  Branch (545:13): [True: 69.8k, False: 0]
  |  |  ------------------
  |  |  546|  69.8k|            HUF_DECODE_SYMBOLX1_0(ptr, DStreamPtr); \
  |  |  ------------------
  |  |  |  |  535|  69.8k|    do { *ptr++ = HUF_decodeSymbolX1(DStreamPtr, dt, dtLog); } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (535:71): [Folded, False: 69.8k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  547|  69.8k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (547:14): [Folded, False: 69.8k]
  |  |  ------------------
  ------------------
  558|  69.8k|            HUF_DECODE_SYMBOLX1_1(p, bitDPtr);
  ------------------
  |  |  538|  69.8k|    do {                                            \
  |  |  539|  69.8k|        if (MEM_64bits() || (HUF_TABLELOG_MAX<=12)) \
  |  |  ------------------
  |  |  |  |   37|      0|#define HUF_TABLELOG_MAX      12      /* max runtime value of tableLog (due to static allocation); can be modified up to HUF_TABLELOG_ABSOLUTEMAX */
  |  |  ------------------
  |  |  |  Branch (539:13): [True: 69.8k, False: 0]
  |  |  |  Branch (539:29): [True: 0, Folded]
  |  |  ------------------
  |  |  540|  69.8k|            HUF_DECODE_SYMBOLX1_0(ptr, DStreamPtr); \
  |  |  ------------------
  |  |  |  |  535|  69.8k|    do { *ptr++ = HUF_decodeSymbolX1(DStreamPtr, dt, dtLog); } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (535:71): [Folded, False: 69.8k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  541|  69.8k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (541:14): [Folded, False: 69.8k]
  |  |  ------------------
  ------------------
  559|  69.8k|            HUF_DECODE_SYMBOLX1_2(p, bitDPtr);
  ------------------
  |  |  544|  69.8k|    do {                                            \
  |  |  545|  69.8k|        if (MEM_64bits())                           \
  |  |  ------------------
  |  |  |  Branch (545:13): [True: 69.8k, False: 0]
  |  |  ------------------
  |  |  546|  69.8k|            HUF_DECODE_SYMBOLX1_0(ptr, DStreamPtr); \
  |  |  ------------------
  |  |  |  |  535|  69.8k|    do { *ptr++ = HUF_decodeSymbolX1(DStreamPtr, dt, dtLog); } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (535:71): [Folded, False: 69.8k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  547|  69.8k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (547:14): [Folded, False: 69.8k]
  |  |  ------------------
  ------------------
  560|  69.8k|            HUF_DECODE_SYMBOLX1_0(p, bitDPtr);
  ------------------
  |  |  535|  69.8k|    do { *ptr++ = HUF_decodeSymbolX1(DStreamPtr, dt, dtLog); } while (0)
  |  |  ------------------
  |  |  |  Branch (535:71): [Folded, False: 69.8k]
  |  |  ------------------
  ------------------
  561|  69.8k|        }
  562|  2.74k|    } else {
  563|      0|        BIT_reloadDStream(bitDPtr);
  564|      0|    }
  565|       |
  566|       |    /* [0-3] symbols remaining */
  567|  2.74k|    if (MEM_32bits())
  ------------------
  |  Branch (567:9): [True: 0, False: 2.74k]
  ------------------
  568|      0|        while ((BIT_reloadDStream(bitDPtr) == BIT_DStream_unfinished) & (p < pEnd))
  ------------------
  |  Branch (568:16): [True: 0, False: 0]
  ------------------
  569|      0|            HUF_DECODE_SYMBOLX1_0(p, bitDPtr);
  ------------------
  |  |  535|      0|    do { *ptr++ = HUF_decodeSymbolX1(DStreamPtr, dt, dtLog); } while (0)
  |  |  ------------------
  |  |  |  Branch (535:71): [Folded, False: 0]
  |  |  ------------------
  ------------------
  570|       |
  571|       |    /* no more data to retrieve from bitstream, no need to reload */
  572|  40.5k|    while (p < pEnd)
  ------------------
  |  Branch (572:12): [True: 37.7k, False: 2.74k]
  ------------------
  573|  37.7k|        HUF_DECODE_SYMBOLX1_0(p, bitDPtr);
  ------------------
  |  |  535|  37.7k|    do { *ptr++ = HUF_decodeSymbolX1(DStreamPtr, dt, dtLog); } while (0)
  |  |  ------------------
  |  |  |  Branch (535:71): [Folded, False: 37.7k]
  |  |  ------------------
  ------------------
  574|       |
  575|  2.74k|    return (size_t)(pEnd-pStart);
  576|  2.74k|}
huf_decompress.c:HUF_decodeSymbolX1:
  527|   317k|{
  528|   317k|    size_t const val = BIT_lookBitsFast(Dstream, dtLog); /* note : dtLog >= 1 */
  529|   317k|    BYTE const c = dt[val].byte;
  530|   317k|    BIT_skipBits(Dstream, dt[val].nbBits);
  531|   317k|    return c;
  532|   317k|}
huf_decompress.c:HUF_decompress4X1_DCtx_wksp:
  937|      5|{
  938|      5|    const BYTE* ip = (const BYTE*) cSrc;
  939|       |
  940|      5|    size_t const hSize = HUF_readDTableX1_wksp(dctx, cSrc, cSrcSize, workSpace, wkspSize, flags);
  941|      5|    if (HUF_isError(hSize)) return hSize;
  ------------------
  |  |   80|      5|#define HUF_isError ERR_isError
  ------------------
  |  Branch (941:9): [True: 5, False: 0]
  ------------------
  942|      0|    if (hSize >= cSrcSize) return ERROR(srcSize_wrong);
  ------------------
  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (942:9): [True: 0, False: 0]
  ------------------
  943|      0|    ip += hSize; cSrcSize -= hSize;
  944|       |
  945|      0|    return HUF_decompress4X1_usingDTable_internal(dst, dstSize, ip, cSrcSize, dctx, flags);
  946|      0|}

ZSTD_createDDict_advanced_internal:
  164|     11|{
  165|     11|    ZSTD_DDict* ddict;
  166|     11|    *ddictPtr = NULL;
  167|     11|    RETURN_ERROR_IF((!customMem.customAlloc) ^ (!customMem.customFree),
  ------------------
  |  |  114|     11|    do {                                                                       \
  |  |  115|     11|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 0, False: 11]
  |  |  ------------------
  |  |  116|      0|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|      0|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|      0|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|      0|    do {                                           \
  |  |  |  |   99|      0|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|      0|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|      0|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|      0|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|      0|        }                                                                      \
  |  |  123|     11|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 11]
  |  |  ------------------
  ------------------
  168|     11|                    parameter_combination_unsupported, "Invalid custom allocator");
  169|       |
  170|     11|    ddict = (ZSTD_DDict*) ZSTD_customMalloc(sizeof(ZSTD_DDict), customMem);
  171|     11|    RETURN_ERROR_IF(ddict == NULL, memory_allocation, "");
  ------------------
  |  |  114|     11|    do {                                                                       \
  |  |  115|     11|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 0, False: 11]
  |  |  ------------------
  |  |  116|      0|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|      0|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|      0|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|      0|    do {                                           \
  |  |  |  |   99|      0|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|      0|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|      0|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|      0|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|      0|        }                                                                      \
  |  |  123|     11|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 11]
  |  |  ------------------
  ------------------
  172|     11|    ddict->cMem = customMem;
  173|     11|    {   size_t const initResult = ZSTD_initDDict_internal(ddict,
  174|     11|                                        dict, dictSize,
  175|     11|                                        dictLoadMethod, dictContentType);
  176|     11|        if (ZSTD_isError(initResult)) {
  ------------------
  |  |   44|     11|#define ZSTD_isError ERR_isError   /* for inlining */
  ------------------
  |  Branch (176:13): [True: 0, False: 11]
  ------------------
  177|      0|            ZSTD_freeDDict(ddict);
  178|      0|            return initResult;
  179|      0|    }   }
  180|     11|    *ddictPtr = ddict;
  181|     11|    return 0;
  182|     11|}
ZSTD_createDDict_advanced:
  188|     11|{
  189|     11|    ZSTD_DDict* ddict;
  190|     11|    size_t const err = ZSTD_createDDict_advanced_internal(&ddict,
  191|     11|                            dict, dictSize, dictLoadMethod, dictContentType, customMem);
  192|     11|    if (ZSTD_isError(err)) return NULL;
  ------------------
  |  |   44|     11|#define ZSTD_isError ERR_isError   /* for inlining */
  ------------------
  |  Branch (192:9): [True: 0, False: 11]
  ------------------
  193|     11|    return ddict;
  194|     11|}
ZSTD_createDDict:
  201|     11|{
  202|     11|    ZSTD_customMem const allocator = { NULL, NULL, NULL };
  203|     11|    return ZSTD_createDDict_advanced(dict, dictSize, ZSTD_dlm_byCopy, ZSTD_dct_auto, allocator);
  204|     11|}
ZSTD_freeDDict:
  242|  5.56k|{
  243|  5.56k|    if (ddict==NULL) return 0;   /* support free on NULL */
  ------------------
  |  Branch (243:9): [True: 5.55k, False: 11]
  ------------------
  244|     11|    {   ZSTD_customMem const cMem = ddict->cMem;
  245|     11|        ZSTD_customFree(ddict->dictBuffer, cMem);
  246|     11|        ZSTD_customFree(ddict, cMem);
  247|     11|        return 0;
  248|  5.56k|    }
  249|  5.56k|}
ZSTD_sizeof_DDict:
  263|  1.30k|{
  264|  1.30k|    if (ddict==NULL) return 0;   /* support sizeof on NULL */
  ------------------
  |  Branch (264:9): [True: 1.30k, False: 0]
  ------------------
  265|      0|    return sizeof(*ddict) + (ddict->dictBuffer ? ddict->dictSize : 0) ;
  ------------------
  |  Branch (265:30): [True: 0, False: 0]
  ------------------
  266|  1.30k|}
zstd_ddict.c:ZSTD_initDDict_internal:
  136|     11|{
  137|       |    /* An empty dictionary has no referenced storage, even in by-copy mode. */
  138|     11|    if (dictSize == 0) dict = NULL;
  ------------------
  |  Branch (138:9): [True: 0, False: 11]
  ------------------
  139|     11|    if ((dictLoadMethod == ZSTD_dlm_byRef) || (!dict) || (!dictSize)) {
  ------------------
  |  Branch (139:9): [True: 0, False: 11]
  |  Branch (139:47): [True: 0, False: 11]
  |  Branch (139:58): [True: 0, False: 11]
  ------------------
  140|      0|        ddict->dictBuffer = NULL;
  141|      0|        ddict->dictContent = dict;
  142|      0|        if (!dict) dictSize = 0;
  ------------------
  |  Branch (142:13): [True: 0, False: 0]
  ------------------
  143|     11|    } else {
  144|     11|        void* const internalBuffer = ZSTD_customMalloc(dictSize, ddict->cMem);
  145|     11|        ddict->dictBuffer = internalBuffer;
  146|     11|        ddict->dictContent = internalBuffer;
  147|     11|        if (!internalBuffer) return ERROR(memory_allocation);
  ------------------
  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (147:13): [True: 0, False: 11]
  ------------------
  148|     11|        ZSTD_memcpy(internalBuffer, dict, dictSize);
  ------------------
  |  |   44|     11|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  ------------------
  149|     11|    }
  150|     11|    ddict->dictSize = dictSize;
  151|     11|    ddict->entropy.hufTable[0] = (HUF_DTable)((ZSTD_HUFFDTABLE_CAPACITY_LOG)*0x1000001);  /* cover both little and big endian */
  ------------------
  |  |   78|     11|#define ZSTD_HUFFDTABLE_CAPACITY_LOG 12
  ------------------
  152|       |
  153|       |    /* parse dictionary content */
  154|     11|    FORWARD_IF_ERROR( ZSTD_loadEntropy_intoDDict(ddict, dictContentType) , "");
  ------------------
  |  |  146|     11|    do {                                                                           \
  |  |  147|     11|        size_t const err_code = (err);                                             \
  |  |  148|     11|        if (ERR_isError(err_code)) {                                               \
  |  |  ------------------
  |  |  |  Branch (148:13): [True: 0, False: 11]
  |  |  ------------------
  |  |  149|      0|            RAWLOG(3, "%s:%d: ERROR!: forwarding error in %s: %s",                 \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  150|      0|                  __FILE__, __LINE__, ERR_QUOTE(err), ERR_getErrorName(err_code)); \
  |  |  151|      0|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                                 \
  |  |  ------------------
  |  |  |  |   98|      0|    do {                                           \
  |  |  |  |   99|      0|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  152|      0|            RAWLOG(3, ": " __VA_ARGS__);                                           \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  153|      0|            RAWLOG(3, "\n");                                                       \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  154|      0|            return err_code;                                                       \
  |  |  155|      0|        }                                                                          \
  |  |  156|     11|    } while(0)
  |  |  ------------------
  |  |  |  Branch (156:13): [Folded, False: 11]
  |  |  ------------------
  ------------------
  155|       |
  156|     11|    return 0;
  157|     11|}
zstd_ddict.c:ZSTD_loadEntropy_intoDDict:
  100|     11|{
  101|     11|    ddict->dictID = 0;
  102|     11|    ddict->dictHeaderSize = 0;
  103|     11|    ddict->entropyPresent = 0;
  104|     11|    if (dictContentType == ZSTD_dct_rawContent) return 0;
  ------------------
  |  Branch (104:9): [True: 0, False: 11]
  ------------------
  105|       |
  106|     11|    if (ddict->dictSize < 8) {
  ------------------
  |  Branch (106:9): [True: 0, False: 11]
  ------------------
  107|      0|        if (dictContentType == ZSTD_dct_fullDict)
  ------------------
  |  Branch (107:13): [True: 0, False: 0]
  ------------------
  108|      0|            return ERROR(dictionary_corrupted);   /* only accept specified dictionaries */
  ------------------
  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  109|      0|        return 0;   /* pure content mode */
  110|      0|    }
  111|     11|    {   U32 const magic = MEM_readLE32(ddict->dictContent);
  112|     11|        if (magic != ZSTD_MAGIC_DICTIONARY) {
  ------------------
  |  |  143|     11|#define ZSTD_MAGIC_DICTIONARY       0xEC30A437    /* valid since v0.7.0 */
  ------------------
  |  Branch (112:13): [True: 11, False: 0]
  ------------------
  113|     11|            if (dictContentType == ZSTD_dct_fullDict)
  ------------------
  |  Branch (113:17): [True: 0, False: 11]
  ------------------
  114|      0|                return ERROR(dictionary_corrupted);   /* only accept specified dictionaries */
  ------------------
  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  115|     11|            return 0;   /* pure content mode */
  116|     11|        }
  117|     11|    }
  118|      0|    ddict->dictID = MEM_readLE32((const char*)ddict->dictContent + ZSTD_FRAMEIDSIZE);
  ------------------
  |  |   82|      0|#define ZSTD_FRAMEIDSIZE 4   /* magic number size */
  ------------------
  119|       |
  120|       |    /* load entropy tables */
  121|      0|    {   size_t const headerSize = ZSTD_loadDEntropy(
  122|      0|                &ddict->entropy, ddict->dictContent, ddict->dictSize);
  123|      0|        RETURN_ERROR_IF(ZSTD_isError(headerSize), dictionary_corrupted, "");
  ------------------
  |  |  114|      0|    do {                                                                       \
  |  |  115|      0|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 0, False: 0]
  |  |  ------------------
  |  |  116|      0|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|      0|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|      0|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|      0|    do {                                           \
  |  |  |  |   99|      0|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|      0|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|      0|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|      0|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|      0|        }                                                                      \
  |  |  123|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  124|      0|        assert(headerSize <= ddict->dictSize);
  ------------------
  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  125|      0|        ddict->dictHeaderSize = headerSize;
  126|      0|    }
  127|      0|    ddict->entropyPresent = 1;
  128|      0|    return 0;
  129|      0|}

ZSTD_sizeof_DCtx:
  218|  1.30k|{
  219|  1.30k|    if (dctx==NULL) return 0;   /* support sizeof NULL */
  ------------------
  |  Branch (219:9): [True: 0, False: 1.30k]
  ------------------
  220|  1.30k|    return sizeof(*dctx)
  221|  1.30k|           + ZSTD_sizeof_DDict(dctx->ddictLocal)
  222|  1.30k|           + dctx->inBuffSize + dctx->outBuffSize;
  223|  1.30k|}
ZSTD_createDCtx:
  309|    404|{
  310|    404|    DEBUGLOG(3, "ZSTD_createDCtx");
  ------------------
  |  |  104|    404|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 404]
  |  |  ------------------
  ------------------
  311|    404|    return ZSTD_createDCtx_internal(ZSTD_defaultCMem);
  312|    404|}
ZSTD_freeDCtx:
  349|    404|{
  350|    404|    if (dctx==NULL) return 0;   /* support free on NULL */
  ------------------
  |  Branch (350:9): [True: 0, False: 404]
  ------------------
  351|    404|    RETURN_ERROR_IF(dctx->staticSize, memory_allocation, "not compatible with static DCtx");
  ------------------
  |  |  114|    404|    do {                                                                       \
  |  |  115|    404|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 0, False: 404]
  |  |  ------------------
  |  |  116|      0|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|      0|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|      0|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|      0|    do {                                           \
  |  |  |  |   99|      0|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|      0|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|      0|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|      0|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|      0|        }                                                                      \
  |  |  123|    404|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 404]
  |  |  ------------------
  ------------------
  352|    404|    {   ZSTD_customMem const cMem = dctx->customMem;
  353|    404|        ZSTD_clearDict(dctx);
  354|    404|        ZSTD_customFree(dctx->inBuff, cMem);
  355|    404|        dctx->inBuff = NULL;
  356|       |#if defined(ZSTD_LEGACY_SUPPORT) && (ZSTD_LEGACY_SUPPORT >= 1)
  357|       |        if (dctx->legacyContext)
  358|       |            ZSTD_freeLegacyStreamContext(dctx->legacyContext, dctx->previousLegacyVersion);
  359|       |#endif
  360|    404|        ZSTD_clearDDictSet(dctx);
  361|    404|        ZSTD_customFree(dctx, cMem);
  362|    404|        return 0;
  363|    404|    }
  364|    404|}
ZSTD_getFrameHeader_advanced:
  463|  5.13k|{
  464|  5.13k|    const BYTE* ip = (const BYTE*)src;
  465|  5.13k|    size_t const minInputSize = ZSTD_startingInputLength(format);
  466|       |
  467|  5.13k|    DEBUGLOG(5, "ZSTD_getFrameHeader_advanced: minInputSize = %zu, srcSize = %zu", minInputSize, srcSize);
  ------------------
  |  |  104|  5.13k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 5.13k]
  |  |  ------------------
  ------------------
  468|       |
  469|  5.13k|    if (srcSize > 0) {
  ------------------
  |  Branch (469:9): [True: 5.13k, False: 0]
  ------------------
  470|       |        /* note : technically could be considered an assert(), since it's an invalid entry */
  471|  5.13k|        RETURN_ERROR_IF(src==NULL, GENERIC, "invalid parameter : src==NULL, but srcSize>0");
  ------------------
  |  |  114|  5.13k|    do {                                                                       \
  |  |  115|  5.13k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 0, False: 5.13k]
  |  |  ------------------
  |  |  116|      0|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|      0|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|      0|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|      0|    do {                                           \
  |  |  |  |   99|      0|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|      0|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|      0|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|      0|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|      0|        }                                                                      \
  |  |  123|  5.13k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 5.13k]
  |  |  ------------------
  ------------------
  472|  5.13k|    }
  473|  5.13k|    if (srcSize < minInputSize) {
  ------------------
  |  Branch (473:9): [True: 0, False: 5.13k]
  ------------------
  474|      0|        if (srcSize > 0 && format != ZSTD_f_zstd1_magicless) {
  ------------------
  |  Branch (474:13): [True: 0, False: 0]
  |  Branch (474:28): [True: 0, False: 0]
  ------------------
  475|       |            /* when receiving less than @minInputSize bytes,
  476|       |             * control these bytes at least correspond to a supported magic number
  477|       |             * in order to error out early if they don't.
  478|       |            **/
  479|      0|            size_t const toCopy = MIN(4, srcSize);
  ------------------
  |  |   54|      0|#define MIN(a,b) ((a)<(b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (54:19): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  480|      0|            unsigned char hbuf[4]; MEM_writeLE32(hbuf, ZSTD_MAGICNUMBER);
  ------------------
  |  |  142|      0|#define ZSTD_MAGICNUMBER            0xFD2FB528    /* valid since v0.8.0 */
  ------------------
  481|      0|            assert(src != NULL);
  ------------------
  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  482|      0|            ZSTD_memcpy(hbuf, src, toCopy);
  ------------------
  |  |   44|      0|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  ------------------
  483|      0|            if ( MEM_readLE32(hbuf) != ZSTD_MAGICNUMBER ) {
  ------------------
  |  |  142|      0|#define ZSTD_MAGICNUMBER            0xFD2FB528    /* valid since v0.8.0 */
  ------------------
  |  Branch (483:18): [True: 0, False: 0]
  ------------------
  484|       |                /* not a zstd frame : let's check if it's a skippable frame */
  485|      0|                MEM_writeLE32(hbuf, ZSTD_MAGIC_SKIPPABLE_START);
  ------------------
  |  |  144|      0|#define ZSTD_MAGIC_SKIPPABLE_START  0x184D2A50    /* all 16 values, from 0x184D2A50 to 0x184D2A5F, signal the beginning of a skippable frame */
  ------------------
  486|      0|                ZSTD_memcpy(hbuf, src, toCopy);
  ------------------
  |  |   44|      0|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  ------------------
  487|      0|                if ((MEM_readLE32(hbuf) & ZSTD_MAGIC_SKIPPABLE_MASK) != ZSTD_MAGIC_SKIPPABLE_START) {
  ------------------
  |  |  145|      0|#define ZSTD_MAGIC_SKIPPABLE_MASK   0xFFFFFFF0
  ------------------
                              if ((MEM_readLE32(hbuf) & ZSTD_MAGIC_SKIPPABLE_MASK) != ZSTD_MAGIC_SKIPPABLE_START) {
  ------------------
  |  |  144|      0|#define ZSTD_MAGIC_SKIPPABLE_START  0x184D2A50    /* all 16 values, from 0x184D2A50 to 0x184D2A5F, signal the beginning of a skippable frame */
  ------------------
  |  Branch (487:21): [True: 0, False: 0]
  ------------------
  488|      0|                    RETURN_ERROR(prefix_unknown,
  ------------------
  |  |  131|      0|    do {                                                                     \
  |  |  132|      0|        RAWLOG(3, "%s:%d: ERROR!: unconditional check failed, returning %s", \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  133|      0|              __FILE__, __LINE__, ERR_QUOTE(ERROR(err)));                    \
  |  |  134|      0|        _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                               \
  |  |  ------------------
  |  |  |  |   98|      0|    do {                                           \
  |  |  |  |   99|      0|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  135|      0|        RAWLOG(3, ": " __VA_ARGS__);                                         \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  136|      0|        RAWLOG(3, "\n");                                                     \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  137|      0|        return ERROR(err);                                                   \
  |  |  ------------------
  |  |  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  138|      0|    } while(0)
  |  |  ------------------
  |  |  |  Branch (138:13): [Folded, False: 0]
  |  |  ------------------
  ------------------
  489|      0|                                "first bytes don't correspond to any supported magic number");
  490|      0|        }   }   }
  491|      0|        return minInputSize;
  492|      0|    }
  493|       |
  494|  5.13k|    ZSTD_memset(zfhPtr, 0, sizeof(*zfhPtr));   /* not strictly necessary, but static analyzers may not understand that zfhPtr will be read only if return value is zero, since they are 2 different signals */
  ------------------
  |  |   46|  5.13k|# define ZSTD_memset(p,v,l) __builtin_memset((p),(v),(l))
  ------------------
  495|  5.13k|    if ( (format != ZSTD_f_zstd1_magicless)
  ------------------
  |  Branch (495:10): [True: 5.13k, False: 0]
  ------------------
  496|  5.13k|      && (MEM_readLE32(src) != ZSTD_MAGICNUMBER) ) {
  ------------------
  |  |  142|  5.13k|#define ZSTD_MAGICNUMBER            0xFD2FB528    /* valid since v0.8.0 */
  ------------------
  |  Branch (496:10): [True: 46, False: 5.08k]
  ------------------
  497|     46|        if ((MEM_readLE32(src) & ZSTD_MAGIC_SKIPPABLE_MASK) == ZSTD_MAGIC_SKIPPABLE_START) {
  ------------------
  |  |  145|     46|#define ZSTD_MAGIC_SKIPPABLE_MASK   0xFFFFFFF0
  ------------------
                      if ((MEM_readLE32(src) & ZSTD_MAGIC_SKIPPABLE_MASK) == ZSTD_MAGIC_SKIPPABLE_START) {
  ------------------
  |  |  144|     46|#define ZSTD_MAGIC_SKIPPABLE_START  0x184D2A50    /* all 16 values, from 0x184D2A50 to 0x184D2A5F, signal the beginning of a skippable frame */
  ------------------
  |  Branch (497:13): [True: 0, False: 46]
  ------------------
  498|       |            /* skippable frame */
  499|      0|            if (srcSize < ZSTD_SKIPPABLEHEADERSIZE)
  ------------------
  |  | 1360|      0|#define ZSTD_SKIPPABLEHEADERSIZE    8
  ------------------
  |  Branch (499:17): [True: 0, False: 0]
  ------------------
  500|      0|                return ZSTD_SKIPPABLEHEADERSIZE; /* magic number + frame length */
  ------------------
  |  | 1360|      0|#define ZSTD_SKIPPABLEHEADERSIZE    8
  ------------------
  501|      0|            ZSTD_memset(zfhPtr, 0, sizeof(*zfhPtr));
  ------------------
  |  |   46|      0|# define ZSTD_memset(p,v,l) __builtin_memset((p),(v),(l))
  ------------------
  502|      0|            zfhPtr->frameType = ZSTD_skippableFrame;
  503|      0|            zfhPtr->dictID = MEM_readLE32(src) - ZSTD_MAGIC_SKIPPABLE_START;
  ------------------
  |  |  144|      0|#define ZSTD_MAGIC_SKIPPABLE_START  0x184D2A50    /* all 16 values, from 0x184D2A50 to 0x184D2A5F, signal the beginning of a skippable frame */
  ------------------
  504|      0|            zfhPtr->headerSize = ZSTD_SKIPPABLEHEADERSIZE;
  ------------------
  |  | 1360|      0|#define ZSTD_SKIPPABLEHEADERSIZE    8
  ------------------
  505|      0|            zfhPtr->frameContentSize = MEM_readLE32((const char *)src + ZSTD_FRAMEIDSIZE);
  ------------------
  |  |   82|      0|#define ZSTD_FRAMEIDSIZE 4   /* magic number size */
  ------------------
  506|      0|            return 0;
  507|      0|        }
  508|     46|        RETURN_ERROR(prefix_unknown, "");
  ------------------
  |  |  131|     46|    do {                                                                     \
  |  |  132|     46|        RAWLOG(3, "%s:%d: ERROR!: unconditional check failed, returning %s", \
  |  |  ------------------
  |  |  |  |  103|     46|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 46]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  133|     46|              __FILE__, __LINE__, ERR_QUOTE(ERROR(err)));                    \
  |  |  134|     46|        _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                               \
  |  |  ------------------
  |  |  |  |   98|     46|    do {                                           \
  |  |  |  |   99|     46|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 46]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|     46|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 46]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  135|     46|        RAWLOG(3, ": " __VA_ARGS__);                                         \
  |  |  ------------------
  |  |  |  |  103|     46|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 46]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  136|     46|        RAWLOG(3, "\n");                                                     \
  |  |  ------------------
  |  |  |  |  103|     46|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 46]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  137|     46|        return ERROR(err);                                                   \
  |  |  ------------------
  |  |  |  |   49|     46|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|     46|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|     46|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  138|     46|    } while(0)
  |  |  ------------------
  |  |  |  Branch (138:13): [Folded, False: 0]
  |  |  ------------------
  ------------------
  509|     46|    }
  510|       |
  511|       |    /* ensure there is enough `srcSize` to fully read/decode frame header */
  512|  5.08k|    {   size_t const fhsize = ZSTD_frameHeaderSize_internal(src, srcSize, format);
  513|  5.08k|        if (srcSize < fhsize) return fhsize;
  ------------------
  |  Branch (513:13): [True: 0, False: 5.08k]
  ------------------
  514|  5.08k|        zfhPtr->headerSize = (U32)fhsize;
  515|  5.08k|    }
  516|       |
  517|      0|    {   BYTE const fhdByte = ip[minInputSize-1];
  518|  5.08k|        size_t pos = minInputSize;
  519|  5.08k|        U32 const dictIDSizeCode = fhdByte&3;
  520|  5.08k|        U32 const checksumFlag = (fhdByte>>2)&1;
  521|  5.08k|        U32 const singleSegment = (fhdByte>>5)&1;
  522|  5.08k|        U32 const fcsID = fhdByte>>6;
  523|  5.08k|        U64 windowSize = 0;
  524|  5.08k|        U32 dictID = 0;
  525|  5.08k|        U64 frameContentSize = ZSTD_CONTENTSIZE_UNKNOWN;
  ------------------
  |  |  203|  5.08k|#define ZSTD_CONTENTSIZE_UNKNOWN (0ULL - 1)
  ------------------
  526|  5.08k|        RETURN_ERROR_IF((fhdByte & 0x08) != 0, frameParameter_unsupported,
  ------------------
  |  |  114|  5.08k|    do {                                                                       \
  |  |  115|  5.08k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 0, False: 5.08k]
  |  |  ------------------
  |  |  116|      0|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|      0|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|      0|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|      0|    do {                                           \
  |  |  |  |   99|      0|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|      0|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|      0|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|      0|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|      0|        }                                                                      \
  |  |  123|  5.08k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 5.08k]
  |  |  ------------------
  ------------------
  527|  5.08k|                        "reserved bits, must be zero");
  528|       |
  529|  5.08k|        if (!singleSegment) {
  ------------------
  |  Branch (529:13): [True: 165, False: 4.92k]
  ------------------
  530|    165|            BYTE const wlByte = ip[pos++];
  531|    165|            U32 const windowLog = (wlByte >> 3) + ZSTD_WINDOWLOG_ABSOLUTEMIN;
  ------------------
  |  |   78|    165|#define ZSTD_WINDOWLOG_ABSOLUTEMIN 10
  ------------------
  532|    165|            RETURN_ERROR_IF(windowLog > ZSTD_WINDOWLOG_MAX, frameParameter_windowTooLarge, "");
  ------------------
  |  |  114|    165|    do {                                                                       \
  |  |  115|    495|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [Folded, False: 165]
  |  |  |  Branch (115:13): [True: 1, False: 164]
  |  |  ------------------
  |  |  116|      1|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|      1|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|      1|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|      1|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|      1|    do {                                           \
  |  |  |  |   99|      1|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 1]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      1|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|      1|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|      1|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|      1|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|      1|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|      1|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|      1|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|      1|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      1|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|      1|        }                                                                      \
  |  |  123|    165|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 164]
  |  |  ------------------
  ------------------
  533|    164|            windowSize = (1ULL << windowLog);
  534|    164|            windowSize += (windowSize >> 3) * (wlByte&7);
  535|    164|        }
  536|  5.08k|        switch(dictIDSizeCode)
  537|  5.08k|        {
  538|      0|            default:
  ------------------
  |  Branch (538:13): [True: 0, False: 5.08k]
  ------------------
  539|      0|                assert(0);  /* impossible */
  ------------------
  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  540|      0|                ZSTD_FALLTHROUGH;
  ------------------
  |  |  288|      0|#  define ZSTD_FALLTHROUGH ; __attribute__((__fallthrough__))
  ------------------
  541|  4.99k|            case 0 : break;
  ------------------
  |  Branch (541:13): [True: 4.99k, False: 89]
  ------------------
  542|     72|            case 1 : dictID = ip[pos]; pos++; break;
  ------------------
  |  Branch (542:13): [True: 72, False: 5.01k]
  ------------------
  543|     14|            case 2 : dictID = MEM_readLE16(ip+pos); pos+=2; break;
  ------------------
  |  Branch (543:13): [True: 14, False: 5.07k]
  ------------------
  544|      3|            case 3 : dictID = MEM_readLE32(ip+pos); pos+=4; break;
  ------------------
  |  Branch (544:13): [True: 3, False: 5.08k]
  ------------------
  545|  5.08k|        }
  546|  5.08k|        switch(fcsID)
  547|  5.08k|        {
  548|      0|            default:
  ------------------
  |  Branch (548:13): [True: 0, False: 5.08k]
  ------------------
  549|      0|                assert(0);  /* impossible */
  ------------------
  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  550|      0|                ZSTD_FALLTHROUGH;
  ------------------
  |  |  288|      0|#  define ZSTD_FALLTHROUGH ; __attribute__((__fallthrough__))
  ------------------
  551|  4.94k|            case 0 : if (singleSegment) frameContentSize = ip[pos]; break;
  ------------------
  |  Branch (551:13): [True: 4.94k, False: 141]
  |  Branch (551:26): [True: 4.78k, False: 163]
  ------------------
  552|     83|            case 1 : frameContentSize = MEM_readLE16(ip+pos)+256; break;
  ------------------
  |  Branch (552:13): [True: 83, False: 5.00k]
  ------------------
  553|     17|            case 2 : frameContentSize = MEM_readLE32(ip+pos); break;
  ------------------
  |  Branch (553:13): [True: 17, False: 5.06k]
  ------------------
  554|     41|            case 3 : frameContentSize = MEM_readLE64(ip+pos); break;
  ------------------
  |  Branch (554:13): [True: 41, False: 5.04k]
  ------------------
  555|  5.08k|        }
  556|  5.08k|        if (singleSegment) windowSize = frameContentSize;
  ------------------
  |  Branch (556:13): [True: 4.92k, False: 164]
  ------------------
  557|       |
  558|  5.08k|        zfhPtr->frameType = ZSTD_frame;
  559|  5.08k|        zfhPtr->frameContentSize = frameContentSize;
  560|  5.08k|        zfhPtr->windowSize = windowSize;
  561|  5.08k|        zfhPtr->blockSizeMax = (unsigned) MIN(windowSize, ZSTD_BLOCKSIZE_MAX);
  ------------------
  |  |   54|  5.08k|#define MIN(a,b) ((a)<(b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (54:19): [True: 4.99k, False: 88]
  |  |  ------------------
  ------------------
  562|  5.08k|        zfhPtr->dictID = dictID;
  563|  5.08k|        zfhPtr->checksumFlag = checksumFlag;
  564|  5.08k|    }
  565|      0|    return 0;
  566|  5.08k|}
ZSTD_decompressDCtx:
 1231|  5.15k|{
 1232|       |    /* Reset first: this may discard a prefix abandoned by an unfinished
 1233|       |     * stream, which must happen before the dictionary is resolved. */
 1234|  5.15k|    ZSTD_DCtx_resetSession(dctx);
 1235|  5.15k|    if (dctx->refMultipleDDicts && dctx->ddictSet)
  ------------------
  |  Branch (1235:9): [True: 0, False: 5.15k]
  |  Branch (1235:36): [True: 0, False: 0]
  ------------------
 1236|      0|        return ZSTD_decompressMultiFrame(dctx, dst, dstCapacity, src, srcSize,
 1237|      0|                                         NULL, 0, NULL, 1);
 1238|       |    /* Preserve the single-dictionary behavior: resolve once for the entire
 1239|       |     * call, including concatenated frames and single-use prefixes. */
 1240|  5.15k|    return ZSTD_decompressMultiFrame(dctx, dst, dstCapacity, src, srcSize,
 1241|       |                                     NULL, 0, ZSTD_getDDict(dctx), 0);
 1242|  5.15k|}
ZSTD_decompressBegin:
 1620|  5.14k|{
 1621|  5.14k|    assert(dctx != NULL);
  ------------------
  |  |   70|  5.14k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1622|  5.14k|#if ZSTD_TRACE
 1623|  5.14k|    dctx->traceCtx = (ZSTD_trace_decompress_begin != NULL) ? ZSTD_trace_decompress_begin(dctx) : 0;
  ------------------
  |  Branch (1623:22): [True: 0, False: 5.14k]
  ------------------
 1624|  5.14k|    dctx->traceDictSize = 0;
 1625|  5.14k|#endif
 1626|  5.14k|    dctx->expected = ZSTD_startingInputLength(dctx->format);  /* dctx->format must be properly set */
 1627|  5.14k|    dctx->stage = ZSTDds_getFrameHeaderSize;
 1628|  5.14k|    dctx->processedCSize = 0;
 1629|  5.14k|    dctx->decodedSize = 0;
 1630|  5.14k|    dctx->previousDstEnd = NULL;
 1631|  5.14k|    dctx->prefixStart = NULL;
 1632|  5.14k|    dctx->virtualStart = NULL;
 1633|  5.14k|    dctx->dictEnd = NULL;
 1634|  5.14k|    dctx->entropy.hufTable[0] = (HUF_DTable)((ZSTD_HUFFDTABLE_CAPACITY_LOG)*0x1000001);  /* cover both little and big endian */
  ------------------
  |  |   78|  5.14k|#define ZSTD_HUFFDTABLE_CAPACITY_LOG 12
  ------------------
 1635|  5.14k|    dctx->litEntropy = dctx->fseEntropy = 0;
 1636|  5.14k|    dctx->dictID = 0;
 1637|  5.14k|    dctx->bType = bt_reserved;
 1638|  5.14k|    dctx->isFrameDecompression = 1;
 1639|  5.14k|    ZSTD_STATIC_ASSERT(sizeof(dctx->entropy.rep) == sizeof(repStartValue));
  ------------------
  |  |   43|  5.14k|#define ZSTD_STATIC_ASSERT(c) DEBUG_STATIC_ASSERT(c)
  |  |  ------------------
  |  |  |  |   39|  5.14k|#define DEBUG_STATIC_ASSERT(c) (void)sizeof(char[(c) ? 1 : -1])
  |  |  ------------------
  ------------------
 1640|  5.14k|    ZSTD_memcpy(dctx->entropy.rep, repStartValue, sizeof(repStartValue));  /* initial repcodes */
  ------------------
  |  |   44|  5.14k|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  ------------------
 1641|  5.14k|    dctx->LLTptr = dctx->entropy.LLTable;
 1642|  5.14k|    dctx->MLTptr = dctx->entropy.MLTable;
 1643|  5.14k|    dctx->OFTptr = dctx->entropy.OFTable;
 1644|  5.14k|    dctx->HUFptr = dctx->entropy.hufTable;
 1645|  5.14k|    return 0;
 1646|  5.14k|}
ZSTD_decompressBegin_usingDict:
 1649|  5.14k|{
 1650|  5.14k|    FORWARD_IF_ERROR( ZSTD_decompressBegin(dctx) , "");
  ------------------
  |  |  146|  5.14k|    do {                                                                           \
  |  |  147|  5.14k|        size_t const err_code = (err);                                             \
  |  |  148|  5.14k|        if (ERR_isError(err_code)) {                                               \
  |  |  ------------------
  |  |  |  Branch (148:13): [True: 0, False: 5.14k]
  |  |  ------------------
  |  |  149|      0|            RAWLOG(3, "%s:%d: ERROR!: forwarding error in %s: %s",                 \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  150|      0|                  __FILE__, __LINE__, ERR_QUOTE(err), ERR_getErrorName(err_code)); \
  |  |  151|      0|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                                 \
  |  |  ------------------
  |  |  |  |   98|      0|    do {                                           \
  |  |  |  |   99|      0|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  152|      0|            RAWLOG(3, ": " __VA_ARGS__);                                           \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  153|      0|            RAWLOG(3, "\n");                                                       \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  154|      0|            return err_code;                                                       \
  |  |  155|      0|        }                                                                          \
  |  |  156|  5.14k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (156:13): [Folded, False: 5.14k]
  |  |  ------------------
  ------------------
 1651|  5.14k|    if (dict && dictSize)
  ------------------
  |  Branch (1651:9): [True: 0, False: 5.14k]
  |  Branch (1651:17): [True: 0, False: 0]
  ------------------
 1652|      0|        RETURN_ERROR_IF(
  ------------------
  |  |  114|      0|    do {                                                                       \
  |  |  115|      0|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 0, False: 0]
  |  |  ------------------
  |  |  116|      0|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|      0|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|      0|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|      0|    do {                                           \
  |  |  |  |   99|      0|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|      0|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|      0|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|      0|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|      0|        }                                                                      \
  |  |  123|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1653|  5.14k|            ZSTD_isError(ZSTD_decompress_insertDictionary(dctx, dict, dictSize)),
 1654|  5.14k|            dictionary_corrupted, "");
 1655|  5.14k|#if ZSTD_TRACE
 1656|  5.14k|    dctx->traceDictSize = dict ? dictSize : 0;
  ------------------
  |  Branch (1656:27): [True: 0, False: 5.14k]
  ------------------
 1657|  5.14k|#endif
 1658|  5.14k|    return 0;
 1659|  5.14k|}
zstd_decompress.c:ZSTD_initDCtx_internal:
  249|    404|{
  250|    404|    dctx->customMem   = customMem;
  251|    404|    dctx->staticSize  = 0;
  252|    404|    dctx->ddict       = NULL;
  253|    404|    dctx->ddictLocal  = NULL;
  254|    404|    dctx->dictEnd     = NULL;
  255|    404|    dctx->ddictIsCold = 0;
  256|    404|    dctx->dictUses = ZSTD_dont_use;
  257|    404|    dctx->inBuff      = NULL;
  258|    404|    dctx->inBuffSize  = 0;
  259|    404|    dctx->outBuffSize = 0;
  260|    404|    dctx->streamStage = zdss_init;
  261|    404|    dctx->stage       = ZSTDds_getFrameHeaderSize;
  262|    404|    dctx->expected    = 0;   /* ZSTD_decompressContinue() requires ZSTD_decompressBegin() first */
  263|       |#if defined(ZSTD_LEGACY_SUPPORT) && (ZSTD_LEGACY_SUPPORT>=1)
  264|       |    dctx->legacyContext = NULL;
  265|       |    dctx->previousLegacyVersion = 0;
  266|       |#endif
  267|    404|    dctx->noForwardProgress = 0;
  268|    404|    dctx->oversizedDuration = 0;
  269|    404|    dctx->isFrameDecompression = 1;
  270|    404|#if DYNAMIC_BMI2
  271|    404|    ZSTD_SET_BMI2(dctx->bmi2, ZSTD_cpuSupportsBmi2());
  ------------------
  |  |   37|    404|#  define ZSTD_SET_BMI2(state, value) do { (state) = (value); } while (0)
  |  |  ------------------
  |  |  |  Branch (37:72): [Folded, False: 404]
  |  |  ------------------
  ------------------
  272|    404|#endif
  273|    404|    dctx->ddictSet = NULL;
  274|    404|    ZSTD_DCtx_resetParameters(dctx);
  275|    404|#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
  276|       |    dctx->dictContentEndForFuzzing = NULL;
  277|    404|#endif
  278|    404|}
zstd_decompress.c:ZSTD_createDCtx_internal:
  293|    404|static ZSTD_DCtx* ZSTD_createDCtx_internal(ZSTD_customMem customMem) {
  294|    404|    if ((!customMem.customAlloc) ^ (!customMem.customFree)) return NULL;
  ------------------
  |  Branch (294:9): [True: 0, False: 404]
  ------------------
  295|       |
  296|    404|    {   ZSTD_DCtx* const dctx = (ZSTD_DCtx*)ZSTD_customMalloc(sizeof(*dctx), customMem);
  297|    404|        if (!dctx) return NULL;
  ------------------
  |  Branch (297:13): [True: 0, False: 404]
  ------------------
  298|    404|        ZSTD_initDCtx_internal(dctx, customMem);
  299|    404|        return dctx;
  300|    404|    }
  301|    404|}
zstd_decompress.c:ZSTD_clearDict:
  315|  5.55k|{
  316|  5.55k|    ZSTD_freeDDict(dctx->ddictLocal);
  317|  5.55k|    dctx->ddictLocal = NULL;
  318|       |    dctx->ddict = NULL;
  319|  5.55k|    dctx->dictUses = ZSTD_dont_use;
  320|  5.55k|}
zstd_decompress.c:ZSTD_clearDDictSet:
  340|    404|{
  341|    404|    if (dctx->ddictSet != NULL) {
  ------------------
  |  Branch (341:9): [True: 0, False: 404]
  ------------------
  342|      0|        assert(!dctx->staticSize);
  ------------------
  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  343|      0|        ZSTD_freeDDictHashSet(dctx->ddictSet, dctx->customMem);
  344|       |        dctx->ddictSet = NULL;
  345|      0|    }
  346|    404|}
zstd_decompress.c:ZSTD_frameHeaderSize_internal:
  432|  10.2k|{
  433|  10.2k|    size_t const minInputSize = ZSTD_startingInputLength(format);
  434|  10.2k|    RETURN_ERROR_IF(srcSize < minInputSize, srcSize_wrong, "");
  ------------------
  |  |  114|  10.2k|    do {                                                                       \
  |  |  115|  10.2k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 0, False: 10.2k]
  |  |  ------------------
  |  |  116|      0|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|      0|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|      0|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|      0|    do {                                           \
  |  |  |  |   99|      0|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|      0|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|      0|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|      0|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|      0|        }                                                                      \
  |  |  123|  10.2k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 10.2k]
  |  |  ------------------
  ------------------
  435|       |
  436|  10.2k|    {   BYTE const fhd = ((const BYTE*)src)[minInputSize-1];
  437|  10.2k|        U32 const dictID= fhd & 3;
  438|  10.2k|        U32 const singleSegment = (fhd >> 5) & 1;
  439|  10.2k|        U32 const fcsId = fhd >> 6;
  440|  10.2k|        return minInputSize + !singleSegment
  441|  10.2k|             + ZSTD_did_fieldSize[dictID] + ZSTD_fcs_fieldSize[fcsId]
  442|  10.2k|             + (singleSegment && !fcsId);
  ------------------
  |  Branch (442:17): [True: 9.86k, False: 356]
  |  Branch (442:34): [True: 9.57k, False: 294]
  ------------------
  443|  10.2k|    }
  444|  10.2k|}
zstd_decompress.c:ZSTD_startingInputLength:
  229|  30.4k|{
  230|  30.4k|    size_t const startingInputLength = ZSTD_FRAMEHEADERSIZE_PREFIX(format);
  ------------------
  |  | 1357|  30.4k|#define ZSTD_FRAMEHEADERSIZE_PREFIX(format) ((format) == ZSTD_f_zstd1 ? 5 : 1)   /* minimum input size required to query frame header size */
  |  |  ------------------
  |  |  |  Branch (1357:46): [True: 30.4k, False: 0]
  |  |  ------------------
  ------------------
  231|       |    /* only supports formats ZSTD_f_zstd1 and ZSTD_f_zstd1_magicless */
  232|  30.4k|    assert( (format == ZSTD_f_zstd1) || (format == ZSTD_f_zstd1_magicless) );
  ------------------
  |  |   70|  30.4k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  233|  30.4k|    return startingInputLength;
  234|  30.4k|}
zstd_decompress.c:readSkippableFrameSize:
  603|     19|{
  604|     19|    size_t const skippableHeaderSize = ZSTD_SKIPPABLEHEADERSIZE;
  ------------------
  |  | 1360|     19|#define ZSTD_SKIPPABLEHEADERSIZE    8
  ------------------
  605|     19|    U32 sizeU32;
  606|       |
  607|     19|    RETURN_ERROR_IF(srcSize < ZSTD_SKIPPABLEHEADERSIZE, srcSize_wrong, "");
  ------------------
  |  |  114|     19|    do {                                                                       \
  |  |  115|     19|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 0, False: 19]
  |  |  ------------------
  |  |  116|      0|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|      0|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|      0|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|      0|    do {                                           \
  |  |  |  |   99|      0|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|      0|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|      0|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|      0|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|      0|        }                                                                      \
  |  |  123|     19|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 19]
  |  |  ------------------
  ------------------
  608|       |
  609|     19|    sizeU32 = MEM_readLE32((BYTE const*)src + ZSTD_FRAMEIDSIZE);
  ------------------
  |  |   82|     19|#define ZSTD_FRAMEIDSIZE 4   /* magic number size */
  ------------------
  610|     19|    RETURN_ERROR_IF((U32)(sizeU32 + ZSTD_SKIPPABLEHEADERSIZE) < sizeU32,
  ------------------
  |  |  114|     19|    do {                                                                       \
  |  |  115|     19|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 0, False: 19]
  |  |  ------------------
  |  |  116|      0|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|      0|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|      0|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|      0|    do {                                           \
  |  |  |  |   99|      0|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|      0|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|      0|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|      0|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|      0|        }                                                                      \
  |  |  123|     19|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 19]
  |  |  ------------------
  ------------------
  611|     19|                    frameParameter_unsupported, "");
  612|     19|    {   size_t const skippableSize = skippableHeaderSize + sizeU32;
  613|     19|        RETURN_ERROR_IF(skippableSize > srcSize, srcSize_wrong, "");
  ------------------
  |  |  114|     19|    do {                                                                       \
  |  |  115|     19|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 17, False: 2]
  |  |  ------------------
  |  |  116|     17|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|     17|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 17]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|     17|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|     17|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|     17|    do {                                           \
  |  |  |  |   99|     17|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 17]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|     17|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 17]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|     17|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|     17|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 17]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|     17|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|     17|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 17]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|     17|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|     17|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|     17|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|     17|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|     17|        }                                                                      \
  |  |  123|     19|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 2]
  |  |  ------------------
  ------------------
  614|      2|        return skippableSize;
  615|     19|    }
  616|     19|}
zstd_decompress.c:ZSTD_DCtx_resetSession:
  328|  5.15k|{
  329|       |    /* A prefix is only used once : if a frame was started, it is abandoned now,
  330|       |     * so the prefix must not leak into the next frame */
  331|  5.15k|    if (dctx->streamStage != zdss_init && dctx->dictUses == ZSTD_use_once)
  ------------------
  |  Branch (331:9): [True: 0, False: 5.15k]
  |  Branch (331:43): [True: 0, False: 0]
  ------------------
  332|      0|        ZSTD_clearDict(dctx);
  333|  5.15k|    dctx->streamStage = zdss_init;
  334|  5.15k|    dctx->noForwardProgress = 0;
  335|  5.15k|    dctx->isFrameDecompression = 1;
  336|  5.15k|}
zstd_decompress.c:ZSTD_decompressMultiFrame:
 1093|  5.15k|{
 1094|  5.15k|    void* const dststart = dst;
 1095|  5.15k|    int moreThan1Frame = 0;
 1096|       |
 1097|  5.15k|    DEBUGLOG(5, "ZSTD_decompressMultiFrame");
  ------------------
  |  |  104|  5.15k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 5.15k]
  |  |  ------------------
  ------------------
 1098|  5.15k|    assert(dict==NULL || ddict==NULL);  /* either dict or ddict set, not both */
  ------------------
  |  |   70|  5.15k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1099|       |
 1100|  5.15k|    assert(!useDDictSet || (dctx->refMultipleDDicts && dctx->ddictSet
  ------------------
  |  |   70|  5.15k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1101|  5.15k|                           && dctx->ddictLocal == NULL && dctx->ddict == NULL
 1102|  5.15k|                           && dict == NULL && ddict == NULL));
 1103|       |
 1104|  9.94k|    while (srcSize >= ZSTD_startingInputLength(dctx->format)) {
  ------------------
  |  Branch (1104:12): [True: 5.16k, False: 4.77k]
  ------------------
 1105|  5.16k|        const ZSTD_DDict* frameDDict = ddict;
 1106|       |
 1107|       |#if defined(ZSTD_LEGACY_SUPPORT) && (ZSTD_LEGACY_SUPPORT >= 1)
 1108|       |        if (dctx->format == ZSTD_f_zstd1 && ZSTD_isLegacy(src, srcSize)) {
 1109|       |            size_t decodedSize;
 1110|       |            const void* const legacyDict = ddict ? ZSTD_DDict_dictContent(ddict) : dict;
 1111|       |            size_t const legacyDictSize = ddict ? ZSTD_DDict_dictSize(ddict) : dictSize;
 1112|       |            size_t frameSize;
 1113|       |            RETURN_ERROR_IF(useDDictSet, parameter_unsupported,
 1114|       |                            "DDict-set selection is not supported for legacy frames");
 1115|       |            frameSize = ZSTD_findFrameCompressedSizeLegacy(src, srcSize);
 1116|       |            if (ZSTD_isError(frameSize)) return frameSize;
 1117|       |            RETURN_ERROR_IF(dctx->staticSize, memory_allocation,
 1118|       |                "legacy support is not compatible with static dctx");
 1119|       |
 1120|       |            decodedSize = ZSTD_decompressLegacy(dst, dstCapacity, src, frameSize, legacyDict, legacyDictSize);
 1121|       |            if (ZSTD_isError(decodedSize)) return decodedSize;
 1122|       |
 1123|       |            {
 1124|       |                unsigned long long const expectedSize = ZSTD_getFrameContentSize(src, srcSize);
 1125|       |                RETURN_ERROR_IF(expectedSize == ZSTD_CONTENTSIZE_ERROR, corruption_detected, "Corrupted frame header!");
 1126|       |                if (expectedSize != ZSTD_CONTENTSIZE_UNKNOWN) {
 1127|       |                    RETURN_ERROR_IF(expectedSize != decodedSize, corruption_detected,
 1128|       |                        "Frame header size does not match decoded size!");
 1129|       |                }
 1130|       |            }
 1131|       |
 1132|       |            assert(decodedSize <= dstCapacity);
 1133|       |            dst = (BYTE*)dst + decodedSize;
 1134|       |            dstCapacity -= decodedSize;
 1135|       |
 1136|       |            src = (const BYTE*)src + frameSize;
 1137|       |            srcSize -= frameSize;
 1138|       |
 1139|       |            continue;
 1140|       |        }
 1141|       |#endif
 1142|       |
 1143|  5.16k|        if (dctx->format == ZSTD_f_zstd1 && srcSize >= 4) {
  ------------------
  |  Branch (1143:13): [True: 5.16k, False: 0]
  |  Branch (1143:45): [True: 5.16k, False: 0]
  ------------------
 1144|  5.16k|            U32 const magicNumber = MEM_readLE32(src);
 1145|  5.16k|            DEBUGLOG(5, "reading magic number %08X", (unsigned)magicNumber);
  ------------------
  |  |  104|  5.16k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 5.16k]
  |  |  ------------------
  ------------------
 1146|  5.16k|            if ((magicNumber & ZSTD_MAGIC_SKIPPABLE_MASK) == ZSTD_MAGIC_SKIPPABLE_START) {
  ------------------
  |  |  145|  5.16k|#define ZSTD_MAGIC_SKIPPABLE_MASK   0xFFFFFFF0
  ------------------
                          if ((magicNumber & ZSTD_MAGIC_SKIPPABLE_MASK) == ZSTD_MAGIC_SKIPPABLE_START) {
  ------------------
  |  |  144|  5.16k|#define ZSTD_MAGIC_SKIPPABLE_START  0x184D2A50    /* all 16 values, from 0x184D2A50 to 0x184D2A5F, signal the beginning of a skippable frame */
  ------------------
  |  Branch (1146:17): [True: 19, False: 5.14k]
  ------------------
 1147|       |                /* skippable frame detected : skip it */
 1148|     19|                size_t const skippableSize = readSkippableFrameSize(src, srcSize);
 1149|     19|                FORWARD_IF_ERROR(skippableSize, "invalid skippable frame");
  ------------------
  |  |  146|     19|    do {                                                                           \
  |  |  147|     19|        size_t const err_code = (err);                                             \
  |  |  148|     19|        if (ERR_isError(err_code)) {                                               \
  |  |  ------------------
  |  |  |  Branch (148:13): [True: 17, False: 2]
  |  |  ------------------
  |  |  149|     17|            RAWLOG(3, "%s:%d: ERROR!: forwarding error in %s: %s",                 \
  |  |  ------------------
  |  |  |  |  103|     17|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 17]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  150|     17|                  __FILE__, __LINE__, ERR_QUOTE(err), ERR_getErrorName(err_code)); \
  |  |  151|     17|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                                 \
  |  |  ------------------
  |  |  |  |   98|     17|    do {                                           \
  |  |  |  |   99|     17|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 17]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|     17|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 17]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  152|     17|            RAWLOG(3, ": " __VA_ARGS__);                                           \
  |  |  ------------------
  |  |  |  |  103|     17|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 17]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  153|     17|            RAWLOG(3, "\n");                                                       \
  |  |  ------------------
  |  |  |  |  103|     17|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 17]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  154|     17|            return err_code;                                                       \
  |  |  155|     17|        }                                                                          \
  |  |  156|     19|    } while(0)
  |  |  ------------------
  |  |  |  Branch (156:13): [Folded, False: 2]
  |  |  ------------------
  ------------------
 1150|      2|                assert(skippableSize <= srcSize);
  ------------------
  |  |   70|      2|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1151|       |
 1152|      2|                src = (const BYTE *)src + skippableSize;
 1153|      2|                srcSize -= skippableSize;
 1154|      2|                continue; /* check next frame */
 1155|     19|        }   }
 1156|       |
 1157|  5.14k|        if (useDDictSet) {
  ------------------
  |  Branch (1157:13): [True: 0, False: 5.14k]
  ------------------
 1158|      0|            ZSTD_FrameHeader zfh;
 1159|      0|            size_t const hSize = ZSTD_getFrameHeader_advanced(&zfh, src, srcSize, dctx->format);
 1160|       |            /* Invalid/incomplete headers must not change dictionary selection.
 1161|       |             * ZSTD_decompressFrame() will report the header error. */
 1162|      0|            if (hSize == 0 && zfh.frameType == ZSTD_frame)
  ------------------
  |  Branch (1162:17): [True: 0, False: 0]
  |  Branch (1162:31): [True: 0, False: 0]
  ------------------
 1163|      0|                FORWARD_IF_ERROR(ZSTD_DCtx_getFrameDDict(dctx, zfh.dictID, &frameDDict), "");
  ------------------
  |  |  146|      0|    do {                                                                           \
  |  |  147|      0|        size_t const err_code = (err);                                             \
  |  |  148|      0|        if (ERR_isError(err_code)) {                                               \
  |  |  ------------------
  |  |  |  Branch (148:13): [True: 0, False: 0]
  |  |  ------------------
  |  |  149|      0|            RAWLOG(3, "%s:%d: ERROR!: forwarding error in %s: %s",                 \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  150|      0|                  __FILE__, __LINE__, ERR_QUOTE(err), ERR_getErrorName(err_code)); \
  |  |  151|      0|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                                 \
  |  |  ------------------
  |  |  |  |   98|      0|    do {                                           \
  |  |  |  |   99|      0|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  152|      0|            RAWLOG(3, ": " __VA_ARGS__);                                           \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  153|      0|            RAWLOG(3, "\n");                                                       \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  154|      0|            return err_code;                                                       \
  |  |  155|      0|        }                                                                          \
  |  |  156|      0|    } while(0)
  |  |  ------------------
  |  |  |  Branch (156:13): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1164|      0|        }
 1165|  5.14k|        if (frameDDict) {
  ------------------
  |  Branch (1165:13): [True: 0, False: 5.14k]
  ------------------
 1166|       |            /* Use either the explicit DDict or the one selected from the set. */
 1167|      0|            FORWARD_IF_ERROR(ZSTD_decompressBegin_usingDDict(dctx, frameDDict), "");
  ------------------
  |  |  146|      0|    do {                                                                           \
  |  |  147|      0|        size_t const err_code = (err);                                             \
  |  |  148|      0|        if (ERR_isError(err_code)) {                                               \
  |  |  ------------------
  |  |  |  Branch (148:13): [True: 0, False: 0]
  |  |  ------------------
  |  |  149|      0|            RAWLOG(3, "%s:%d: ERROR!: forwarding error in %s: %s",                 \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  150|      0|                  __FILE__, __LINE__, ERR_QUOTE(err), ERR_getErrorName(err_code)); \
  |  |  151|      0|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                                 \
  |  |  ------------------
  |  |  |  |   98|      0|    do {                                           \
  |  |  |  |   99|      0|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  152|      0|            RAWLOG(3, ": " __VA_ARGS__);                                           \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  153|      0|            RAWLOG(3, "\n");                                                       \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  154|      0|            return err_code;                                                       \
  |  |  155|      0|        }                                                                          \
  |  |  156|      0|    } while(0)
  |  |  ------------------
  |  |  |  Branch (156:13): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1168|  5.14k|        } else {
 1169|       |            /* this will initialize correctly with no dict if dict == NULL, so
 1170|       |             * use this in all cases but ddict */
 1171|  5.14k|            FORWARD_IF_ERROR(ZSTD_decompressBegin_usingDict(dctx, dict, dictSize), "");
  ------------------
  |  |  146|  5.14k|    do {                                                                           \
  |  |  147|  5.14k|        size_t const err_code = (err);                                             \
  |  |  148|  5.14k|        if (ERR_isError(err_code)) {                                               \
  |  |  ------------------
  |  |  |  Branch (148:13): [True: 0, False: 5.14k]
  |  |  ------------------
  |  |  149|      0|            RAWLOG(3, "%s:%d: ERROR!: forwarding error in %s: %s",                 \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  150|      0|                  __FILE__, __LINE__, ERR_QUOTE(err), ERR_getErrorName(err_code)); \
  |  |  151|      0|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                                 \
  |  |  ------------------
  |  |  |  |   98|      0|    do {                                           \
  |  |  |  |   99|      0|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  152|      0|            RAWLOG(3, ": " __VA_ARGS__);                                           \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  153|      0|            RAWLOG(3, "\n");                                                       \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  154|      0|            return err_code;                                                       \
  |  |  155|      0|        }                                                                          \
  |  |  156|  5.14k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (156:13): [Folded, False: 5.14k]
  |  |  ------------------
  ------------------
 1172|  5.14k|        }
 1173|  5.14k|        ZSTD_checkContinuity(dctx, dst, dstCapacity);
 1174|       |
 1175|  5.14k|        {   const size_t res = ZSTD_decompressFrame(dctx, dst, dstCapacity,
 1176|  5.14k|                                                    &src, &srcSize);
 1177|  5.14k|            RETURN_ERROR_IF(
  ------------------
  |  |  114|  5.14k|    do {                                                                       \
  |  |  115|  10.3k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 46, False: 5.10k]
  |  |  |  Branch (115:13): [True: 0, False: 46]
  |  |  ------------------
  |  |  116|      0|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|      0|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|      0|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|      0|    do {                                           \
  |  |  |  |   99|      0|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|      0|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|      0|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|      0|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|      0|        }                                                                      \
  |  |  123|  5.14k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 5.14k]
  |  |  ------------------
  ------------------
 1178|  5.14k|                (ZSTD_getErrorCode(res) == ZSTD_error_prefix_unknown)
 1179|  5.14k|             && (moreThan1Frame==1),
 1180|  5.14k|                srcSize_wrong,
 1181|  5.14k|                "At least one frame successfully completed, "
 1182|  5.14k|                "but following bytes are garbage: "
 1183|  5.14k|                "it's more likely to be a srcSize error, "
 1184|  5.14k|                "specifying more input bytes than size of frame(s). "
 1185|  5.14k|                "Note: one could be unlucky, it might be a corruption error instead, "
 1186|  5.14k|                "happening right at the place where we expect zstd magic bytes. "
 1187|  5.14k|                "But this is _much_ less likely than a srcSize field error.");
 1188|  5.14k|            if (ZSTD_isError(res)) return res;
  ------------------
  |  |   44|  5.14k|#define ZSTD_isError ERR_isError   /* for inlining */
  ------------------
  |  Branch (1188:17): [True: 359, False: 4.78k]
  ------------------
 1189|  4.78k|            assert(res <= dstCapacity);
  ------------------
  |  |   70|  4.78k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1190|  4.78k|            if (res != 0)
  ------------------
  |  Branch (1190:17): [True: 4.78k, False: 0]
  ------------------
 1191|  4.78k|                dst = (BYTE*)dst + res;
 1192|  4.78k|            dstCapacity -= res;
 1193|  4.78k|        }
 1194|      0|        moreThan1Frame = 1;
 1195|  4.78k|    }  /* while (srcSize >= ZSTD_frameHeaderSize_prefix) */
 1196|       |
 1197|  4.77k|    RETURN_ERROR_IF(srcSize, srcSize_wrong, "input not entirely consumed");
  ------------------
  |  |  114|  4.77k|    do {                                                                       \
  |  |  115|  4.77k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 3, False: 4.77k]
  |  |  ------------------
  |  |  116|      3|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|      3|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|      3|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|      3|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|      3|    do {                                           \
  |  |  |  |   99|      3|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 3]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      3|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|      3|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|      3|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|      3|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|      3|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|      3|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|      3|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|      3|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      3|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|      3|        }                                                                      \
  |  |  123|  4.77k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 4.77k]
  |  |  ------------------
  ------------------
 1198|       |
 1199|  4.77k|    return (size_t)((BYTE*)dst - (BYTE*)dststart);
 1200|  4.77k|}
zstd_decompress.c:ZSTD_decompressFrame:
  972|  5.14k|{
  973|  5.14k|    const BYTE* const istart = (const BYTE*)(*srcPtr);
  974|  5.14k|    const BYTE* ip = istart;
  975|  5.14k|    BYTE* const ostart = (BYTE*)dst;
  976|  5.14k|    BYTE* const oend = dstCapacity != 0 ? ostart + dstCapacity : ostart;
  ------------------
  |  Branch (976:24): [True: 5.14k, False: 1]
  ------------------
  977|  5.14k|    BYTE* op = ostart;
  978|  5.14k|    size_t remainingSrcSize = *srcSizePtr;
  979|       |
  980|  5.14k|    DEBUGLOG(4, "ZSTD_decompressFrame (srcSize:%i)", (int)*srcSizePtr);
  ------------------
  |  |  104|  5.14k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 5.14k]
  |  |  ------------------
  ------------------
  981|       |
  982|       |    /* check */
  983|  5.14k|    RETURN_ERROR_IF(
  ------------------
  |  |  114|  5.14k|    do {                                                                       \
  |  |  115|  15.4k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 5.14k, False: 0]
  |  |  |  Branch (115:13): [True: 14, False: 5.13k]
  |  |  ------------------
  |  |  116|     14|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|     14|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 14]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|     14|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|     14|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|     14|    do {                                           \
  |  |  |  |   99|     14|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 14]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|     14|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 14]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|     14|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|     14|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 14]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|     14|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|     14|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 14]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|     14|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|     14|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|     14|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|     14|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|     14|        }                                                                      \
  |  |  123|  5.14k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 5.13k]
  |  |  ------------------
  ------------------
  984|  5.14k|        remainingSrcSize < ZSTD_FRAMEHEADERSIZE_MIN(dctx->format)+ZSTD_blockHeaderSize,
  985|  5.14k|        srcSize_wrong, "");
  986|       |
  987|       |    /* Frame Header */
  988|  5.13k|    {   size_t const frameHeaderSize = ZSTD_frameHeaderSize_internal(
  989|  5.13k|                ip, ZSTD_FRAMEHEADERSIZE_PREFIX(dctx->format), dctx->format);
  ------------------
  |  | 1357|  5.13k|#define ZSTD_FRAMEHEADERSIZE_PREFIX(format) ((format) == ZSTD_f_zstd1 ? 5 : 1)   /* minimum input size required to query frame header size */
  |  |  ------------------
  |  |  |  Branch (1357:46): [True: 5.13k, False: 0]
  |  |  ------------------
  ------------------
  990|  5.13k|        if (ZSTD_isError(frameHeaderSize)) return frameHeaderSize;
  ------------------
  |  |   44|  5.13k|#define ZSTD_isError ERR_isError   /* for inlining */
  ------------------
  |  Branch (990:13): [True: 0, False: 5.13k]
  ------------------
  991|  5.13k|        RETURN_ERROR_IF(remainingSrcSize < frameHeaderSize+ZSTD_blockHeaderSize,
  ------------------
  |  |  114|  5.13k|    do {                                                                       \
  |  |  115|  5.13k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 2, False: 5.13k]
  |  |  ------------------
  |  |  116|      2|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|      2|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 2]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|      2|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|      2|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|      2|    do {                                           \
  |  |  |  |   99|      2|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 2]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      2|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 2]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|      2|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|      2|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 2]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|      2|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|      2|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 2]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|      2|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|      2|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|      2|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      2|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|      2|        }                                                                      \
  |  |  123|  5.13k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 5.13k]
  |  |  ------------------
  ------------------
  992|  5.13k|                        srcSize_wrong, "");
  993|  5.13k|        FORWARD_IF_ERROR( ZSTD_decodeFrameHeader(dctx, ip, frameHeaderSize) , "");
  ------------------
  |  |  146|  5.13k|    do {                                                                           \
  |  |  147|  5.13k|        size_t const err_code = (err);                                             \
  |  |  148|  5.13k|        if (ERR_isError(err_code)) {                                               \
  |  |  ------------------
  |  |  |  Branch (148:13): [True: 47, False: 5.08k]
  |  |  ------------------
  |  |  149|     47|            RAWLOG(3, "%s:%d: ERROR!: forwarding error in %s: %s",                 \
  |  |  ------------------
  |  |  |  |  103|     47|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 47]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  150|     47|                  __FILE__, __LINE__, ERR_QUOTE(err), ERR_getErrorName(err_code)); \
  |  |  151|     47|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                                 \
  |  |  ------------------
  |  |  |  |   98|     47|    do {                                           \
  |  |  |  |   99|     47|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 47]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|     47|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 47]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  152|     47|            RAWLOG(3, ": " __VA_ARGS__);                                           \
  |  |  ------------------
  |  |  |  |  103|     47|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 47]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  153|     47|            RAWLOG(3, "\n");                                                       \
  |  |  ------------------
  |  |  |  |  103|     47|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 47]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  154|     47|            return err_code;                                                       \
  |  |  155|     47|        }                                                                          \
  |  |  156|  5.13k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (156:13): [Folded, False: 5.08k]
  |  |  ------------------
  ------------------
  994|  5.08k|        ip += frameHeaderSize; remainingSrcSize -= frameHeaderSize;
  995|  5.08k|    }
  996|       |
  997|       |    /* Shrink the blockSizeMax if enabled */
  998|  5.08k|    if (dctx->maxBlockSizeParam != 0)
  ------------------
  |  Branch (998:9): [True: 0, False: 5.08k]
  ------------------
  999|      0|        dctx->fParams.blockSizeMax = MIN(dctx->fParams.blockSizeMax, (unsigned)dctx->maxBlockSizeParam);
  ------------------
  |  |   54|      0|#define MIN(a,b) ((a)<(b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (54:19): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1000|       |
 1001|       |    /* Loop on each block */
 1002|  5.12k|    while (1) {
  ------------------
  |  Branch (1002:12): [True: 5.12k, Folded]
  ------------------
 1003|  5.12k|        BYTE* oBlockEnd = oend;
 1004|  5.12k|        size_t decodedSize;
 1005|  5.12k|        blockProperties_t blockProperties;
 1006|  5.12k|        size_t const cBlockSize = ZSTD_getcBlockSize(ip, remainingSrcSize, &blockProperties);
 1007|  5.12k|        if (ZSTD_isError(cBlockSize)) return cBlockSize;
  ------------------
  |  |   44|  5.12k|#define ZSTD_isError ERR_isError   /* for inlining */
  ------------------
  |  Branch (1007:13): [True: 54, False: 5.06k]
  ------------------
 1008|       |
 1009|  5.06k|        ip += ZSTD_blockHeaderSize;
 1010|  5.06k|        remainingSrcSize -= ZSTD_blockHeaderSize;
 1011|  5.06k|        RETURN_ERROR_IF(cBlockSize > remainingSrcSize, srcSize_wrong, "");
  ------------------
  |  |  114|  5.06k|    do {                                                                       \
  |  |  115|  5.06k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 24, False: 5.04k]
  |  |  ------------------
  |  |  116|     24|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|     24|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 24]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|     24|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|     24|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|     24|    do {                                           \
  |  |  |  |   99|     24|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 24]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|     24|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 24]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|     24|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|     24|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 24]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|     24|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|     24|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 24]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|     24|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|     24|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|     24|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|     24|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|     24|        }                                                                      \
  |  |  123|  5.06k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 5.04k]
  |  |  ------------------
  ------------------
 1012|       |
 1013|  5.04k|        if (ip >= op && ip < oBlockEnd) {
  ------------------
  |  Branch (1013:13): [True: 4.77k, False: 269]
  |  Branch (1013:25): [True: 0, False: 4.77k]
  ------------------
 1014|       |            /* We are decompressing in-place. Limit the output pointer so that we
 1015|       |             * don't overwrite the block that we are currently reading. This will
 1016|       |             * fail decompression if the input & output pointers aren't spaced
 1017|       |             * far enough apart.
 1018|       |             *
 1019|       |             * This is important to set, even when the pointers are far enough
 1020|       |             * apart, because ZSTD_decompressBlock_internal() can decide to store
 1021|       |             * literals in the output buffer, after the block it is decompressing.
 1022|       |             * Since we don't want anything to overwrite our input, we have to tell
 1023|       |             * ZSTD_decompressBlock_internal to never write past ip.
 1024|       |             *
 1025|       |             * See ZSTD_allocateLiteralsBuffer() for reference.
 1026|       |             */
 1027|      0|            oBlockEnd = op + (ip - op);
 1028|      0|        }
 1029|       |
 1030|  5.04k|        switch(blockProperties.blockType)
 1031|  5.04k|        {
 1032|  4.93k|        case bt_compressed:
  ------------------
  |  Branch (1032:9): [True: 4.93k, False: 107]
  ------------------
 1033|  4.93k|            assert(dctx->isFrameDecompression == 1);
  ------------------
  |  |   70|  4.93k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1034|  4.93k|            decodedSize = ZSTD_decompressBlock_internal(dctx, op, (size_t)(oBlockEnd-op), ip, cBlockSize, not_streaming);
 1035|  4.93k|            break;
 1036|     41|        case bt_raw :
  ------------------
  |  Branch (1036:9): [True: 41, False: 5.00k]
  ------------------
 1037|       |            /* Use oend instead of oBlockEnd because this function is safe to overlap. It uses memmove. */
 1038|     41|            decodedSize = ZSTD_copyRawBlock(op, (size_t)(oend-op), ip, cBlockSize);
 1039|     41|            break;
 1040|     66|        case bt_rle :
  ------------------
  |  Branch (1040:9): [True: 66, False: 4.97k]
  ------------------
 1041|     66|            decodedSize = ZSTD_setRleBlock(op, (size_t)(oBlockEnd-op), *ip, blockProperties.origSize);
 1042|     66|            break;
 1043|      0|        case bt_reserved :
  ------------------
  |  Branch (1043:9): [True: 0, False: 5.04k]
  ------------------
 1044|      0|        default:
  ------------------
  |  Branch (1044:9): [True: 0, False: 5.04k]
  ------------------
 1045|      0|            RETURN_ERROR(corruption_detected, "invalid block type");
  ------------------
  |  |  131|      0|    do {                                                                     \
  |  |  132|      0|        RAWLOG(3, "%s:%d: ERROR!: unconditional check failed, returning %s", \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  133|      0|              __FILE__, __LINE__, ERR_QUOTE(ERROR(err)));                    \
  |  |  134|      0|        _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                               \
  |  |  ------------------
  |  |  |  |   98|      0|    do {                                           \
  |  |  |  |   99|      0|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  135|      0|        RAWLOG(3, ": " __VA_ARGS__);                                         \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  136|      0|        RAWLOG(3, "\n");                                                     \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  137|      0|        return ERROR(err);                                                   \
  |  |  ------------------
  |  |  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  138|      0|    } while(0)
  |  |  ------------------
  |  |  |  Branch (138:13): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1046|  5.04k|        }
 1047|  5.04k|        FORWARD_IF_ERROR(decodedSize, "Block decompression failure");
  ------------------
  |  |  146|  5.04k|    do {                                                                           \
  |  |  147|  5.04k|        size_t const err_code = (err);                                             \
  |  |  148|  5.04k|        if (ERR_isError(err_code)) {                                               \
  |  |  ------------------
  |  |  |  Branch (148:13): [True: 155, False: 4.88k]
  |  |  ------------------
  |  |  149|    155|            RAWLOG(3, "%s:%d: ERROR!: forwarding error in %s: %s",                 \
  |  |  ------------------
  |  |  |  |  103|    155|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 155]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  150|    155|                  __FILE__, __LINE__, ERR_QUOTE(err), ERR_getErrorName(err_code)); \
  |  |  151|    155|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                                 \
  |  |  ------------------
  |  |  |  |   98|    155|    do {                                           \
  |  |  |  |   99|    155|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 155]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|    155|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 155]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  152|    155|            RAWLOG(3, ": " __VA_ARGS__);                                           \
  |  |  ------------------
  |  |  |  |  103|    155|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 155]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  153|    155|            RAWLOG(3, "\n");                                                       \
  |  |  ------------------
  |  |  |  |  103|    155|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 155]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  154|    155|            return err_code;                                                       \
  |  |  155|    155|        }                                                                          \
  |  |  156|  5.04k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (156:13): [Folded, False: 4.88k]
  |  |  ------------------
  ------------------
 1048|  4.88k|        RETURN_ERROR_IF(decodedSize > dctx->fParams.blockSizeMax, corruption_detected, "Decompressed Block Size Exceeds Maximum");
  ------------------
  |  |  114|  4.88k|    do {                                                                       \
  |  |  115|  4.88k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 20, False: 4.86k]
  |  |  ------------------
  |  |  116|     20|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|     20|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 20]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|     20|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|     20|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|     20|    do {                                           \
  |  |  |  |   99|     20|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 20]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|     20|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 20]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|     20|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|     20|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 20]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|     20|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|     20|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 20]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|     20|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|     20|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|     20|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|     20|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|     20|        }                                                                      \
  |  |  123|  4.88k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 4.86k]
  |  |  ------------------
  ------------------
 1049|  4.86k|        DEBUGLOG(5, "Decompressed block of dSize = %u", (unsigned)decodedSize);
  ------------------
  |  |  104|  4.86k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 4.86k]
  |  |  ------------------
  ------------------
 1050|  4.86k|        if (dctx->validateChecksum) {
  ------------------
  |  Branch (1050:13): [True: 56, False: 4.81k]
  ------------------
 1051|     56|            XXH64_update(&dctx->xxhState, op, decodedSize);
  ------------------
  |  |  460|     56|#  define XXH64_update XXH_NAME2(XXH_NAMESPACE, XXH64_update)
  |  |  ------------------
  |  |  |  |  443|     56|#  define XXH_NAME2(A,B) XXH_CAT(A,B)
  |  |  |  |  ------------------
  |  |  |  |  |  |  442|     56|#  define XXH_CAT(A,B) A##B
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1052|     56|        }
 1053|  4.86k|        if (decodedSize) /* support dst = NULL,0 */ {
  ------------------
  |  Branch (1053:13): [True: 4.84k, False: 24]
  ------------------
 1054|  4.84k|            op += decodedSize;
 1055|  4.84k|        }
 1056|  4.86k|        assert(ip != NULL);
  ------------------
  |  |   70|  4.86k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1057|  4.86k|        ip += cBlockSize;
 1058|  4.86k|        remainingSrcSize -= cBlockSize;
 1059|  4.86k|        if (blockProperties.lastBlock) break;
  ------------------
  |  Branch (1059:13): [True: 4.83k, False: 36]
  ------------------
 1060|  4.86k|    }
 1061|       |
 1062|  4.83k|    if (dctx->fParams.frameContentSize != ZSTD_CONTENTSIZE_UNKNOWN) {
  ------------------
  |  |  203|  4.83k|#define ZSTD_CONTENTSIZE_UNKNOWN (0ULL - 1)
  ------------------
  |  Branch (1062:9): [True: 4.79k, False: 33]
  ------------------
 1063|  4.79k|        RETURN_ERROR_IF((U64)(op-ostart) != dctx->fParams.frameContentSize,
  ------------------
  |  |  114|  4.79k|    do {                                                                       \
  |  |  115|  4.79k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 24, False: 4.77k]
  |  |  ------------------
  |  |  116|     24|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|     24|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 24]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|     24|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|     24|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|     24|    do {                                           \
  |  |  |  |   99|     24|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 24]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|     24|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 24]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|     24|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|     24|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 24]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|     24|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|     24|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 24]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|     24|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|     24|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|     24|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|     24|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|     24|        }                                                                      \
  |  |  123|  4.79k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 4.77k]
  |  |  ------------------
  ------------------
 1064|  4.79k|                        corruption_detected, "");
 1065|  4.79k|    }
 1066|  4.80k|    if (dctx->fParams.checksumFlag) { /* Frame content checksum verification */
  ------------------
  |  Branch (1066:9): [True: 19, False: 4.78k]
  ------------------
 1067|     19|        RETURN_ERROR_IF(remainingSrcSize<4, checksum_wrong, "");
  ------------------
  |  |  114|     19|    do {                                                                       \
  |  |  115|     19|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 4, False: 15]
  |  |  ------------------
  |  |  116|      4|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|      4|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|      4|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|      4|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|      4|    do {                                           \
  |  |  |  |   99|      4|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 4]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      4|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|      4|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|      4|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|      4|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|      4|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|      4|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|      4|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|      4|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      4|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|      4|        }                                                                      \
  |  |  123|     19|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 15]
  |  |  ------------------
  ------------------
 1068|     15|        if (!dctx->forceIgnoreChecksum) {
  ------------------
  |  Branch (1068:13): [True: 15, False: 0]
  ------------------
 1069|     15|            U32 const checkCalc = (U32)XXH64_digest(&dctx->xxhState);
  ------------------
  |  |  461|     15|#  define XXH64_digest XXH_NAME2(XXH_NAMESPACE, XXH64_digest)
  |  |  ------------------
  |  |  |  |  443|     15|#  define XXH_NAME2(A,B) XXH_CAT(A,B)
  |  |  |  |  ------------------
  |  |  |  |  |  |  442|     15|#  define XXH_CAT(A,B) A##B
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1070|     15|            U32 checkRead;
 1071|     15|            checkRead = MEM_readLE32(ip);
 1072|     15|            RETURN_ERROR_IF(checkRead != checkCalc, checksum_wrong, "");
  ------------------
  |  |  114|     15|    do {                                                                       \
  |  |  115|     15|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 15, False: 0]
  |  |  ------------------
  |  |  116|     15|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|     15|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 15]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|     15|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|     15|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|     15|    do {                                           \
  |  |  |  |   99|     15|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 15]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|     15|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 15]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|     15|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|     15|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 15]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|     15|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|     15|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 15]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|     15|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|     15|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|     15|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|     15|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|     15|        }                                                                      \
  |  |  123|     15|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1073|     15|        }
 1074|      0|        ip += 4;
 1075|      0|        remainingSrcSize -= 4;
 1076|      0|    }
 1077|  4.78k|    ZSTD_DCtx_trace_end(dctx, (U64)(op-ostart), (U64)(ip-istart), /* streaming */ 0);
 1078|       |    /* Allow caller to get size read */
 1079|  4.78k|    DEBUGLOG(4, "ZSTD_decompressFrame: decompressed frame of size %i, consuming %i bytes of input", (int)(op-ostart), (int)(ip - (const BYTE*)*srcPtr));
  ------------------
  |  |  104|  4.78k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 4.78k]
  |  |  ------------------
  ------------------
 1080|  4.78k|    *srcPtr = ip;
 1081|  4.78k|    *srcSizePtr = remainingSrcSize;
 1082|  4.78k|    return (size_t)(op-ostart);
 1083|  4.80k|}
zstd_decompress.c:ZSTD_getDDict:
 1213|  5.15k|{
 1214|  5.15k|    assert(dctx->ddictSet == NULL);
  ------------------
  |  |   70|  5.15k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1215|  5.15k|    switch (dctx->dictUses) {
 1216|      0|    default:
  ------------------
  |  Branch (1216:5): [True: 0, False: 5.15k]
  ------------------
 1217|      0|        assert(0 /* Impossible */);
  ------------------
  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1218|      0|        ZSTD_FALLTHROUGH;
  ------------------
  |  |  288|      0|#  define ZSTD_FALLTHROUGH ; __attribute__((__fallthrough__))
  ------------------
 1219|  5.15k|    case ZSTD_dont_use:
  ------------------
  |  Branch (1219:5): [True: 5.15k, False: 0]
  ------------------
 1220|  5.15k|        ZSTD_clearDict(dctx);
 1221|  5.15k|        return NULL;
 1222|      0|    case ZSTD_use_indefinitely:
  ------------------
  |  Branch (1222:5): [True: 0, False: 5.15k]
  ------------------
 1223|      0|        return dctx->ddict;
 1224|      0|    case ZSTD_use_once:
  ------------------
  |  Branch (1224:5): [True: 0, False: 5.15k]
  ------------------
 1225|      0|        dctx->dictUses = ZSTD_dont_use;
 1226|      0|        return dctx->ddict;
 1227|  5.15k|    }
 1228|  5.15k|}
zstd_decompress.c:ZSTD_decodeFrameHeader:
  718|  5.13k|{
  719|  5.13k|    size_t const result = ZSTD_getFrameHeader_advanced(&(dctx->fParams), src, headerSize, dctx->format);
  720|  5.13k|    if (ZSTD_isError(result)) return result;    /* invalid header */
  ------------------
  |  |   44|  5.13k|#define ZSTD_isError ERR_isError   /* for inlining */
  ------------------
  |  Branch (720:9): [True: 47, False: 5.08k]
  ------------------
  721|  5.08k|    RETURN_ERROR_IF(result>0, srcSize_wrong, "headerSize too small");
  ------------------
  |  |  114|  5.08k|    do {                                                                       \
  |  |  115|  5.08k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 0, False: 5.08k]
  |  |  ------------------
  |  |  116|      0|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|      0|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|      0|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|      0|    do {                                           \
  |  |  |  |   99|      0|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|      0|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|      0|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|      0|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|      0|        }                                                                      \
  |  |  123|  5.08k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 5.08k]
  |  |  ------------------
  ------------------
  722|       |
  723|       |#ifndef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
  724|       |    /* Skip the dictID check in fuzzing mode, because it makes the search
  725|       |     * harder.
  726|       |     */
  727|       |    RETURN_ERROR_IF(dctx->fParams.dictID && (dctx->dictID != dctx->fParams.dictID),
  728|       |                    dictionary_wrong, "");
  729|       |#endif
  730|  5.08k|    dctx->validateChecksum = (dctx->fParams.checksumFlag && !dctx->forceIgnoreChecksum) ? 1 : 0;
  ------------------
  |  Branch (730:31): [True: 172, False: 4.91k]
  |  Branch (730:61): [True: 172, False: 0]
  ------------------
  731|  5.08k|    if (dctx->validateChecksum) XXH64_reset(&dctx->xxhState, 0);
  ------------------
  |  |  459|    172|#  define XXH64_reset XXH_NAME2(XXH_NAMESPACE, XXH64_reset)
  |  |  ------------------
  |  |  |  |  443|    172|#  define XXH_NAME2(A,B) XXH_CAT(A,B)
  |  |  |  |  ------------------
  |  |  |  |  |  |  442|    172|#  define XXH_CAT(A,B) A##B
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (731:9): [True: 172, False: 4.91k]
  ------------------
  732|  5.08k|    return 0;
  733|  5.08k|}
zstd_decompress.c:ZSTD_DCtx_trace_end:
  939|  4.78k|{
  940|  4.78k|#if ZSTD_TRACE
  941|  4.78k|    if (dctx->traceCtx && ZSTD_trace_decompress_end != NULL) {
  ------------------
  |  Branch (941:9): [True: 0, False: 4.78k]
  |  Branch (941:27): [True: 0, False: 0]
  ------------------
  942|      0|        ZSTD_Trace trace;
  943|      0|        ZSTD_memset(&trace, 0, sizeof(trace));
  ------------------
  |  |   46|      0|# define ZSTD_memset(p,v,l) __builtin_memset((p),(v),(l))
  ------------------
  944|      0|        trace.version = ZSTD_VERSION_NUMBER;
  ------------------
  |  |  115|      0|#define ZSTD_VERSION_NUMBER  (ZSTD_VERSION_MAJOR *100*100 + ZSTD_VERSION_MINOR *100 + ZSTD_VERSION_RELEASE)
  |  |  ------------------
  |  |  |  |  112|      0|#define ZSTD_VERSION_MAJOR    1
  |  |  ------------------
  |  |               #define ZSTD_VERSION_NUMBER  (ZSTD_VERSION_MAJOR *100*100 + ZSTD_VERSION_MINOR *100 + ZSTD_VERSION_RELEASE)
  |  |  ------------------
  |  |  |  |  113|      0|#define ZSTD_VERSION_MINOR    6
  |  |  ------------------
  |  |               #define ZSTD_VERSION_NUMBER  (ZSTD_VERSION_MAJOR *100*100 + ZSTD_VERSION_MINOR *100 + ZSTD_VERSION_RELEASE)
  |  |  ------------------
  |  |  |  |  114|      0|#define ZSTD_VERSION_RELEASE  0
  |  |  ------------------
  ------------------
  945|      0|        trace.streaming = streaming;
  946|      0|        if (dctx->traceDictSize != 0) {
  ------------------
  |  Branch (946:13): [True: 0, False: 0]
  ------------------
  947|      0|            trace.dictionaryID = dctx->dictID;
  948|      0|            trace.dictionarySize = dctx->traceDictSize;
  949|      0|            trace.dictionaryIsCold = dctx->ddictIsCold;
  950|      0|        }
  951|      0|        trace.uncompressedSize = (size_t)uncompressedSize;
  952|      0|        trace.compressedSize = (size_t)compressedSize;
  953|      0|        trace.dctx = dctx;
  954|      0|        ZSTD_trace_decompress_end(dctx->traceCtx, &trace);
  955|      0|    }
  956|       |#else
  957|       |    (void)dctx;
  958|       |    (void)uncompressedSize;
  959|       |    (void)compressedSize;
  960|       |    (void)streaming;
  961|       |#endif
  962|  4.78k|}
zstd_decompress.c:ZSTD_copyRawBlock:
  914|     41|{
  915|     41|    DEBUGLOG(5, "ZSTD_copyRawBlock");
  ------------------
  |  |  104|     41|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 41]
  |  |  ------------------
  ------------------
  916|     41|    RETURN_ERROR_IF(srcSize > dstCapacity, dstSize_tooSmall, "");
  ------------------
  |  |  114|     41|    do {                                                                       \
  |  |  115|     41|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 0, False: 41]
  |  |  ------------------
  |  |  116|      0|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|      0|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|      0|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|      0|    do {                                           \
  |  |  |  |   99|      0|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|      0|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|      0|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|      0|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|      0|        }                                                                      \
  |  |  123|     41|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 41]
  |  |  ------------------
  ------------------
  917|     41|    if (dst == NULL) {
  ------------------
  |  Branch (917:9): [True: 0, False: 41]
  ------------------
  918|      0|        if (srcSize == 0) return 0;
  ------------------
  |  Branch (918:13): [True: 0, False: 0]
  ------------------
  919|      0|        RETURN_ERROR(dstBuffer_null, "");
  ------------------
  |  |  131|      0|    do {                                                                     \
  |  |  132|      0|        RAWLOG(3, "%s:%d: ERROR!: unconditional check failed, returning %s", \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  133|      0|              __FILE__, __LINE__, ERR_QUOTE(ERROR(err)));                    \
  |  |  134|      0|        _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                               \
  |  |  ------------------
  |  |  |  |   98|      0|    do {                                           \
  |  |  |  |   99|      0|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  135|      0|        RAWLOG(3, ": " __VA_ARGS__);                                         \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  136|      0|        RAWLOG(3, "\n");                                                     \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  137|      0|        return ERROR(err);                                                   \
  |  |  ------------------
  |  |  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  138|      0|    } while(0)
  |  |  ------------------
  |  |  |  Branch (138:13): [Folded, False: 0]
  |  |  ------------------
  ------------------
  920|      0|    }
  921|     41|    ZSTD_memmove(dst, src, srcSize);
  ------------------
  |  |   45|     41|# define ZSTD_memmove(d,s,l) __builtin_memmove((d),(s),(l))
  ------------------
  922|     41|    return srcSize;
  923|     41|}
zstd_decompress.c:ZSTD_setRleBlock:
  928|     66|{
  929|     66|    RETURN_ERROR_IF(regenSize > dstCapacity, dstSize_tooSmall, "");
  ------------------
  |  |  114|     66|    do {                                                                       \
  |  |  115|     66|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 2, False: 64]
  |  |  ------------------
  |  |  116|      2|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|      2|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 2]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|      2|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|      2|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|      2|    do {                                           \
  |  |  |  |   99|      2|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 2]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      2|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 2]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|      2|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|      2|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 2]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|      2|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|      2|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 2]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|      2|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|      2|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|      2|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      2|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|      2|        }                                                                      \
  |  |  123|     66|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 64]
  |  |  ------------------
  ------------------
  930|     64|    if (dst == NULL) {
  ------------------
  |  Branch (930:9): [True: 0, False: 64]
  ------------------
  931|      0|        if (regenSize == 0) return 0;
  ------------------
  |  Branch (931:13): [True: 0, False: 0]
  ------------------
  932|      0|        RETURN_ERROR(dstBuffer_null, "");
  ------------------
  |  |  131|      0|    do {                                                                     \
  |  |  132|      0|        RAWLOG(3, "%s:%d: ERROR!: unconditional check failed, returning %s", \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  133|      0|              __FILE__, __LINE__, ERR_QUOTE(ERROR(err)));                    \
  |  |  134|      0|        _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                               \
  |  |  ------------------
  |  |  |  |   98|      0|    do {                                           \
  |  |  |  |   99|      0|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  135|      0|        RAWLOG(3, ": " __VA_ARGS__);                                         \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  136|      0|        RAWLOG(3, "\n");                                                     \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  137|      0|        return ERROR(err);                                                   \
  |  |  ------------------
  |  |  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  138|      0|    } while(0)
  |  |  ------------------
  |  |  |  Branch (138:13): [Folded, False: 0]
  |  |  ------------------
  ------------------
  933|      0|    }
  934|     64|    ZSTD_memset(dst, b, regenSize);
  ------------------
  |  |   46|     64|# define ZSTD_memset(p,v,l) __builtin_memset((p),(v),(l))
  ------------------
  935|     64|    return regenSize;
  936|     64|}
zstd_decompress.c:ZSTD_DCtx_resetParameters:
  237|    404|{
  238|    404|    assert(dctx->streamStage == zdss_init);
  ------------------
  |  |   70|    404|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  239|    404|    dctx->format = ZSTD_f_zstd1;
  240|    404|    dctx->maxWindowSize = ZSTD_MAXWINDOWSIZE_DEFAULT;
  ------------------
  |  |   40|    404|#  define ZSTD_MAXWINDOWSIZE_DEFAULT (((U32)1 << ZSTD_WINDOWLOG_LIMIT_DEFAULT) + 1)
  |  |  ------------------
  |  |  |  | 1387|    404|#define ZSTD_WINDOWLOG_LIMIT_DEFAULT 27   /* by default, the streaming decoder will refuse any frame
  |  |  ------------------
  ------------------
  241|    404|    dctx->outBufferMode = ZSTD_bm_buffered;
  242|    404|    dctx->forceIgnoreChecksum = ZSTD_d_validateChecksum;
  243|    404|    dctx->refMultipleDDicts = ZSTD_rmd_refSingleDDict;
  244|    404|    dctx->disableHufAsm = 0;
  245|    404|    dctx->maxBlockSizeParam = 0;
  246|    404|}

ZSTD_getcBlockSize:
   65|  5.12k|{
   66|  5.12k|    RETURN_ERROR_IF(srcSize < ZSTD_blockHeaderSize, srcSize_wrong, "");
  ------------------
  |  |  114|  5.12k|    do {                                                                       \
  |  |  115|  5.12k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 7, False: 5.11k]
  |  |  ------------------
  |  |  116|      7|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|      7|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 7]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|      7|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|      7|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|      7|    do {                                           \
  |  |  |  |   99|      7|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 7]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      7|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 7]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|      7|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|      7|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 7]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|      7|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|      7|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 7]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|      7|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|      7|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|      7|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      7|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|      7|        }                                                                      \
  |  |  123|  5.12k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 5.11k]
  |  |  ------------------
  ------------------
   67|       |
   68|  5.11k|    {   U32 const cBlockHeader = MEM_readLE24(src);
   69|  5.11k|        U32 const cSize = cBlockHeader >> 3;
   70|  5.11k|        bpPtr->lastBlock = cBlockHeader & 1;
   71|  5.11k|        bpPtr->blockType = (blockType_e)((cBlockHeader >> 1) & 3);
   72|  5.11k|        bpPtr->origSize = cSize;   /* only useful for RLE */
   73|  5.11k|        if (bpPtr->blockType == bt_rle) return 1;
  ------------------
  |  Branch (73:13): [True: 66, False: 5.04k]
  ------------------
   74|  5.04k|        RETURN_ERROR_IF(bpPtr->blockType == bt_reserved, corruption_detected, "");
  ------------------
  |  |  114|  5.04k|    do {                                                                       \
  |  |  115|  5.04k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 47, False: 5.00k]
  |  |  ------------------
  |  |  116|     47|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|     47|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 47]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|     47|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|     47|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|     47|    do {                                           \
  |  |  |  |   99|     47|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 47]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|     47|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 47]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|     47|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|     47|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 47]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|     47|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|     47|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 47]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|     47|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|     47|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|     47|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|     47|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|     47|        }                                                                      \
  |  |  123|  5.04k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 5.00k]
  |  |  ------------------
  ------------------
   75|  5.00k|        return cSize;
   76|  5.04k|    }
   77|  5.04k|}
ZSTD_buildFSETable:
  656|    643|{
  657|    643|    if (ZSTD_USE_BMI2(bmi2)) {
  ------------------
  |  |   36|    643|#  define ZSTD_USE_BMI2(bmi2) (bmi2)
  |  |  ------------------
  |  |  |  Branch (36:31): [True: 643, False: 0]
  |  |  ------------------
  ------------------
  658|    643|        ZSTD_buildFSETable_body_bmi2(dt, normalizedCounter, maxSymbolValue,
  659|    643|                baseValue, nbAdditionalBits, tableLog, wksp, wkspSize);
  660|    643|        return;
  661|    643|    }
  662|      0|    (void)bmi2;
  663|      0|    ZSTD_buildFSETable_body_default(dt, normalizedCounter, maxSymbolValue,
  664|      0|            baseValue, nbAdditionalBits, tableLog, wksp, wkspSize);
  665|      0|}
ZSTD_decodeSeqHeaders:
  721|  4.86k|{
  722|  4.86k|    const BYTE* const istart = (const BYTE*)src;
  723|  4.86k|    const BYTE* const iend = istart + srcSize;
  724|  4.86k|    const BYTE* ip = istart;
  725|  4.86k|    int nbSeq;
  726|  4.86k|    DEBUGLOG(5, "ZSTD_decodeSeqHeaders");
  ------------------
  |  |  104|  4.86k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 4.86k]
  |  |  ------------------
  ------------------
  727|       |
  728|       |    /* check */
  729|  4.86k|    RETURN_ERROR_IF(srcSize < MIN_SEQUENCES_SIZE, srcSize_wrong, "");
  ------------------
  |  |  114|  4.86k|    do {                                                                       \
  |  |  115|  4.86k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 1, False: 4.86k]
  |  |  ------------------
  |  |  116|      1|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|      1|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|      1|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|      1|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|      1|    do {                                           \
  |  |  |  |   99|      1|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 1]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      1|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|      1|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|      1|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|      1|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|      1|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|      1|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|      1|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|      1|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      1|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|      1|        }                                                                      \
  |  |  123|  4.86k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 4.86k]
  |  |  ------------------
  ------------------
  730|       |
  731|       |    /* SeqHead */
  732|  4.86k|    nbSeq = *ip++;
  733|  4.86k|    if (nbSeq > 0x7F) {
  ------------------
  |  Branch (733:9): [True: 15, False: 4.84k]
  ------------------
  734|     15|        if (nbSeq == 0xFF) {
  ------------------
  |  Branch (734:13): [True: 0, False: 15]
  ------------------
  735|      0|            RETURN_ERROR_IF(ip+2 > iend, srcSize_wrong, "");
  ------------------
  |  |  114|      0|    do {                                                                       \
  |  |  115|      0|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 0, False: 0]
  |  |  ------------------
  |  |  116|      0|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|      0|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|      0|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|      0|    do {                                           \
  |  |  |  |   99|      0|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|      0|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|      0|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|      0|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|      0|        }                                                                      \
  |  |  123|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  736|      0|            nbSeq = MEM_readLE16(ip) + LONGNBSEQ;
  ------------------
  |  |   96|      0|#define LONGNBSEQ 0x7F00
  ------------------
  737|      0|            ip+=2;
  738|     15|        } else {
  739|     15|            RETURN_ERROR_IF(ip >= iend, srcSize_wrong, "");
  ------------------
  |  |  114|     15|    do {                                                                       \
  |  |  115|     15|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 2, False: 13]
  |  |  ------------------
  |  |  116|      2|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|      2|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 2]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|      2|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|      2|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|      2|    do {                                           \
  |  |  |  |   99|      2|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 2]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      2|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 2]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|      2|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|      2|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 2]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|      2|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|      2|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 2]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|      2|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|      2|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|      2|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      2|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|      2|        }                                                                      \
  |  |  123|     15|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 13]
  |  |  ------------------
  ------------------
  740|     13|            nbSeq = ((nbSeq-0x80)<<8) + *ip++;
  741|     13|        }
  742|     15|    }
  743|  4.85k|    *nbSeqPtr = nbSeq;
  744|       |
  745|  4.85k|    if (nbSeq == 0) {
  ------------------
  |  Branch (745:9): [True: 982, False: 3.87k]
  ------------------
  746|       |        /* No sequence : section ends immediately */
  747|    982|        RETURN_ERROR_IF(ip != iend, corruption_detected,
  ------------------
  |  |  114|    982|    do {                                                                       \
  |  |  115|    982|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 3, False: 979]
  |  |  ------------------
  |  |  116|      3|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|      3|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|      3|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|      3|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|      3|    do {                                           \
  |  |  |  |   99|      3|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 3]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      3|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|      3|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|      3|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|      3|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|      3|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|      3|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|      3|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|      3|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      3|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|      3|        }                                                                      \
  |  |  123|    982|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 979]
  |  |  ------------------
  ------------------
  748|    982|            "extraneous data present in the Sequences section");
  749|    979|        return (size_t)(ip - istart);
  750|    982|    }
  751|       |
  752|       |    /* FSE table descriptors */
  753|  3.87k|    RETURN_ERROR_IF(ip+1 > iend, srcSize_wrong, ""); /* minimum possible size: 1 byte for symbol encoding types */
  ------------------
  |  |  114|  3.87k|    do {                                                                       \
  |  |  115|  3.87k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 4, False: 3.87k]
  |  |  ------------------
  |  |  116|      4|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|      4|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|      4|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|      4|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|      4|    do {                                           \
  |  |  |  |   99|      4|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 4]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      4|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|      4|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|      4|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|      4|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|      4|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|      4|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|      4|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|      4|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      4|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|      4|        }                                                                      \
  |  |  123|  3.87k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 3.87k]
  |  |  ------------------
  ------------------
  754|  3.87k|    RETURN_ERROR_IF(*ip & 3, corruption_detected, ""); /* The last field, Reserved, must be all-zeroes. */
  ------------------
  |  |  114|  3.87k|    do {                                                                       \
  |  |  115|  3.87k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 6, False: 3.86k]
  |  |  ------------------
  |  |  116|      6|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|      6|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 6]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|      6|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|      6|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|      6|    do {                                           \
  |  |  |  |   99|      6|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 6]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      6|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 6]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|      6|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|      6|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 6]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|      6|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|      6|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 6]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|      6|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|      6|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|      6|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      6|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|      6|        }                                                                      \
  |  |  123|  3.87k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 3.86k]
  |  |  ------------------
  ------------------
  755|  3.86k|    {   SymbolEncodingType_e const LLtype = (SymbolEncodingType_e)(*ip >> 6);
  756|  3.86k|        SymbolEncodingType_e const OFtype = (SymbolEncodingType_e)((*ip >> 4) & 3);
  757|  3.86k|        SymbolEncodingType_e const MLtype = (SymbolEncodingType_e)((*ip >> 2) & 3);
  758|  3.86k|        ip++;
  759|       |
  760|       |        /* Build DTables */
  761|  3.86k|        assert(ip <= iend);
  ------------------
  |  |   70|  3.86k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  762|  3.86k|        {   size_t const llhSize = ZSTD_buildSeqTable(dctx->entropy.LLTable, &dctx->LLTptr,
  763|  3.86k|                                                      LLtype, MaxLL, LLFSELog,
  ------------------
  |  |  104|  3.86k|#define MaxLL   35
  ------------------
                                                                    LLtype, MaxLL, LLFSELog,
  ------------------
  |  |  109|  3.86k|#define LLFSELog    9
  ------------------
  764|  3.86k|                                                      ip, (size_t)(iend-ip),
  765|  3.86k|                                                      LL_base, LL_bits,
  766|  3.86k|                                                      LL_defaultDTable, dctx->fseEntropy,
  767|  3.86k|                                                      dctx->ddictIsCold, nbSeq,
  768|  3.86k|                                                      dctx->workspace, sizeof(dctx->workspace),
  769|  3.86k|                                                      ZSTD_DCtx_get_bmi2(dctx));
  770|  3.86k|            RETURN_ERROR_IF(ZSTD_isError(llhSize), corruption_detected, "ZSTD_buildSeqTable failed");
  ------------------
  |  |  114|  3.86k|    do {                                                                       \
  |  |  115|  3.86k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 4, False: 3.86k]
  |  |  ------------------
  |  |  116|      4|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|      4|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|      4|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|      4|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|      4|    do {                                           \
  |  |  |  |   99|      4|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 4]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      4|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|      4|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|      4|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|      4|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|      4|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|      4|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|      4|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|      4|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      4|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|      4|        }                                                                      \
  |  |  123|  3.86k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 3.86k]
  |  |  ------------------
  ------------------
  771|  3.86k|            ip += llhSize;
  772|  3.86k|        }
  773|       |
  774|  3.86k|        assert(ip <= iend);
  ------------------
  |  |   70|  3.86k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  775|  3.86k|        {   size_t const ofhSize = ZSTD_buildSeqTable(dctx->entropy.OFTable, &dctx->OFTptr,
  776|  3.86k|                                                      OFtype, MaxOff, OffFSELog,
  ------------------
  |  |  106|  3.86k|#define MaxOff  31
  ------------------
                                                                    OFtype, MaxOff, OffFSELog,
  ------------------
  |  |  110|  3.86k|#define OffFSELog   8
  ------------------
  777|  3.86k|                                                      ip, (size_t)(iend-ip),
  778|  3.86k|                                                      OF_base, OF_bits,
  779|  3.86k|                                                      OF_defaultDTable, dctx->fseEntropy,
  780|  3.86k|                                                      dctx->ddictIsCold, nbSeq,
  781|  3.86k|                                                      dctx->workspace, sizeof(dctx->workspace),
  782|  3.86k|                                                      ZSTD_DCtx_get_bmi2(dctx));
  783|  3.86k|            RETURN_ERROR_IF(ZSTD_isError(ofhSize), corruption_detected, "ZSTD_buildSeqTable failed");
  ------------------
  |  |  114|  3.86k|    do {                                                                       \
  |  |  115|  3.86k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 5, False: 3.85k]
  |  |  ------------------
  |  |  116|      5|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|      5|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 5]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|      5|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|      5|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|      5|    do {                                           \
  |  |  |  |   99|      5|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 5]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      5|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 5]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|      5|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|      5|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 5]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|      5|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|      5|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 5]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|      5|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|      5|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|      5|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      5|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|      5|        }                                                                      \
  |  |  123|  3.86k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 3.85k]
  |  |  ------------------
  ------------------
  784|  3.85k|            ip += ofhSize;
  785|  3.85k|        }
  786|       |
  787|  3.85k|        assert(ip <= iend);
  ------------------
  |  |   70|  3.85k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  788|  3.85k|        {   size_t const mlhSize = ZSTD_buildSeqTable(dctx->entropy.MLTable, &dctx->MLTptr,
  789|  3.85k|                                                      MLtype, MaxML, MLFSELog,
  ------------------
  |  |  103|  3.85k|#define MaxML   52
  ------------------
                                                                    MLtype, MaxML, MLFSELog,
  ------------------
  |  |  108|  3.85k|#define MLFSELog    9
  ------------------
  790|  3.85k|                                                      ip, (size_t)(iend-ip),
  791|  3.85k|                                                      ML_base, ML_bits,
  792|  3.85k|                                                      ML_defaultDTable, dctx->fseEntropy,
  793|  3.85k|                                                      dctx->ddictIsCold, nbSeq,
  794|  3.85k|                                                      dctx->workspace, sizeof(dctx->workspace),
  795|  3.85k|                                                      ZSTD_DCtx_get_bmi2(dctx));
  796|  3.85k|            RETURN_ERROR_IF(ZSTD_isError(mlhSize), corruption_detected, "ZSTD_buildSeqTable failed");
  ------------------
  |  |  114|  3.85k|    do {                                                                       \
  |  |  115|  3.85k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 14, False: 3.84k]
  |  |  ------------------
  |  |  116|     14|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|     14|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 14]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|     14|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|     14|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|     14|    do {                                           \
  |  |  |  |   99|     14|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 14]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|     14|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 14]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|     14|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|     14|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 14]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|     14|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|     14|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 14]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|     14|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|     14|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|     14|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|     14|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|     14|        }                                                                      \
  |  |  123|  3.85k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 3.84k]
  |  |  ------------------
  ------------------
  797|  3.84k|            ip += mlhSize;
  798|  3.84k|        }
  799|  3.84k|    }
  800|       |
  801|      0|    return (size_t)(ip-istart);
  802|  3.85k|}
ZSTD_decompressBlock_internal:
 2194|  4.93k|{   /* blockType == blockCompressed */
 2195|  4.93k|    const BYTE* ip = (const BYTE*)src;
 2196|  4.93k|    DEBUGLOG(5, "ZSTD_decompressBlock_internal (cSize : %u)", (unsigned)srcSize);
  ------------------
  |  |  104|  4.93k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 4.93k]
  |  |  ------------------
  ------------------
 2197|       |
 2198|       |    /* Note : the wording of the specification
 2199|       |     * allows compressed block to be sized exactly ZSTD_blockSizeMax(dctx).
 2200|       |     * This generally does not happen, as it makes little sense,
 2201|       |     * since an uncompressed block would feature same size and have no decompression cost.
 2202|       |     * Also, note that decoder from reference libzstd before < v1.5.4
 2203|       |     * would consider this edge case as an error.
 2204|       |     * As a consequence, avoid generating compressed blocks of size ZSTD_blockSizeMax(dctx)
 2205|       |     * for broader compatibility with the deployed ecosystem of zstd decoders */
 2206|  4.93k|    RETURN_ERROR_IF(srcSize > ZSTD_blockSizeMax(dctx), srcSize_wrong, "");
  ------------------
  |  |  114|  4.93k|    do {                                                                       \
  |  |  115|  4.93k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 1, False: 4.93k]
  |  |  ------------------
  |  |  116|      1|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|      1|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|      1|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|      1|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|      1|    do {                                           \
  |  |  |  |   99|      1|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 1]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      1|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|      1|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|      1|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|      1|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|      1|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|      1|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|      1|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|      1|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      1|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|      1|        }                                                                      \
  |  |  123|  4.93k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 4.93k]
  |  |  ------------------
  ------------------
 2207|       |
 2208|       |    /* Decode literals section */
 2209|  4.93k|    {   size_t const litCSize = ZSTD_decodeLiteralsBlock(dctx, src, srcSize, dst, dstCapacity, streaming);
 2210|  4.93k|        DEBUGLOG(5, "ZSTD_decodeLiteralsBlock : cSize=%u, nbLiterals=%zu", (U32)litCSize, dctx->litSize);
  ------------------
  |  |  104|  4.93k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 4.93k]
  |  |  ------------------
  ------------------
 2211|  4.93k|        if (ZSTD_isError(litCSize)) return litCSize;
  ------------------
  |  |   44|  4.93k|#define ZSTD_isError ERR_isError   /* for inlining */
  ------------------
  |  Branch (2211:13): [True: 74, False: 4.86k]
  ------------------
 2212|  4.86k|        ip += litCSize;
 2213|  4.86k|        srcSize -= litCSize;
 2214|  4.86k|    }
 2215|       |
 2216|       |    /* Build Decoding Tables */
 2217|      0|    {
 2218|       |        /* Compute the maximum block size, which must also work when !frame and fParams are unset.
 2219|       |         * Additionally, take the min with dstCapacity to ensure that the totalHistorySize fits in a size_t.
 2220|       |         */
 2221|  4.86k|        size_t const blockSizeMax = MIN(dstCapacity, ZSTD_blockSizeMax(dctx));
  ------------------
  |  |   54|  4.86k|#define MIN(a,b) ((a)<(b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (54:19): [True: 14, False: 4.84k]
  |  |  ------------------
  ------------------
 2222|  4.86k|        size_t const totalHistorySize = ZSTD_totalHistorySize(ZSTD_maybeNullPtrAdd(dst, (ptrdiff_t)blockSizeMax), (BYTE const*)dctx->virtualStart);
 2223|       |        /* isLongOffset must be true if there are long offsets.
 2224|       |         * Offsets are long if they are larger than ZSTD_maxShortOffset().
 2225|       |         * We don't expect that to be the case in 64-bit mode.
 2226|       |         *
 2227|       |         * We check here to see if our history is large enough to allow long offsets.
 2228|       |         * If it isn't, then we can't possible have (valid) long offsets. If the offset
 2229|       |         * is invalid, then it is okay to read it incorrectly.
 2230|       |         *
 2231|       |         * If isLongOffsets is true, then we will later check our decoding table to see
 2232|       |         * if it is even possible to generate long offsets.
 2233|       |         */
 2234|  4.86k|        ZSTD_longOffset_e isLongOffset = (ZSTD_longOffset_e)(MEM_32bits() && (totalHistorySize > ZSTD_maxShortOffset()));
  ------------------
  |  Branch (2234:62): [True: 0, False: 4.86k]
  |  Branch (2234:78): [True: 0, False: 0]
  ------------------
 2235|       |        /* These macros control at build-time which decompressor implementation
 2236|       |         * we use. If neither is defined, we do some inspection and dispatch at
 2237|       |         * runtime.
 2238|       |         */
 2239|  4.86k|#if !defined(ZSTD_FORCE_DECOMPRESS_SEQUENCES_SHORT) && \
 2240|  4.86k|    !defined(ZSTD_FORCE_DECOMPRESS_SEQUENCES_LONG)
 2241|  4.86k|        int usePrefetchDecoder = dctx->ddictIsCold;
 2242|       |#else
 2243|       |        /* Set to 1 to avoid computing offset info if we don't need to.
 2244|       |         * Otherwise this value is ignored.
 2245|       |         */
 2246|       |        int usePrefetchDecoder = 1;
 2247|       |#endif
 2248|  4.86k|        int nbSeq;
 2249|  4.86k|        size_t const seqHSize = ZSTD_decodeSeqHeaders(dctx, &nbSeq, ip, srcSize);
 2250|  4.86k|        if (ZSTD_isError(seqHSize)) return seqHSize;
  ------------------
  |  |   44|  4.86k|#define ZSTD_isError ERR_isError   /* for inlining */
  ------------------
  |  Branch (2250:13): [True: 39, False: 4.82k]
  ------------------
 2251|  4.82k|        ip += seqHSize;
 2252|  4.82k|        srcSize -= seqHSize;
 2253|       |
 2254|  4.82k|        RETURN_ERROR_IF((dst == NULL || dstCapacity == 0) && nbSeq > 0, dstSize_tooSmall, "NULL not handled");
  ------------------
  |  |  114|  4.82k|    do {                                                                       \
  |  |  115|  19.2k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 0, False: 4.82k]
  |  |  |  Branch (115:13): [True: 0, False: 4.82k]
  |  |  |  Branch (115:13): [True: 0, False: 0]
  |  |  ------------------
  |  |  116|      0|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|      0|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|      0|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|      0|    do {                                           \
  |  |  |  |   99|      0|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|      0|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|      0|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|      0|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|      0|        }                                                                      \
  |  |  123|  4.82k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 4.82k]
  |  |  ------------------
  ------------------
 2255|  4.82k|        RETURN_ERROR_IF(MEM_64bits() && sizeof(size_t) == sizeof(void*) && (size_t)(-1) - (size_t)dst < (size_t)(1 << 20), dstSize_tooSmall,
  ------------------
  |  |  114|  4.82k|    do {                                                                       \
  |  |  115|  24.1k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 4.82k, False: 0]
  |  |  |  Branch (115:13): [True: 0, Folded]
  |  |  |  Branch (115:13): [True: 0, False: 4.82k]
  |  |  ------------------
  |  |  116|      0|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|      0|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|      0|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|      0|    do {                                           \
  |  |  |  |   99|      0|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|      0|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|      0|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|      0|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|      0|        }                                                                      \
  |  |  123|  4.82k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 4.82k]
  |  |  ------------------
  ------------------
 2256|  4.82k|                "invalid dst");
 2257|       |
 2258|       |        /* If we could potentially have long offsets, or we might want to use the prefetch decoder,
 2259|       |         * compute information about the share of long offsets, and the maximum nbAdditionalBits.
 2260|       |         * NOTE: could probably use a larger nbSeq limit
 2261|       |         */
 2262|  4.82k|        if (isLongOffset || (!usePrefetchDecoder && (totalHistorySize > (1u << 24)) && (nbSeq > 8))) {
  ------------------
  |  Branch (2262:13): [True: 0, False: 4.82k]
  |  Branch (2262:30): [True: 4.82k, False: 0]
  |  Branch (2262:53): [True: 0, False: 4.82k]
  |  Branch (2262:88): [True: 0, False: 0]
  ------------------
 2263|      0|            ZSTD_OffsetInfo const info = ZSTD_getOffsetInfo(dctx->OFTptr, nbSeq);
 2264|      0|            if (isLongOffset && info.maxNbAdditionalBits <= STREAM_ACCUMULATOR_MIN) {
  ------------------
  |  |   45|      0|#define STREAM_ACCUMULATOR_MIN    ((U32)(MEM_32bits() ? STREAM_ACCUMULATOR_MIN_32 : STREAM_ACCUMULATOR_MIN_64))
  |  |  ------------------
  |  |  |  |   43|      0|#define STREAM_ACCUMULATOR_MIN_32  25
  |  |  ------------------
  |  |               #define STREAM_ACCUMULATOR_MIN    ((U32)(MEM_32bits() ? STREAM_ACCUMULATOR_MIN_32 : STREAM_ACCUMULATOR_MIN_64))
  |  |  ------------------
  |  |  |  |   44|      0|#define STREAM_ACCUMULATOR_MIN_64  57
  |  |  ------------------
  |  |  |  Branch (45:42): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (2264:17): [True: 0, False: 0]
  |  Branch (2264:33): [True: 0, False: 0]
  ------------------
 2265|       |                /* If isLongOffset, but the maximum number of additional bits that we see in our table is small
 2266|       |                 * enough, then we know it is impossible to have too long an offset in this block, so we can
 2267|       |                 * use the regular offset decoder.
 2268|       |                 */
 2269|      0|                isLongOffset = ZSTD_lo_isRegularOffset;
 2270|      0|            }
 2271|      0|            if (!usePrefetchDecoder) {
  ------------------
  |  Branch (2271:17): [True: 0, False: 0]
  ------------------
 2272|      0|                U32 const minShare = MEM_64bits() ? 7 : 20; /* heuristic values, correspond to 2.73% and 7.81% */
  ------------------
  |  Branch (2272:38): [True: 0, False: 0]
  ------------------
 2273|      0|                usePrefetchDecoder = (info.longOffsetShare >= minShare);
 2274|      0|            }
 2275|      0|        }
 2276|       |
 2277|  4.82k|        dctx->ddictIsCold = 0;
 2278|       |
 2279|  4.82k|#if !defined(ZSTD_FORCE_DECOMPRESS_SEQUENCES_SHORT) && \
 2280|  4.82k|    !defined(ZSTD_FORCE_DECOMPRESS_SEQUENCES_LONG)
 2281|  4.82k|        if (usePrefetchDecoder) {
  ------------------
  |  Branch (2281:13): [True: 0, False: 4.82k]
  ------------------
 2282|       |#else
 2283|       |        (void)usePrefetchDecoder;
 2284|       |        {
 2285|       |#endif
 2286|      0|#ifndef ZSTD_FORCE_DECOMPRESS_SEQUENCES_SHORT
 2287|      0|            return ZSTD_decompressSequencesLong(dctx, dst, dstCapacity, ip, srcSize, nbSeq, isLongOffset);
 2288|      0|#endif
 2289|      0|        }
 2290|       |
 2291|  4.82k|#ifndef ZSTD_FORCE_DECOMPRESS_SEQUENCES_LONG
 2292|       |        /* else */
 2293|  4.82k|        if (dctx->litBufferLocation == ZSTD_split)
  ------------------
  |  Branch (2293:13): [True: 0, False: 4.82k]
  ------------------
 2294|      0|            return ZSTD_decompressSequencesSplitLitBuffer(dctx, dst, dstCapacity, ip, srcSize, nbSeq, isLongOffset);
 2295|  4.82k|        else
 2296|  4.82k|            return ZSTD_decompressSequences(dctx, dst, dstCapacity, ip, srcSize, nbSeq, isLongOffset);
 2297|  4.82k|#endif
 2298|  4.82k|    }
 2299|  4.82k|}
ZSTD_checkContinuity:
 2304|  5.14k|{
 2305|  5.14k|    if (dst != dctx->previousDstEnd && dstSize > 0) {   /* not contiguous */
  ------------------
  |  Branch (2305:9): [True: 5.14k, False: 0]
  |  Branch (2305:40): [True: 5.14k, False: 1]
  ------------------
 2306|  5.14k|        dctx->dictEnd = dctx->previousDstEnd;
 2307|  5.14k|        dctx->virtualStart = (const char*)dst - ((const char*)(dctx->previousDstEnd) - (const char*)(dctx->prefixStart));
 2308|  5.14k|        dctx->prefixStart = dst;
 2309|  5.14k|        dctx->previousDstEnd = dst;
 2310|  5.14k|    }
 2311|       |    /* The external dictionary and current prefix share the frame window.
 2312|       |     * As the prefix grows after a wrap, retaining a full external window
 2313|       |     * could let corrupt offsets alias the destination and expose stale literals.
 2314|       |     * decodedSize > 0 ensures the frame header has initialized windowSize.
 2315|       |     * Only kicks in after decoding windowSize bytes because the entire dictionary is
 2316|       |     * valid as long as a single byte of the dictionary is in the window.
 2317|       |     */
 2318|  5.14k|    if (dstSize > 0 && dctx->isFrameDecompression && dctx->decodedSize > 0 && dctx->decodedSize >= dctx->fParams.windowSize) {
  ------------------
  |  Branch (2318:9): [True: 5.14k, False: 1]
  |  Branch (2318:24): [True: 5.14k, False: 0]
  |  Branch (2318:54): [True: 0, False: 5.14k]
  |  Branch (2318:79): [True: 0, False: 0]
  ------------------
 2319|      0|        size_t const prefixSize = (size_t)((const char*)dctx->previousDstEnd - (const char*)dctx->prefixStart);
 2320|      0|        size_t const extDictSize = (size_t)((const char*)dctx->prefixStart - (const char*)dctx->virtualStart);
 2321|      0|        U64 const maxExtDictSize = prefixSize < dctx->fParams.windowSize ? dctx->fParams.windowSize - prefixSize : 0;
  ------------------
  |  Branch (2321:36): [True: 0, False: 0]
  ------------------
 2322|      0|        dctx->virtualStart = (const char*)dctx->prefixStart - (size_t)MIN((U64)extDictSize, maxExtDictSize);
  ------------------
  |  |   54|      0|#define MIN(a,b) ((a)<(b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (54:19): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2323|      0|    }
 2324|  5.14k|}
zstd_decompress_block.c:ZSTD_decodeLiteralsBlock:
  156|  4.93k|{
  157|  4.93k|    DEBUGLOG(5, "ZSTD_decodeLiteralsBlock");
  ------------------
  |  |  104|  4.93k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 4.93k]
  |  |  ------------------
  ------------------
  158|  4.93k|    RETURN_ERROR_IF(srcSize < MIN_CBLOCK_SIZE, corruption_detected, "");
  ------------------
  |  |  114|  4.93k|    do {                                                                       \
  |  |  115|  4.93k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 1, False: 4.93k]
  |  |  ------------------
  |  |  116|      1|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|      1|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|      1|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|      1|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|      1|    do {                                           \
  |  |  |  |   99|      1|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 1]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      1|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|      1|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|      1|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|      1|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|      1|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|      1|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|      1|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|      1|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      1|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|      1|        }                                                                      \
  |  |  123|  4.93k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 4.93k]
  |  |  ------------------
  ------------------
  159|       |
  160|  4.93k|    {   const BYTE* const istart = (const BYTE*) src;
  161|  4.93k|        SymbolEncodingType_e const litEncType = (SymbolEncodingType_e)(istart[0] & 3);
  162|  4.93k|        size_t const blockSizeMax = ZSTD_blockSizeMax(dctx);
  163|       |
  164|  4.93k|        switch(litEncType)
  165|  4.93k|        {
  166|      1|        case set_repeat:
  ------------------
  |  Branch (166:9): [True: 1, False: 4.93k]
  ------------------
  167|      1|            DEBUGLOG(5, "set_repeat flag : re-using stats from previous compressed literals block");
  ------------------
  |  |  104|      1|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 1]
  |  |  ------------------
  ------------------
  168|      1|            RETURN_ERROR_IF(dctx->litEntropy==0, dictionary_corrupted, "");
  ------------------
  |  |  114|      1|    do {                                                                       \
  |  |  115|      1|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 1, False: 0]
  |  |  ------------------
  |  |  116|      1|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|      1|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|      1|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|      1|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|      1|    do {                                           \
  |  |  |  |   99|      1|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 1]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      1|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|      1|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|      1|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|      1|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|      1|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|      1|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|      1|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|      1|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      1|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|      1|        }                                                                      \
  |  |  123|      1|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  169|      0|            ZSTD_FALLTHROUGH;
  ------------------
  |  |  288|      0|#  define ZSTD_FALLTHROUGH ; __attribute__((__fallthrough__))
  ------------------
  170|       |
  171|  2.78k|        case set_compressed:
  ------------------
  |  Branch (171:9): [True: 2.78k, False: 2.15k]
  ------------------
  172|  2.78k|            RETURN_ERROR_IF(srcSize < 5, corruption_detected, "srcSize >= MIN_CBLOCK_SIZE == 2; here we need up to 5 for case 3");
  ------------------
  |  |  114|  2.78k|    do {                                                                       \
  |  |  115|  2.78k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 1, False: 2.78k]
  |  |  ------------------
  |  |  116|      1|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|      1|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|      1|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|      1|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|      1|    do {                                           \
  |  |  |  |   99|      1|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 1]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      1|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|      1|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|      1|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|      1|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|      1|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|      1|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|      1|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|      1|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      1|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|      1|        }                                                                      \
  |  |  123|  2.78k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 2.78k]
  |  |  ------------------
  ------------------
  173|  2.78k|            {   size_t lhSize, litSize, litCSize;
  174|  2.78k|                U32 singleStream=0;
  175|  2.78k|                U32 const lhlCode = (istart[0] >> 2) & 3;
  176|  2.78k|                U32 const lhc = MEM_readLE32(istart);
  177|  2.78k|                size_t hufSuccess;
  178|  2.78k|                size_t expectedWriteSize = MIN(blockSizeMax, dstCapacity);
  ------------------
  |  |   54|  2.78k|#define MIN(a,b) ((a)<(b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (54:19): [True: 27, False: 2.75k]
  |  |  ------------------
  ------------------
  179|  2.78k|                int const flags = 0
  180|  2.78k|                    | (ZSTD_DCtx_get_bmi2(dctx) ? HUF_flags_bmi2 : 0)
  ------------------
  |  Branch (180:24): [True: 2.78k, False: 0]
  ------------------
  181|  2.78k|                    | (dctx->disableHufAsm ? HUF_flags_disableAsm : 0);
  ------------------
  |  Branch (181:24): [True: 0, False: 2.78k]
  ------------------
  182|  2.78k|                switch(lhlCode)
  183|  2.78k|                {
  184|  2.77k|                case 0: case 1: default:   /* note : default is impossible, since lhlCode into [0..3] */
  ------------------
  |  Branch (184:17): [True: 2.76k, False: 18]
  |  Branch (184:25): [True: 10, False: 2.77k]
  |  Branch (184:33): [True: 0, False: 2.78k]
  ------------------
  185|       |                    /* 2 - 2 - 10 - 10 */
  186|  2.77k|                    singleStream = !lhlCode;
  187|  2.77k|                    lhSize = 3;
  188|  2.77k|                    litSize  = (lhc >> 4) & 0x3FF;
  189|  2.77k|                    litCSize = (lhc >> 14) & 0x3FF;
  190|  2.77k|                    break;
  191|      4|                case 2:
  ------------------
  |  Branch (191:17): [True: 4, False: 2.77k]
  ------------------
  192|       |                    /* 2 - 2 - 14 - 14 */
  193|      4|                    lhSize = 4;
  194|      4|                    litSize  = (lhc >> 4) & 0x3FFF;
  195|      4|                    litCSize = lhc >> 18;
  196|      4|                    break;
  197|      4|                case 3:
  ------------------
  |  Branch (197:17): [True: 4, False: 2.77k]
  ------------------
  198|       |                    /* 2 - 2 - 18 - 18 */
  199|      4|                    lhSize = 5;
  200|      4|                    litSize  = (lhc >> 4) & 0x3FFFF;
  201|      4|                    litCSize = (lhc >> 22) + ((size_t)istart[4] << 10);
  202|      4|                    break;
  203|  2.78k|                }
  204|  2.78k|                RETURN_ERROR_IF(litSize > 0 && dst == NULL, dstSize_tooSmall, "NULL not handled");
  ------------------
  |  |  114|  2.78k|    do {                                                                       \
  |  |  115|  8.34k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 2.78k, False: 1]
  |  |  |  Branch (115:13): [True: 0, False: 2.78k]
  |  |  ------------------
  |  |  116|      0|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|      0|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|      0|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|      0|    do {                                           \
  |  |  |  |   99|      0|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|      0|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|      0|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|      0|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|      0|        }                                                                      \
  |  |  123|  2.78k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 2.78k]
  |  |  ------------------
  ------------------
  205|  2.78k|                RETURN_ERROR_IF(litSize > blockSizeMax, corruption_detected, "");
  ------------------
  |  |  114|  2.78k|    do {                                                                       \
  |  |  115|  2.78k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 4, False: 2.77k]
  |  |  ------------------
  |  |  116|      4|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|      4|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|      4|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|      4|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|      4|    do {                                           \
  |  |  |  |   99|      4|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 4]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      4|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|      4|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|      4|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|      4|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|      4|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|      4|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|      4|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|      4|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      4|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|      4|        }                                                                      \
  |  |  123|  2.78k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 2.77k]
  |  |  ------------------
  ------------------
  206|  2.77k|                if (!singleStream)
  ------------------
  |  Branch (206:21): [True: 14, False: 2.76k]
  ------------------
  207|     14|                    RETURN_ERROR_IF(litSize < MIN_LITERALS_FOR_4_STREAMS, literals_headerWrong,
  ------------------
  |  |  114|     14|    do {                                                                       \
  |  |  115|     14|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 1, False: 13]
  |  |  ------------------
  |  |  116|      1|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|      1|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|      1|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|      1|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|      1|    do {                                           \
  |  |  |  |   99|      1|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 1]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      1|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|      1|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|      1|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|      1|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|      1|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|      1|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|      1|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|      1|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      1|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|      1|        }                                                                      \
  |  |  123|     14|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 13]
  |  |  ------------------
  ------------------
  208|  2.77k|                        "Not enough literals (%zu) for the 4-streams mode (min %u)",
  209|  2.77k|                        litSize, MIN_LITERALS_FOR_4_STREAMS);
  210|  2.77k|                RETURN_ERROR_IF(litCSize + lhSize > srcSize, corruption_detected, "");
  ------------------
  |  |  114|  2.77k|    do {                                                                       \
  |  |  115|  2.77k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 10, False: 2.76k]
  |  |  ------------------
  |  |  116|     10|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|     10|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 10]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|     10|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|     10|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|     10|    do {                                           \
  |  |  |  |   99|     10|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 10]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|     10|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 10]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|     10|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|     10|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 10]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|     10|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|     10|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 10]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|     10|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|     10|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|     10|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|     10|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|     10|        }                                                                      \
  |  |  123|  2.77k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 2.76k]
  |  |  ------------------
  ------------------
  211|  2.76k|                RETURN_ERROR_IF(expectedWriteSize < litSize , dstSize_tooSmall, "");
  ------------------
  |  |  114|  2.76k|    do {                                                                       \
  |  |  115|  2.76k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 1, False: 2.76k]
  |  |  ------------------
  |  |  116|      1|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|      1|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|      1|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|      1|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|      1|    do {                                           \
  |  |  |  |   99|      1|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 1]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      1|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|      1|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|      1|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|      1|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|      1|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|      1|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|      1|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|      1|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      1|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|      1|        }                                                                      \
  |  |  123|  2.76k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 2.76k]
  |  |  ------------------
  ------------------
  212|  2.76k|                ZSTD_allocateLiteralsBuffer(dctx, dst, dstCapacity, litSize, streaming, expectedWriteSize, 0);
  213|       |
  214|       |                /* prefetch huffman table if cold */
  215|  2.76k|                if (dctx->ddictIsCold && (litSize > 768 /* heuristic */)) {
  ------------------
  |  Branch (215:21): [True: 0, False: 2.76k]
  |  Branch (215:42): [True: 0, False: 0]
  ------------------
  216|      0|                    PREFETCH_AREA(dctx->HUFptr, sizeof(dctx->entropy.hufTable));
  ------------------
  |  |  167|      0|    do {                                                 \
  |  |  168|      0|        const char* const _ptr = (const char*)(p);       \
  |  |  169|      0|        size_t const _size = (size_t)(s);                \
  |  |  170|      0|        size_t _pos;                                     \
  |  |  171|      0|        for (_pos=0; _pos<_size; _pos+=CACHELINE_SIZE) { \
  |  |  ------------------
  |  |  |  |  164|      0|#define CACHELINE_SIZE 64
  |  |  ------------------
  |  |  |  Branch (171:22): [True: 0, False: 0]
  |  |  ------------------
  |  |  172|      0|            PREFETCH_L2(_ptr + _pos);                    \
  |  |  ------------------
  |  |  |  |  150|      0|#    define PREFETCH_L2(ptr)  __builtin_prefetch((ptr), 0 /* rw==read */, 2 /* locality */)
  |  |  ------------------
  |  |  173|      0|        }                                                \
  |  |  174|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (174:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  217|      0|                }
  218|       |
  219|  2.76k|                if (litEncType==set_repeat) {
  ------------------
  |  Branch (219:21): [True: 0, False: 2.76k]
  ------------------
  220|      0|                    if (singleStream) {
  ------------------
  |  Branch (220:25): [True: 0, False: 0]
  ------------------
  221|      0|                        hufSuccess = HUF_decompress1X_usingDTable(
  222|      0|                            dctx->litBuffer, litSize, istart+lhSize, litCSize,
  223|      0|                            dctx->HUFptr, flags);
  224|      0|                    } else {
  225|      0|                        assert(litSize >= MIN_LITERALS_FOR_4_STREAMS);
  ------------------
  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  226|      0|                        hufSuccess = HUF_decompress4X_usingDTable(
  227|      0|                            dctx->litBuffer, litSize, istart+lhSize, litCSize,
  228|      0|                            dctx->HUFptr, flags);
  229|      0|                    }
  230|  2.76k|                } else {
  231|  2.76k|                    if (singleStream) {
  ------------------
  |  Branch (231:25): [True: 2.75k, False: 7]
  ------------------
  232|       |                        /* Compressed literals must use the table-reading variant;
  233|       |                         * the generic decoder also accepts raw/RLE data. */
  234|       |#if defined(HUF_FORCE_DECOMPRESS_X2)
  235|       |                        hufSuccess = HUF_decompress1X2_DCtx_wksp(
  236|       |                            dctx->entropy.hufTable, dctx->litBuffer, litSize,
  237|       |                            istart+lhSize, litCSize, dctx->workspace,
  238|       |                            sizeof(dctx->workspace), flags);
  239|       |#else
  240|  2.75k|                        hufSuccess = HUF_decompress1X1_DCtx_wksp(
  241|  2.75k|                            dctx->entropy.hufTable, dctx->litBuffer, litSize,
  242|  2.75k|                            istart+lhSize, litCSize, dctx->workspace,
  243|  2.75k|                            sizeof(dctx->workspace), flags);
  244|  2.75k|#endif
  245|  2.75k|                    } else {
  246|      7|                        hufSuccess = HUF_decompress4X_hufOnly_wksp(
  247|      7|                            dctx->entropy.hufTable, dctx->litBuffer, litSize,
  248|      7|                            istart+lhSize, litCSize, dctx->workspace,
  249|      7|                            sizeof(dctx->workspace), flags);
  250|      7|                    }
  251|  2.76k|                }
  252|  2.76k|                if (dctx->litBufferLocation == ZSTD_split)
  ------------------
  |  Branch (252:21): [True: 0, False: 2.76k]
  ------------------
  253|      0|                {
  254|      0|                    assert(litSize > ZSTD_LITBUFFEREXTRASIZE);
  ------------------
  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  255|      0|                    ZSTD_memcpy(dctx->litExtraBuffer, dctx->litBufferEnd - ZSTD_LITBUFFEREXTRASIZE, ZSTD_LITBUFFEREXTRASIZE);
  ------------------
  |  |   44|      0|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  |  |  ------------------
  |  |  |  Branch (44:51): [True: 0, Folded]
  |  |  |  Branch (44:51): [True: 0, Folded]
  |  |  |  Branch (44:51): [Folded, False: 0]
  |  |  |  Branch (44:55): [True: 0, Folded]
  |  |  |  Branch (44:55): [True: 0, Folded]
  |  |  |  Branch (44:55): [Folded, False: 0]
  |  |  ------------------
  ------------------
  256|      0|                    ZSTD_memmove(dctx->litBuffer + ZSTD_LITBUFFEREXTRASIZE - WILDCOPY_OVERLENGTH, dctx->litBuffer, litSize - ZSTD_LITBUFFEREXTRASIZE);
  ------------------
  |  |   45|      0|# define ZSTD_memmove(d,s,l) __builtin_memmove((d),(s),(l))
  |  |  ------------------
  |  |  |  Branch (45:49): [True: 0, Folded]
  |  |  |  Branch (45:49): [True: 0, Folded]
  |  |  |  Branch (45:49): [Folded, False: 0]
  |  |  |  Branch (45:57): [True: 0, Folded]
  |  |  |  Branch (45:57): [True: 0, Folded]
  |  |  |  Branch (45:57): [Folded, False: 0]
  |  |  ------------------
  ------------------
  257|      0|                    dctx->litBuffer += ZSTD_LITBUFFEREXTRASIZE - WILDCOPY_OVERLENGTH;
  ------------------
  |  |  118|      0|#define ZSTD_LITBUFFEREXTRASIZE  BOUNDED(ZSTD_LBMIN, ZSTD_DECODER_INTERNAL_BUFFER, ZSTD_LBMAX)
  |  |  ------------------
  |  |  |  |   56|      0|#define BOUNDED(min,val,max) (MAX(min,MIN(val,max)))
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|      0|#define MAX(a,b) ((a)>(b) ? (a) : (b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (55:19): [Folded, False: 0]
  |  |  |  |  |  |  |  Branch (55:24): [True: 0, Folded]
  |  |  |  |  |  |  |  Branch (55:36): [True: 0, Folded]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                                  dctx->litBuffer += ZSTD_LITBUFFEREXTRASIZE - WILDCOPY_OVERLENGTH;
  ------------------
  |  |  201|      0|#define WILDCOPY_OVERLENGTH 32
  ------------------
  258|      0|                    dctx->litBufferEnd -= WILDCOPY_OVERLENGTH;
  ------------------
  |  |  201|      0|#define WILDCOPY_OVERLENGTH 32
  ------------------
  259|      0|                    assert(dctx->litBufferEnd <= (BYTE*)dst + blockSizeMax);
  ------------------
  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  260|      0|                }
  261|       |
  262|  2.76k|                RETURN_ERROR_IF(HUF_isError(hufSuccess), corruption_detected, "");
  ------------------
  |  |  114|  2.76k|    do {                                                                       \
  |  |  115|  2.76k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 19, False: 2.74k]
  |  |  ------------------
  |  |  116|     19|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|     19|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 19]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|     19|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|     19|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|     19|    do {                                           \
  |  |  |  |   99|     19|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 19]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|     19|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 19]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|     19|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|     19|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 19]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|     19|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|     19|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 19]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|     19|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|     19|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|     19|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|     19|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|     19|        }                                                                      \
  |  |  123|  2.76k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 2.74k]
  |  |  ------------------
  ------------------
  263|       |
  264|  2.74k|                ZSTD_zeroLiteralsBufferPadding(dctx, litSize);
  265|  2.74k|                dctx->litPtr = dctx->litBuffer;
  266|  2.74k|                dctx->litSize = litSize;
  267|  2.74k|                dctx->litEntropy = 1;
  268|  2.74k|                if (litEncType==set_compressed) dctx->HUFptr = dctx->entropy.hufTable;
  ------------------
  |  Branch (268:21): [True: 2.74k, False: 0]
  ------------------
  269|  2.74k|                return litCSize + lhSize;
  270|  2.76k|            }
  271|       |
  272|  2.11k|        case set_basic:
  ------------------
  |  Branch (272:9): [True: 2.11k, False: 2.82k]
  ------------------
  273|  2.11k|            {   size_t litSize, lhSize;
  274|  2.11k|                U32 const lhlCode = ((istart[0]) >> 2) & 3;
  275|  2.11k|                size_t expectedWriteSize = MIN(blockSizeMax, dstCapacity);
  ------------------
  |  |   54|  2.11k|#define MIN(a,b) ((a)<(b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (54:19): [True: 69, False: 2.04k]
  |  |  ------------------
  ------------------
  276|  2.11k|                switch(lhlCode)
  277|  2.11k|                {
  278|  1.52k|                case 0: case 2: default:   /* note : default is impossible, since lhlCode into [0..3] */
  ------------------
  |  Branch (278:17): [True: 720, False: 1.39k]
  |  Branch (278:25): [True: 808, False: 1.30k]
  |  Branch (278:33): [True: 0, False: 2.11k]
  ------------------
  279|  1.52k|                    lhSize = 1;
  280|  1.52k|                    litSize = istart[0] >> 3;
  281|  1.52k|                    break;
  282|    573|                case 1:
  ------------------
  |  Branch (282:17): [True: 573, False: 1.53k]
  ------------------
  283|    573|                    lhSize = 2;
  284|    573|                    litSize = MEM_readLE16(istart) >> 4;
  285|    573|                    break;
  286|      9|                case 3:
  ------------------
  |  Branch (286:17): [True: 9, False: 2.10k]
  ------------------
  287|      9|                    lhSize = 3;
  288|      9|                    RETURN_ERROR_IF(srcSize<3, corruption_detected, "srcSize >= MIN_CBLOCK_SIZE == 2; here we need lhSize = 3");
  ------------------
  |  |  114|      9|    do {                                                                       \
  |  |  115|      9|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 1, False: 8]
  |  |  ------------------
  |  |  116|      1|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|      1|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|      1|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|      1|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|      1|    do {                                           \
  |  |  |  |   99|      1|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 1]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      1|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|      1|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|      1|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|      1|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|      1|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|      1|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|      1|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|      1|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      1|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|      1|        }                                                                      \
  |  |  123|      9|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 8]
  |  |  ------------------
  ------------------
  289|      8|                    litSize = MEM_readLE24(istart) >> 4;
  290|      8|                    break;
  291|  2.11k|                }
  292|       |
  293|  2.10k|                RETURN_ERROR_IF(litSize > 0 && dst == NULL, dstSize_tooSmall, "NULL not handled");
  ------------------
  |  |  114|  2.10k|    do {                                                                       \
  |  |  115|  6.26k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 2.04k, False: 60]
  |  |  |  Branch (115:13): [True: 0, False: 2.04k]
  |  |  ------------------
  |  |  116|      0|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|      0|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|      0|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|      0|    do {                                           \
  |  |  |  |   99|      0|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|      0|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|      0|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|      0|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|      0|        }                                                                      \
  |  |  123|  2.10k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 2.10k]
  |  |  ------------------
  ------------------
  294|  2.10k|                RETURN_ERROR_IF(litSize > blockSizeMax, corruption_detected, "");
  ------------------
  |  |  114|  2.10k|    do {                                                                       \
  |  |  115|  2.10k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 2, False: 2.10k]
  |  |  ------------------
  |  |  116|      2|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|      2|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 2]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|      2|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|      2|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|      2|    do {                                           \
  |  |  |  |   99|      2|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 2]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      2|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 2]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|      2|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|      2|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 2]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|      2|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|      2|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 2]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|      2|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|      2|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|      2|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      2|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|      2|        }                                                                      \
  |  |  123|  2.10k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 2.10k]
  |  |  ------------------
  ------------------
  295|  2.10k|                RETURN_ERROR_IF(expectedWriteSize < litSize, dstSize_tooSmall, "");
  ------------------
  |  |  114|  2.10k|    do {                                                                       \
  |  |  115|  2.10k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 1, False: 2.10k]
  |  |  ------------------
  |  |  116|      1|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|      1|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|      1|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|      1|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|      1|    do {                                           \
  |  |  |  |   99|      1|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 1]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      1|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|      1|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|      1|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|      1|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|      1|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|      1|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|      1|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|      1|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      1|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|      1|        }                                                                      \
  |  |  123|  2.10k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 2.10k]
  |  |  ------------------
  ------------------
  296|  2.10k|                ZSTD_allocateLiteralsBuffer(dctx, dst, dstCapacity, litSize, streaming, expectedWriteSize, 1);
  297|  2.10k|                if (lhSize+litSize+WILDCOPY_OVERLENGTH > srcSize) {  /* risk reading beyond src buffer with wildcopy */
  ------------------
  |  |  201|  2.10k|#define WILDCOPY_OVERLENGTH 32
  ------------------
  |  Branch (297:21): [True: 2.10k, False: 4]
  ------------------
  298|  2.10k|                    RETURN_ERROR_IF(litSize+lhSize > srcSize, corruption_detected, "");
  ------------------
  |  |  114|  2.10k|    do {                                                                       \
  |  |  115|  2.10k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 17, False: 2.08k]
  |  |  ------------------
  |  |  116|     17|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|     17|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 17]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|     17|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|     17|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|     17|    do {                                           \
  |  |  |  |   99|     17|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 17]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|     17|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 17]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|     17|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|     17|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 17]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|     17|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|     17|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 17]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|     17|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|     17|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|     17|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|     17|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|     17|        }                                                                      \
  |  |  123|  2.10k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 2.08k]
  |  |  ------------------
  ------------------
  299|  2.08k|                    if (dctx->litBufferLocation == ZSTD_split)
  ------------------
  |  Branch (299:25): [True: 0, False: 2.08k]
  ------------------
  300|      0|                    {
  301|      0|                        ZSTD_memcpy(dctx->litBuffer, istart + lhSize, litSize - ZSTD_LITBUFFEREXTRASIZE);
  ------------------
  |  |   44|      0|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  |  |  ------------------
  |  |  |  Branch (44:55): [True: 0, Folded]
  |  |  |  Branch (44:55): [True: 0, Folded]
  |  |  |  Branch (44:55): [Folded, False: 0]
  |  |  ------------------
  ------------------
  302|      0|                        ZSTD_memcpy(dctx->litExtraBuffer, istart + lhSize + litSize - ZSTD_LITBUFFEREXTRASIZE, ZSTD_LITBUFFEREXTRASIZE);
  ------------------
  |  |   44|      0|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  |  |  ------------------
  |  |  |  Branch (44:51): [True: 0, Folded]
  |  |  |  Branch (44:51): [True: 0, Folded]
  |  |  |  Branch (44:51): [Folded, False: 0]
  |  |  |  Branch (44:55): [True: 0, Folded]
  |  |  |  Branch (44:55): [True: 0, Folded]
  |  |  |  Branch (44:55): [Folded, False: 0]
  |  |  ------------------
  ------------------
  303|      0|                    }
  304|  2.08k|                    else
  305|  2.08k|                    {
  306|  2.08k|                        ZSTD_memcpy(dctx->litBuffer, istart + lhSize, litSize);
  ------------------
  |  |   44|  2.08k|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  ------------------
  307|  2.08k|                    }
  308|  2.08k|                    ZSTD_zeroLiteralsBufferPadding(dctx, litSize);
  309|  2.08k|                    dctx->litPtr = dctx->litBuffer;
  310|  2.08k|                    dctx->litSize = litSize;
  311|  2.08k|                    return lhSize+litSize;
  312|  2.10k|                }
  313|       |                /* direct reference into compressed stream */
  314|      4|                dctx->litPtr = istart+lhSize;
  315|      4|                dctx->litSize = litSize;
  316|      4|                dctx->litBufferEnd = dctx->litPtr + litSize;
  317|      4|                dctx->litBufferLocation = ZSTD_not_in_dst;
  318|      4|                return lhSize+litSize;
  319|  2.10k|            }
  320|       |
  321|     41|        case set_rle:
  ------------------
  |  Branch (321:9): [True: 41, False: 4.89k]
  ------------------
  322|     41|            {   U32 const lhlCode = ((istart[0]) >> 2) & 3;
  323|     41|                size_t litSize, lhSize;
  324|     41|                size_t expectedWriteSize = MIN(blockSizeMax, dstCapacity);
  ------------------
  |  |   54|     41|#define MIN(a,b) ((a)<(b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (54:19): [True: 35, False: 6]
  |  |  ------------------
  ------------------
  325|     41|                switch(lhlCode)
  326|     41|                {
  327|     15|                case 0: case 2: default:   /* note : default is impossible, since lhlCode into [0..3] */
  ------------------
  |  Branch (327:17): [True: 10, False: 31]
  |  Branch (327:25): [True: 5, False: 36]
  |  Branch (327:33): [True: 0, False: 41]
  ------------------
  328|     15|                    lhSize = 1;
  329|     15|                    litSize = istart[0] >> 3;
  330|     15|                    break;
  331|      9|                case 1:
  ------------------
  |  Branch (331:17): [True: 9, False: 32]
  ------------------
  332|      9|                    lhSize = 2;
  333|      9|                    RETURN_ERROR_IF(srcSize<3, corruption_detected, "srcSize >= MIN_CBLOCK_SIZE == 2; here we need lhSize+1 = 3");
  ------------------
  |  |  114|      9|    do {                                                                       \
  |  |  115|      9|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 1, False: 8]
  |  |  ------------------
  |  |  116|      1|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|      1|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|      1|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|      1|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|      1|    do {                                           \
  |  |  |  |   99|      1|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 1]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      1|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|      1|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|      1|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|      1|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|      1|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|      1|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|      1|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|      1|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      1|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|      1|        }                                                                      \
  |  |  123|      9|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 8]
  |  |  ------------------
  ------------------
  334|      8|                    litSize = MEM_readLE16(istart) >> 4;
  335|      8|                    break;
  336|     17|                case 3:
  ------------------
  |  Branch (336:17): [True: 17, False: 24]
  ------------------
  337|     17|                    lhSize = 3;
  338|     17|                    RETURN_ERROR_IF(srcSize<4, corruption_detected, "srcSize >= MIN_CBLOCK_SIZE == 2; here we need lhSize+1 = 4");
  ------------------
  |  |  114|     17|    do {                                                                       \
  |  |  115|     17|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 1, False: 16]
  |  |  ------------------
  |  |  116|      1|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|      1|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|      1|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|      1|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|      1|    do {                                           \
  |  |  |  |   99|      1|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 1]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      1|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|      1|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|      1|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|      1|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|      1|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|      1|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|      1|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|      1|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      1|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|      1|        }                                                                      \
  |  |  123|     17|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 16]
  |  |  ------------------
  ------------------
  339|     16|                    litSize = MEM_readLE24(istart) >> 4;
  340|     16|                    break;
  341|     41|                }
  342|     39|                RETURN_ERROR_IF(litSize > 0 && dst == NULL, dstSize_tooSmall, "NULL not handled");
  ------------------
  |  |  114|     39|    do {                                                                       \
  |  |  115|    114|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 36, False: 3]
  |  |  |  Branch (115:13): [True: 0, False: 36]
  |  |  ------------------
  |  |  116|      0|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|      0|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|      0|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|      0|    do {                                           \
  |  |  |  |   99|      0|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|      0|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|      0|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|      0|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|      0|        }                                                                      \
  |  |  123|     39|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 39]
  |  |  ------------------
  ------------------
  343|     39|                RETURN_ERROR_IF(litSize > blockSizeMax, corruption_detected, "");
  ------------------
  |  |  114|     39|    do {                                                                       \
  |  |  115|     39|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 12, False: 27]
  |  |  ------------------
  |  |  116|     12|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|     12|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 12]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|     12|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|     12|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|     12|    do {                                           \
  |  |  |  |   99|     12|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 12]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|     12|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 12]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|     12|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|     12|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 12]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|     12|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|     12|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 12]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|     12|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|     12|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|     12|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|     12|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|     12|        }                                                                      \
  |  |  123|     39|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 27]
  |  |  ------------------
  ------------------
  344|     27|                RETURN_ERROR_IF(expectedWriteSize < litSize, dstSize_tooSmall, "");
  ------------------
  |  |  114|     27|    do {                                                                       \
  |  |  115|     27|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 1, False: 26]
  |  |  ------------------
  |  |  116|      1|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|      1|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|      1|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|      1|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|      1|    do {                                           \
  |  |  |  |   99|      1|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 1]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      1|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|      1|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|      1|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|      1|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|      1|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|      1|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|      1|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|      1|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      1|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|      1|        }                                                                      \
  |  |  123|     27|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 26]
  |  |  ------------------
  ------------------
  345|     26|                ZSTD_allocateLiteralsBuffer(dctx, dst, dstCapacity, litSize, streaming, expectedWriteSize, 1);
  346|     26|                if (dctx->litBufferLocation == ZSTD_split)
  ------------------
  |  Branch (346:21): [True: 0, False: 26]
  ------------------
  347|      0|                {
  348|      0|                    ZSTD_memset(dctx->litBuffer, istart[lhSize], litSize - ZSTD_LITBUFFEREXTRASIZE);
  ------------------
  |  |   46|      0|# define ZSTD_memset(p,v,l) __builtin_memset((p),(v),(l))
  |  |  ------------------
  |  |  |  Branch (46:55): [True: 0, Folded]
  |  |  |  Branch (46:55): [True: 0, Folded]
  |  |  |  Branch (46:55): [Folded, False: 0]
  |  |  ------------------
  ------------------
  349|      0|                    ZSTD_memset(dctx->litExtraBuffer, istart[lhSize], ZSTD_LITBUFFEREXTRASIZE);
  ------------------
  |  |   46|      0|# define ZSTD_memset(p,v,l) __builtin_memset((p),(v),(l))
  |  |  ------------------
  |  |  |  Branch (46:55): [True: 0, Folded]
  |  |  |  Branch (46:55): [True: 0, Folded]
  |  |  |  Branch (46:55): [Folded, False: 0]
  |  |  ------------------
  ------------------
  350|      0|                }
  351|     26|                else
  352|     26|                {
  353|     26|                    ZSTD_memset(dctx->litBuffer, istart[lhSize], litSize);
  ------------------
  |  |   46|     26|# define ZSTD_memset(p,v,l) __builtin_memset((p),(v),(l))
  ------------------
  354|     26|                }
  355|     26|                ZSTD_zeroLiteralsBufferPadding(dctx, litSize);
  356|     26|                dctx->litPtr = dctx->litBuffer;
  357|     26|                dctx->litSize = litSize;
  358|     26|                return lhSize+1;
  359|     27|            }
  360|      0|        default:
  ------------------
  |  Branch (360:9): [True: 0, False: 4.93k]
  ------------------
  361|      0|            RETURN_ERROR(corruption_detected, "impossible");
  ------------------
  |  |  131|      0|    do {                                                                     \
  |  |  132|      0|        RAWLOG(3, "%s:%d: ERROR!: unconditional check failed, returning %s", \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  133|      0|              __FILE__, __LINE__, ERR_QUOTE(ERROR(err)));                    \
  |  |  134|      0|        _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                               \
  |  |  ------------------
  |  |  |  |   98|      0|    do {                                           \
  |  |  |  |   99|      0|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  135|      0|        RAWLOG(3, ": " __VA_ARGS__);                                         \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  136|      0|        RAWLOG(3, "\n");                                                     \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  137|      0|        return ERROR(err);                                                   \
  |  |  ------------------
  |  |  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  138|      0|    } while(0)
  |  |  ------------------
  |  |  |  Branch (138:13): [Folded, False: 0]
  |  |  ------------------
  ------------------
  362|  4.93k|        }
  363|  4.93k|    }
  364|  4.93k|}
zstd_decompress_block.c:ZSTD_allocateLiteralsBuffer:
   82|  4.89k|{
   83|  4.89k|    size_t const blockSizeMax = ZSTD_blockSizeMax(dctx);
   84|  4.89k|    assert(litSize <= blockSizeMax);
  ------------------
  |  |   70|  4.89k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
   85|  4.89k|    assert(dctx->isFrameDecompression || streaming == not_streaming);
  ------------------
  |  |   70|  4.89k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
   86|  4.89k|    assert(expectedWriteSize <= blockSizeMax);
  ------------------
  |  |   70|  4.89k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
   87|  4.89k|    if (streaming == not_streaming && dstCapacity > blockSizeMax + WILDCOPY_OVERLENGTH + litSize + WILDCOPY_OVERLENGTH) {
  ------------------
  |  |  201|  4.89k|#define WILDCOPY_OVERLENGTH 32
  ------------------
                  if (streaming == not_streaming && dstCapacity > blockSizeMax + WILDCOPY_OVERLENGTH + litSize + WILDCOPY_OVERLENGTH) {
  ------------------
  |  |  201|  4.89k|#define WILDCOPY_OVERLENGTH 32
  ------------------
  |  Branch (87:9): [True: 4.89k, False: 0]
  |  Branch (87:39): [True: 98, False: 4.79k]
  ------------------
   88|       |        /* If we aren't streaming, we can just put the literals after the output
   89|       |         * of the current block. We don't need to worry about overwriting the
   90|       |         * extDict of our window, because it doesn't exist.
   91|       |         * So if we have space after the end of the block, just put it there.
   92|       |         */
   93|     98|        dctx->litBuffer = (BYTE*)dst + blockSizeMax + WILDCOPY_OVERLENGTH;
  ------------------
  |  |  201|     98|#define WILDCOPY_OVERLENGTH 32
  ------------------
   94|     98|        dctx->litBufferEnd = dctx->litBuffer + litSize;
   95|     98|        dctx->litBufferLocation = ZSTD_in_dst;
   96|  4.79k|    } else if (litSize <= ZSTD_LITBUFFEREXTRASIZE) {
  ------------------
  |  |  118|  4.79k|#define ZSTD_LITBUFFEREXTRASIZE  BOUNDED(ZSTD_LBMIN, ZSTD_DECODER_INTERNAL_BUFFER, ZSTD_LBMAX)
  |  |  ------------------
  |  |  |  |   56|  4.79k|#define BOUNDED(min,val,max) (MAX(min,MIN(val,max)))
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|  9.59k|#define MAX(a,b) ((a)>(b) ? (a) : (b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (55:19): [Folded, False: 4.79k]
  |  |  |  |  |  |  |  Branch (55:24): [True: 0, Folded]
  |  |  |  |  |  |  |  Branch (55:36): [True: 4.79k, Folded]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (96:16): [True: 4.79k, False: 0]
  ------------------
   97|       |        /* Literals fit entirely within the extra buffer, put them there to avoid
   98|       |         * having to split the literals.
   99|       |         */
  100|  4.79k|        dctx->litBuffer = dctx->litExtraBuffer;
  101|  4.79k|        dctx->litBufferEnd = dctx->litBuffer + litSize;
  102|  4.79k|        dctx->litBufferLocation = ZSTD_not_in_dst;
  103|  4.79k|    } else {
  104|      0|        assert(blockSizeMax > ZSTD_LITBUFFEREXTRASIZE);
  ------------------
  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  105|       |        /* Literals must be split between the output block and the extra lit
  106|       |         * buffer. We fill the extra lit buffer with the tail of the literals,
  107|       |         * and put the rest of the literals at the end of the block, with
  108|       |         * WILDCOPY_OVERLENGTH of buffer room to allow for overreads.
  109|       |         * This MUST not write more than our maxBlockSize beyond dst, because in
  110|       |         * streaming mode, that could overwrite part of our extDict window.
  111|       |         */
  112|      0|        if (splitImmediately) {
  ------------------
  |  Branch (112:13): [True: 0, False: 0]
  ------------------
  113|       |            /* won't fit in litExtraBuffer, so it will be split between end of dst and extra buffer */
  114|      0|            dctx->litBuffer = (BYTE*)dst + expectedWriteSize - litSize + ZSTD_LITBUFFEREXTRASIZE - WILDCOPY_OVERLENGTH;
  ------------------
  |  |  118|      0|#define ZSTD_LITBUFFEREXTRASIZE  BOUNDED(ZSTD_LBMIN, ZSTD_DECODER_INTERNAL_BUFFER, ZSTD_LBMAX)
  |  |  ------------------
  |  |  |  |   56|      0|#define BOUNDED(min,val,max) (MAX(min,MIN(val,max)))
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|      0|#define MAX(a,b) ((a)>(b) ? (a) : (b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (55:19): [Folded, False: 0]
  |  |  |  |  |  |  |  Branch (55:24): [True: 0, Folded]
  |  |  |  |  |  |  |  Branch (55:36): [True: 0, Folded]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                          dctx->litBuffer = (BYTE*)dst + expectedWriteSize - litSize + ZSTD_LITBUFFEREXTRASIZE - WILDCOPY_OVERLENGTH;
  ------------------
  |  |  201|      0|#define WILDCOPY_OVERLENGTH 32
  ------------------
  115|      0|            dctx->litBufferEnd = dctx->litBuffer + litSize - ZSTD_LITBUFFEREXTRASIZE;
  ------------------
  |  |  118|      0|#define ZSTD_LITBUFFEREXTRASIZE  BOUNDED(ZSTD_LBMIN, ZSTD_DECODER_INTERNAL_BUFFER, ZSTD_LBMAX)
  |  |  ------------------
  |  |  |  |   56|      0|#define BOUNDED(min,val,max) (MAX(min,MIN(val,max)))
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|      0|#define MAX(a,b) ((a)>(b) ? (a) : (b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (55:19): [Folded, False: 0]
  |  |  |  |  |  |  |  Branch (55:24): [True: 0, Folded]
  |  |  |  |  |  |  |  Branch (55:36): [True: 0, Folded]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  116|      0|        } else {
  117|       |            /* initially this will be stored entirely in dst during huffman decoding, it will partially be shifted to litExtraBuffer after */
  118|      0|            dctx->litBuffer = (BYTE*)dst + expectedWriteSize - litSize;
  119|      0|            dctx->litBufferEnd = (BYTE*)dst + expectedWriteSize;
  120|      0|        }
  121|      0|        dctx->litBufferLocation = ZSTD_split;
  122|      0|        assert(dctx->litBufferEnd <= (BYTE*)dst + expectedWriteSize);
  ------------------
  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  123|      0|    }
  124|  4.89k|}
zstd_decompress_block.c:ZSTD_zeroLiteralsBufferPadding:
  132|  4.85k|{
  133|  4.85k|    if (dctx->litBufferLocation == ZSTD_split) {
  ------------------
  |  Branch (133:9): [True: 0, False: 4.85k]
  ------------------
  134|      0|        BYTE* const litBufferEnd = dctx->litBuffer + litSize - ZSTD_LITBUFFEREXTRASIZE;
  ------------------
  |  |  118|      0|#define ZSTD_LITBUFFEREXTRASIZE  BOUNDED(ZSTD_LBMIN, ZSTD_DECODER_INTERNAL_BUFFER, ZSTD_LBMAX)
  |  |  ------------------
  |  |  |  |   56|      0|#define BOUNDED(min,val,max) (MAX(min,MIN(val,max)))
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|      0|#define MAX(a,b) ((a)>(b) ? (a) : (b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (55:19): [Folded, False: 0]
  |  |  |  |  |  |  |  Branch (55:24): [True: 0, Folded]
  |  |  |  |  |  |  |  Branch (55:36): [True: 0, Folded]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  135|      0|        assert(litBufferEnd == dctx->litBufferEnd);
  ------------------
  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  136|      0|        ZSTD_memset(litBufferEnd, 0, WILDCOPY_OVERLENGTH);
  ------------------
  |  |   46|      0|# define ZSTD_memset(p,v,l) __builtin_memset((p),(v),(l))
  ------------------
  137|      0|        ZSTD_memset(dctx->litExtraBuffer + ZSTD_LITBUFFEREXTRASIZE, 0, WILDCOPY_OVERLENGTH);
  ------------------
  |  |   46|      0|# define ZSTD_memset(p,v,l) __builtin_memset((p),(v),(l))
  |  |  ------------------
  |  |  |  Branch (46:47): [True: 0, Folded]
  |  |  |  Branch (46:47): [True: 0, Folded]
  |  |  |  Branch (46:47): [Folded, False: 0]
  |  |  ------------------
  ------------------
  138|  4.85k|    } else {
  139|  4.85k|        BYTE* const litBufferEnd = dctx->litBuffer + litSize;
  140|  4.85k|        assert(litBufferEnd == dctx->litBufferEnd);
  ------------------
  |  |   70|  4.85k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  141|  4.85k|        ZSTD_memset(litBufferEnd, 0, WILDCOPY_OVERLENGTH);
  ------------------
  |  |   46|  4.85k|# define ZSTD_memset(p,v,l) __builtin_memset((p),(v),(l))
  ------------------
  142|  4.85k|    }
  143|  4.85k|}
zstd_decompress_block.c:ZSTD_buildFSETable_body_bmi2:
  644|    643|{
  645|    643|    ZSTD_buildFSETable_body(dt, normalizedCounter, maxSymbolValue,
  646|    643|            baseValue, nbAdditionalBits, tableLog, wksp, wkspSize);
  647|    643|}
zstd_decompress_block.c:ZSTD_buildFSETable_body:
  513|    643|{
  514|    643|    ZSTD_seqSymbol* const tableDecode = dt+1;
  515|    643|    U32 const maxSV1 = maxSymbolValue + 1;
  516|    643|    U32 const tableSize = 1 << tableLog;
  517|       |
  518|    643|    U16* symbolNext = (U16*)wksp;
  519|    643|    BYTE* spread = (BYTE*)(symbolNext + MaxSeq + 1);
  ------------------
  |  |  107|    643|#define MaxSeq MAX(MaxLL, MaxML)   /* Assumption : MaxOff < MaxLL,MaxML */
  |  |  ------------------
  |  |  |  |   55|    643|#define MAX(a,b) ((a)>(b) ? (a) : (b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (55:19): [Folded, False: 643]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  520|    643|    U32 highThreshold = tableSize - 1;
  521|       |
  522|       |
  523|       |    /* Sanity Checks */
  524|    643|    assert(maxSymbolValue <= MaxSeq);
  ------------------
  |  |   70|    643|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  525|    643|    assert(tableLog <= MaxFSELog);
  ------------------
  |  |   70|    643|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  526|    643|    assert(wkspSize >= ZSTD_BUILD_FSE_TABLE_WKSP_SIZE);
  ------------------
  |  |   70|    643|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  527|    643|    (void)wkspSize;
  528|       |    /* Init, lay down lowprob symbols */
  529|    643|    {   ZSTD_seqSymbol_header DTableH;
  530|    643|        DTableH.tableLog = tableLog;
  531|    643|        DTableH.fastMode = 1;
  532|    643|        {   S16 const largeLimit= (S16)(1 << (tableLog-1));
  533|    643|            U32 s;
  534|  5.61k|            for (s=0; s<maxSV1; s++) {
  ------------------
  |  Branch (534:23): [True: 4.97k, False: 643]
  ------------------
  535|  4.97k|                if (normalizedCounter[s]==-1) {
  ------------------
  |  Branch (535:21): [True: 38, False: 4.93k]
  ------------------
  536|     38|                    tableDecode[highThreshold--].baseValue = s;
  537|     38|                    symbolNext[s] = 1;
  538|  4.93k|                } else {
  539|  4.93k|                    if (normalizedCounter[s] >= largeLimit) DTableH.fastMode=0;
  ------------------
  |  Branch (539:25): [True: 512, False: 4.42k]
  ------------------
  540|  4.93k|                    assert(normalizedCounter[s]>=0);
  ------------------
  |  |   70|  4.93k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  541|  4.93k|                    symbolNext[s] = (U16)normalizedCounter[s];
  542|  4.93k|        }   }   }
  543|    643|        ZSTD_memcpy(dt, &DTableH, sizeof(DTableH));
  ------------------
  |  |   44|    643|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  ------------------
  544|    643|    }
  545|       |
  546|       |    /* Spread symbols */
  547|    643|    assert(tableSize <= 512);
  ------------------
  |  |   70|    643|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  548|       |    /* Specialized symbol spreading for the case when there are
  549|       |     * no low probability (-1 count) symbols. When compressing
  550|       |     * small blocks we avoid low probability symbols to hit this
  551|       |     * case, since header decoding speed matters more.
  552|       |     */
  553|    643|    if (highThreshold == tableSize - 1) {
  ------------------
  |  Branch (553:9): [True: 627, False: 16]
  ------------------
  554|    627|        size_t const tableMask = tableSize-1;
  555|    627|        size_t const step = FSE_TABLESTEP(tableSize);
  ------------------
  |  |  623|    627|#define FSE_TABLESTEP(tableSize) (((tableSize)>>1) + ((tableSize)>>3) + 3)
  ------------------
  556|       |        /* First lay down the symbols in order.
  557|       |         * We use a uint64_t to lay down 8 bytes at a time. This reduces branch
  558|       |         * misses since small blocks generally have small table logs, so nearly
  559|       |         * all symbols have counts <= 8. We ensure we have 8 bytes at the end of
  560|       |         * our buffer to handle the over-write.
  561|       |         */
  562|    627|        {
  563|    627|            U64 const add = 0x0101010101010101ull;
  564|    627|            size_t pos = 0;
  565|    627|            U64 sv = 0;
  566|    627|            U32 s;
  567|  5.48k|            for (s=0; s<maxSV1; ++s, sv += add) {
  ------------------
  |  Branch (567:23): [True: 4.85k, False: 627]
  ------------------
  568|  4.85k|                int i;
  569|  4.85k|                int const n = normalizedCounter[s];
  570|  4.85k|                MEM_write64(spread + pos, sv);
  571|  6.39k|                for (i = 8; i < n; i += 8) {
  ------------------
  |  Branch (571:29): [True: 1.53k, False: 4.85k]
  ------------------
  572|  1.53k|                    MEM_write64(spread + pos + i, sv);
  573|  1.53k|                }
  574|  4.85k|                assert(n>=0);
  ------------------
  |  |   70|  4.85k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  575|  4.85k|                pos += (size_t)n;
  576|  4.85k|            }
  577|    627|        }
  578|       |        /* Now we spread those positions across the table.
  579|       |         * The benefit of doing it in two stages is that we avoid the
  580|       |         * variable size inner loop, which caused lots of branch misses.
  581|       |         * Now we can run through all the positions without any branch misses.
  582|       |         * We unroll the loop twice, since that is what empirically worked best.
  583|       |         */
  584|    627|        {
  585|    627|            size_t position = 0;
  586|    627|            size_t s;
  587|    627|            size_t const unroll = 2;
  588|    627|            assert(tableSize % unroll == 0); /* FSE_MIN_TABLELOG is 5 */
  ------------------
  |  |   70|    627|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  589|  11.0k|            for (s = 0; s < (size_t)tableSize; s += unroll) {
  ------------------
  |  Branch (589:25): [True: 10.4k, False: 627]
  ------------------
  590|  10.4k|                size_t u;
  591|  31.3k|                for (u = 0; u < unroll; ++u) {
  ------------------
  |  Branch (591:29): [True: 20.8k, False: 10.4k]
  ------------------
  592|  20.8k|                    size_t const uPosition = (position + (u * step)) & tableMask;
  593|  20.8k|                    tableDecode[uPosition].baseValue = spread[s + u];
  594|  20.8k|                }
  595|  10.4k|                position = (position + (unroll * step)) & tableMask;
  596|  10.4k|            }
  597|    627|            assert(position == 0);
  ------------------
  |  |   70|    627|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  598|    627|        }
  599|    627|    } else {
  600|     16|        U32 const tableMask = tableSize-1;
  601|     16|        U32 const step = FSE_TABLESTEP(tableSize);
  ------------------
  |  |  623|     16|#define FSE_TABLESTEP(tableSize) (((tableSize)>>1) + ((tableSize)>>3) + 3)
  ------------------
  602|     16|        U32 s, position = 0;
  603|    130|        for (s=0; s<maxSV1; s++) {
  ------------------
  |  Branch (603:19): [True: 114, False: 16]
  ------------------
  604|    114|            int i;
  605|    114|            int const n = normalizedCounter[s];
  606|  2.60k|            for (i=0; i<n; i++) {
  ------------------
  |  Branch (606:23): [True: 2.49k, False: 114]
  ------------------
  607|  2.49k|                tableDecode[position].baseValue = s;
  608|  2.49k|                position = (position + step) & tableMask;
  609|  2.52k|                while (UNLIKELY(position > highThreshold)) position = (position + step) & tableMask;   /* lowprob area */
  ------------------
  |  |  196|  2.52k|#define UNLIKELY(x) (__builtin_expect((x), 0))
  |  |  ------------------
  |  |  |  Branch (196:21): [True: 38, False: 2.49k]
  |  |  ------------------
  ------------------
  610|  2.49k|        }   }
  611|     16|        assert(position == 0); /* position must reach all cells once, otherwise normalizedCounter is incorrect */
  ------------------
  |  |   70|     16|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  612|     16|    }
  613|       |
  614|       |    /* Build Decoding table */
  615|    643|    {
  616|    643|        U32 u;
  617|  24.0k|        for (u=0; u<tableSize; u++) {
  ------------------
  |  Branch (617:19): [True: 23.4k, False: 643]
  ------------------
  618|  23.4k|            U32 const symbol = tableDecode[u].baseValue;
  619|  23.4k|            U32 const nextState = symbolNext[symbol]++;
  620|  23.4k|            tableDecode[u].nbBits = (BYTE) (tableLog - ZSTD_highbit32(nextState) );
  621|  23.4k|            tableDecode[u].nextState = (U16) ( (nextState << tableDecode[u].nbBits) - tableSize);
  622|  23.4k|            assert(nbAdditionalBits[symbol] < 255);
  ------------------
  |  |   70|  23.4k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  623|  23.4k|            tableDecode[u].nbAdditionalBits = nbAdditionalBits[symbol];
  624|  23.4k|            tableDecode[u].baseValue = baseValue[symbol];
  625|  23.4k|        }
  626|    643|    }
  627|    643|}
zstd_decompress_block.c:ZSTD_buildSeqTable:
  678|  11.5k|{
  679|  11.5k|    switch(type)
  680|  11.5k|    {
  681|    213|    case set_rle :
  ------------------
  |  Branch (681:5): [True: 213, False: 11.3k]
  ------------------
  682|    213|        RETURN_ERROR_IF(!srcSize, srcSize_wrong, "");
  ------------------
  |  |  114|    213|    do {                                                                       \
  |  |  115|    213|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 2, False: 211]
  |  |  ------------------
  |  |  116|      2|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|      2|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 2]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|      2|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|      2|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|      2|    do {                                           \
  |  |  |  |   99|      2|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 2]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      2|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 2]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|      2|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|      2|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 2]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|      2|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|      2|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 2]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|      2|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|      2|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|      2|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      2|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|      2|        }                                                                      \
  |  |  123|    213|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 211]
  |  |  ------------------
  ------------------
  683|    211|        RETURN_ERROR_IF((*(const BYTE*)src) > max, corruption_detected, "");
  ------------------
  |  |  114|    211|    do {                                                                       \
  |  |  115|    211|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 3, False: 208]
  |  |  ------------------
  |  |  116|      3|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|      3|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|      3|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|      3|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|      3|    do {                                           \
  |  |  |  |   99|      3|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 3]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      3|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|      3|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|      3|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|      3|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|      3|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|      3|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|      3|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|      3|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      3|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|      3|        }                                                                      \
  |  |  123|    211|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 208]
  |  |  ------------------
  ------------------
  684|    208|        {   U32 const symbol = *(const BYTE*)src;
  685|    208|            U32 const baseline = baseValue[symbol];
  686|    208|            U8 const nbBits = nbAdditionalBits[symbol];
  687|    208|            ZSTD_buildSeqTable_rle(DTableSpace, baseline, nbBits);
  688|    208|        }
  689|    208|        *DTablePtr = DTableSpace;
  690|    208|        return 1;
  691|  10.7k|    case set_basic :
  ------------------
  |  Branch (691:5): [True: 10.7k, False: 874]
  ------------------
  692|  10.7k|        *DTablePtr = defaultTable;
  693|  10.7k|        return 0;
  694|      3|    case set_repeat:
  ------------------
  |  Branch (694:5): [True: 3, False: 11.5k]
  ------------------
  695|      3|        RETURN_ERROR_IF(!flagRepeatTable, corruption_detected, "");
  ------------------
  |  |  114|      3|    do {                                                                       \
  |  |  115|      3|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 3, False: 0]
  |  |  ------------------
  |  |  116|      3|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|      3|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|      3|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|      3|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|      3|    do {                                           \
  |  |  |  |   99|      3|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 3]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      3|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|      3|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|      3|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|      3|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|      3|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|      3|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|      3|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|      3|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      3|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|      3|        }                                                                      \
  |  |  123|      3|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  696|       |        /* prefetch FSE table if used */
  697|      0|        if (ddictIsCold && (nbSeq > 24 /* heuristic */)) {
  ------------------
  |  Branch (697:13): [True: 0, False: 0]
  |  Branch (697:28): [True: 0, False: 0]
  ------------------
  698|      0|            const void* const pStart = *DTablePtr;
  699|      0|            size_t const pSize = sizeof(ZSTD_seqSymbol) * (SEQSYMBOL_TABLE_SIZE(maxLog));
  ------------------
  |  |   74|      0| #define SEQSYMBOL_TABLE_SIZE(log)   (1 + (1 << (log)))
  ------------------
  700|      0|            PREFETCH_AREA(pStart, pSize);
  ------------------
  |  |  167|      0|    do {                                                 \
  |  |  168|      0|        const char* const _ptr = (const char*)(p);       \
  |  |  169|      0|        size_t const _size = (size_t)(s);                \
  |  |  170|      0|        size_t _pos;                                     \
  |  |  171|      0|        for (_pos=0; _pos<_size; _pos+=CACHELINE_SIZE) { \
  |  |  ------------------
  |  |  |  |  164|      0|#define CACHELINE_SIZE 64
  |  |  ------------------
  |  |  |  Branch (171:22): [True: 0, False: 0]
  |  |  ------------------
  |  |  172|      0|            PREFETCH_L2(_ptr + _pos);                    \
  |  |  ------------------
  |  |  |  |  150|      0|#    define PREFETCH_L2(ptr)  __builtin_prefetch((ptr), 0 /* rw==read */, 2 /* locality */)
  |  |  ------------------
  |  |  173|      0|        }                                                \
  |  |  174|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (174:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  701|      0|        }
  702|      0|        return 0;
  703|    658|    case set_compressed :
  ------------------
  |  Branch (703:5): [True: 658, False: 10.9k]
  ------------------
  704|    658|        {   unsigned tableLog;
  705|    658|            S16 norm[MaxSeq+1];
  706|    658|            size_t const headerSize = FSE_readNCount(norm, &max, &tableLog, src, srcSize);
  707|    658|            RETURN_ERROR_IF(FSE_isError(headerSize), corruption_detected, "");
  ------------------
  |  |  114|    658|    do {                                                                       \
  |  |  115|    658|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 12, False: 646]
  |  |  ------------------
  |  |  116|     12|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|     12|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 12]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|     12|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|     12|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|     12|    do {                                           \
  |  |  |  |   99|     12|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 12]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|     12|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 12]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|     12|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|     12|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 12]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|     12|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|     12|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 12]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|     12|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|     12|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|     12|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|     12|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|     12|        }                                                                      \
  |  |  123|    658|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 646]
  |  |  ------------------
  ------------------
  708|    646|            RETURN_ERROR_IF(tableLog > maxLog, corruption_detected, "");
  ------------------
  |  |  114|    646|    do {                                                                       \
  |  |  115|    646|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 3, False: 643]
  |  |  ------------------
  |  |  116|      3|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|      3|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|      3|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|      3|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|      3|    do {                                           \
  |  |  |  |   99|      3|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 3]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      3|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|      3|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|      3|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|      3|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|      3|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|      3|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|      3|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|      3|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      3|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|      3|        }                                                                      \
  |  |  123|    646|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 643]
  |  |  ------------------
  ------------------
  709|    643|            ZSTD_buildFSETable(DTableSpace, norm, max, baseValue, nbAdditionalBits, tableLog, wksp, wkspSize, bmi2);
  710|    643|            *DTablePtr = DTableSpace;
  711|    643|            return headerSize;
  712|    646|        }
  713|      0|    default :
  ------------------
  |  Branch (713:5): [True: 0, False: 11.5k]
  ------------------
  714|      0|        assert(0);
  ------------------
  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  715|      0|        RETURN_ERROR(GENERIC, "impossible");
  ------------------
  |  |  131|      0|    do {                                                                     \
  |  |  132|      0|        RAWLOG(3, "%s:%d: ERROR!: unconditional check failed, returning %s", \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  133|      0|              __FILE__, __LINE__, ERR_QUOTE(ERROR(err)));                    \
  |  |  134|      0|        _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                               \
  |  |  ------------------
  |  |  |  |   98|      0|    do {                                           \
  |  |  |  |   99|      0|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  135|      0|        RAWLOG(3, ": " __VA_ARGS__);                                         \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  136|      0|        RAWLOG(3, "\n");                                                     \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  137|      0|        return ERROR(err);                                                   \
  |  |  ------------------
  |  |  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  138|      0|    } while(0)
  |  |  ------------------
  |  |  |  Branch (138:13): [Folded, False: 0]
  |  |  ------------------
  ------------------
  716|  11.5k|    }
  717|  11.5k|}
zstd_decompress_block.c:ZSTD_buildSeqTable_rle:
  488|    208|{
  489|    208|    void* ptr = dt;
  490|    208|    ZSTD_seqSymbol_header* const DTableH = (ZSTD_seqSymbol_header*)ptr;
  491|    208|    ZSTD_seqSymbol* const cell = dt + 1;
  492|       |
  493|    208|    DTableH->tableLog = 0;
  494|    208|    DTableH->fastMode = 0;
  495|       |
  496|    208|    cell->nbBits = 0;
  497|    208|    cell->nextState = 0;
  498|    208|    assert(nbAddBits < 255);
  ------------------
  |  |   70|    208|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  499|    208|    cell->nbAdditionalBits = nbAddBits;
  500|    208|    cell->baseValue = baseValue;
  501|    208|}
zstd_decompress_block.c:ZSTD_blockSizeMax:
   55|  24.4k|{
   56|  24.4k|    size_t const blockSizeMax = dctx->isFrameDecompression ? dctx->fParams.blockSizeMax : ZSTD_BLOCKSIZE_MAX;
  ------------------
  |  |  148|  24.4k|#define ZSTD_BLOCKSIZE_MAX     (1<<ZSTD_BLOCKSIZELOG_MAX)
  |  |  ------------------
  |  |  |  |  147|      0|#define ZSTD_BLOCKSIZELOG_MAX  17
  |  |  ------------------
  ------------------
  |  Branch (56:33): [True: 24.4k, False: 0]
  ------------------
   57|  24.4k|    assert(blockSizeMax <= ZSTD_BLOCKSIZE_MAX);
  ------------------
  |  |   70|  24.4k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
   58|  24.4k|    return blockSizeMax;
   59|  24.4k|}
zstd_decompress_block.c:ZSTD_totalHistorySize:
 2122|  4.86k|{
 2123|  4.86k|    return (size_t)ZSTD_wrappedPtrDiff((const BYTE*)curPtr, (const BYTE*)virtualStart);
 2124|  4.86k|}
zstd_decompress_block.c:ZSTD_initFseState:
 1231|  11.4k|{
 1232|  11.4k|    const void* ptr = dt;
 1233|  11.4k|    const ZSTD_seqSymbol_header* const DTableH = (const ZSTD_seqSymbol_header*)ptr;
 1234|  11.4k|    DStatePtr->state = BIT_readBits(bitD, DTableH->tableLog);
 1235|  11.4k|    DEBUGLOG(6, "ZSTD_initFseState : val=%u using %u bits",
  ------------------
  |  |  104|  11.4k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 11.4k]
  |  |  ------------------
  ------------------
 1236|  11.4k|                (U32)DStatePtr->state, DTableH->tableLog);
 1237|  11.4k|    BIT_reloadDStream(bitD);
 1238|  11.4k|    DStatePtr->table = dt + 1;
 1239|  11.4k|}
zstd_decompress_block.c:ZSTD_decodeSequence:
 1268|  16.9k|{
 1269|  16.9k|    seq_t seq;
 1270|       |#if defined(__aarch64__)
 1271|       |    size_t prevOffset0 = seqState->prevOffset[0];
 1272|       |    size_t prevOffset1 = seqState->prevOffset[1];
 1273|       |    size_t prevOffset2 = seqState->prevOffset[2];
 1274|       |    /*
 1275|       |     * ZSTD_seqSymbol is a 64 bits wide structure.
 1276|       |     * It can be loaded in one operation
 1277|       |     * and its fields extracted by simply shifting or bit-extracting on aarch64.
 1278|       |     * GCC doesn't recognize this and generates more unnecessary ldr/ldrb/ldrh
 1279|       |     * operations that cause performance drop. This can be avoided by using this
 1280|       |     * ZSTD_memcpy hack.
 1281|       |     */
 1282|       |#  if defined(__GNUC__) && !defined(__clang__)
 1283|       |    ZSTD_seqSymbol llDInfoS, mlDInfoS, ofDInfoS;
 1284|       |    ZSTD_seqSymbol* const llDInfo = &llDInfoS;
 1285|       |    ZSTD_seqSymbol* const mlDInfo = &mlDInfoS;
 1286|       |    ZSTD_seqSymbol* const ofDInfo = &ofDInfoS;
 1287|       |    ZSTD_memcpy(llDInfo, seqState->stateLL.table + seqState->stateLL.state, sizeof(ZSTD_seqSymbol));
 1288|       |    ZSTD_memcpy(mlDInfo, seqState->stateML.table + seqState->stateML.state, sizeof(ZSTD_seqSymbol));
 1289|       |    ZSTD_memcpy(ofDInfo, seqState->stateOffb.table + seqState->stateOffb.state, sizeof(ZSTD_seqSymbol));
 1290|       |#  else
 1291|       |    const ZSTD_seqSymbol* const llDInfo = seqState->stateLL.table + seqState->stateLL.state;
 1292|       |    const ZSTD_seqSymbol* const mlDInfo = seqState->stateML.table + seqState->stateML.state;
 1293|       |    const ZSTD_seqSymbol* const ofDInfo = seqState->stateOffb.table + seqState->stateOffb.state;
 1294|       |#  endif
 1295|       |    (void)longOffsets;
 1296|       |    seq.matchLength = mlDInfo->baseValue;
 1297|       |    seq.litLength = llDInfo->baseValue;
 1298|       |    {   U32 const ofBase = ofDInfo->baseValue;
 1299|       |        BYTE const llBits = llDInfo->nbAdditionalBits;
 1300|       |        BYTE const mlBits = mlDInfo->nbAdditionalBits;
 1301|       |        BYTE const ofBits = ofDInfo->nbAdditionalBits;
 1302|       |        BYTE const totalBits = llBits+mlBits+ofBits;
 1303|       |
 1304|       |        U16 const llNext = llDInfo->nextState;
 1305|       |        U16 const mlNext = mlDInfo->nextState;
 1306|       |        U16 const ofNext = ofDInfo->nextState;
 1307|       |        U32 const llnbBits = llDInfo->nbBits;
 1308|       |        U32 const mlnbBits = mlDInfo->nbBits;
 1309|       |        U32 const ofnbBits = ofDInfo->nbBits;
 1310|       |
 1311|       |        assert(llBits <= MaxLLBits);
 1312|       |        assert(mlBits <= MaxMLBits);
 1313|       |        assert(ofBits <= MaxOff);
 1314|       |        /* sequence */
 1315|       |        {   size_t offset;
 1316|       |            if (ofBits > 1) {
 1317|       |                ZSTD_STATIC_ASSERT(ZSTD_lo_isLongOffset == 1);
 1318|       |                ZSTD_STATIC_ASSERT(LONG_OFFSETS_MAX_EXTRA_BITS_32 == 5);
 1319|       |                ZSTD_STATIC_ASSERT(STREAM_ACCUMULATOR_MIN_32 > LONG_OFFSETS_MAX_EXTRA_BITS_32);
 1320|       |                ZSTD_STATIC_ASSERT(STREAM_ACCUMULATOR_MIN_32 - LONG_OFFSETS_MAX_EXTRA_BITS_32 >= MaxMLBits);
 1321|       |                offset = ofBase + BIT_readBitsFast(&seqState->DStream, ofBits/*>0*/);   /* <=  (ZSTD_WINDOWLOG_MAX-1) bits */
 1322|       |                prevOffset2 = prevOffset1;
 1323|       |                prevOffset1 = prevOffset0;
 1324|       |                prevOffset0 = offset;
 1325|       |            } else {
 1326|       |                U32 const ll0 = (llDInfo->baseValue == 0);
 1327|       |                if (LIKELY((ofBits == 0))) {
 1328|       |                    if (ll0) {
 1329|       |                        offset = prevOffset1;
 1330|       |                        prevOffset1 = prevOffset0;
 1331|       |                        prevOffset0 = offset;
 1332|       |                    } else {
 1333|       |                        offset = prevOffset0;
 1334|       |                    }
 1335|       |                } else {
 1336|       |                    offset = ofBase + ll0 + BIT_readBitsFast(&seqState->DStream, 1);
 1337|       |                    {   size_t temp = (offset == 1)   ? prevOffset1
 1338|       |                                      : (offset == 3) ? prevOffset0 - 1
 1339|       |                                      : (offset >= 2) ? prevOffset2
 1340|       |                                      : prevOffset0;
 1341|       |                        /* 0 is not valid: input corrupted => force offset to -1 =>
 1342|       |                         * corruption detected at execSequence.
 1343|       |                         */
 1344|       |                        temp -= !temp;
 1345|       |                        prevOffset2 = (offset == 1) ? prevOffset2 : prevOffset1;
 1346|       |                        prevOffset1 = prevOffset0;
 1347|       |                        prevOffset0 = offset = temp;
 1348|       |            }   }   }
 1349|       |            seq.offset = offset;
 1350|       |        }
 1351|       |
 1352|       |        if (mlBits > 0)
 1353|       |            seq.matchLength += BIT_readBitsFast(&seqState->DStream, mlBits/*>0*/);
 1354|       |
 1355|       |        if (UNLIKELY(totalBits >= STREAM_ACCUMULATOR_MIN_64-(LLFSELog+MLFSELog+OffFSELog)))
 1356|       |            BIT_reloadDStream(&seqState->DStream);
 1357|       |
 1358|       |        /* Ensure there are enough bits to read the rest of data in 64-bit mode. */
 1359|       |        ZSTD_STATIC_ASSERT(16+LLFSELog+MLFSELog+OffFSELog < STREAM_ACCUMULATOR_MIN_64);
 1360|       |
 1361|       |        if (llBits > 0)
 1362|       |            seq.litLength += BIT_readBitsFast(&seqState->DStream, llBits/*>0*/);
 1363|       |
 1364|       |        DEBUGLOG(6, "seq: litL=%u, matchL=%u, offset=%u",
 1365|       |                    (U32)seq.litLength, (U32)seq.matchLength, (U32)seq.offset);
 1366|       |
 1367|       |        if (!isLastSeq) {
 1368|       |            /* Don't update FSE state for last sequence. */
 1369|       |            ZSTD_updateFseStateWithDInfo(&seqState->stateLL, &seqState->DStream, llNext, llnbBits);    /* <=  9 bits */
 1370|       |            ZSTD_updateFseStateWithDInfo(&seqState->stateML, &seqState->DStream, mlNext, mlnbBits);    /* <=  9 bits */
 1371|       |            ZSTD_updateFseStateWithDInfo(&seqState->stateOffb, &seqState->DStream, ofNext, ofnbBits);  /* <=  8 bits */
 1372|       |            BIT_reloadDStream(&seqState->DStream);
 1373|       |        }
 1374|       |    }
 1375|       |    seqState->prevOffset[0] = prevOffset0;
 1376|       |    seqState->prevOffset[1] = prevOffset1;
 1377|       |    seqState->prevOffset[2] = prevOffset2;
 1378|       |#else   /* !defined(__aarch64__) */
 1379|  16.9k|    const ZSTD_seqSymbol* const llDInfo = seqState->stateLL.table + seqState->stateLL.state;
 1380|  16.9k|    const ZSTD_seqSymbol* const mlDInfo = seqState->stateML.table + seqState->stateML.state;
 1381|  16.9k|    const ZSTD_seqSymbol* const ofDInfo = seqState->stateOffb.table + seqState->stateOffb.state;
 1382|  16.9k|    seq.matchLength = mlDInfo->baseValue;
 1383|  16.9k|    seq.litLength = llDInfo->baseValue;
 1384|  16.9k|    {   U32 const ofBase = ofDInfo->baseValue;
 1385|  16.9k|        BYTE const llBits = llDInfo->nbAdditionalBits;
 1386|  16.9k|        BYTE const mlBits = mlDInfo->nbAdditionalBits;
 1387|  16.9k|        BYTE const ofBits = ofDInfo->nbAdditionalBits;
 1388|  16.9k|        BYTE const totalBits = llBits+mlBits+ofBits;
 1389|       |
 1390|  16.9k|        assert(llBits <= MaxLLBits);
  ------------------
  |  |   70|  16.9k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1391|  16.9k|        assert(mlBits <= MaxMLBits);
  ------------------
  |  |   70|  16.9k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1392|  16.9k|        assert(ofBits <= MaxOff);
  ------------------
  |  |   70|  16.9k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1393|       |        /* sequence */
 1394|  16.9k|        {   size_t offset;
 1395|  16.9k|            if (ofBits > 1) {
  ------------------
  |  Branch (1395:17): [True: 9.94k, False: 7.00k]
  ------------------
 1396|  9.94k|                ZSTD_STATIC_ASSERT(ZSTD_lo_isLongOffset == 1);
  ------------------
  |  |   43|  9.94k|#define ZSTD_STATIC_ASSERT(c) DEBUG_STATIC_ASSERT(c)
  |  |  ------------------
  |  |  |  |   39|  9.94k|#define DEBUG_STATIC_ASSERT(c) (void)sizeof(char[(c) ? 1 : -1])
  |  |  ------------------
  ------------------
 1397|  9.94k|                ZSTD_STATIC_ASSERT(LONG_OFFSETS_MAX_EXTRA_BITS_32 == 5);
  ------------------
  |  |   43|  9.94k|#define ZSTD_STATIC_ASSERT(c) DEBUG_STATIC_ASSERT(c)
  |  |  ------------------
  |  |  |  |   39|  9.94k|#define DEBUG_STATIC_ASSERT(c) (void)sizeof(char[(c) ? 1 : -1])
  |  |  ------------------
  ------------------
 1398|  9.94k|                ZSTD_STATIC_ASSERT(STREAM_ACCUMULATOR_MIN_32 > LONG_OFFSETS_MAX_EXTRA_BITS_32);
  ------------------
  |  |   43|  9.94k|#define ZSTD_STATIC_ASSERT(c) DEBUG_STATIC_ASSERT(c)
  |  |  ------------------
  |  |  |  |   39|  9.94k|#define DEBUG_STATIC_ASSERT(c) (void)sizeof(char[(c) ? 1 : -1])
  |  |  ------------------
  ------------------
 1399|  9.94k|                ZSTD_STATIC_ASSERT(STREAM_ACCUMULATOR_MIN_32 - LONG_OFFSETS_MAX_EXTRA_BITS_32 >= MaxMLBits);
  ------------------
  |  |   43|  9.94k|#define ZSTD_STATIC_ASSERT(c) DEBUG_STATIC_ASSERT(c)
  |  |  ------------------
  |  |  |  |   39|  9.94k|#define DEBUG_STATIC_ASSERT(c) (void)sizeof(char[(c) ? 1 : -1])
  |  |  ------------------
  ------------------
 1400|  9.94k|                if (MEM_32bits() && longOffsets && (ofBits >= STREAM_ACCUMULATOR_MIN_32)) {
  ------------------
  |  |   43|      0|#define STREAM_ACCUMULATOR_MIN_32  25
  ------------------
  |  Branch (1400:21): [True: 0, False: 9.94k]
  |  Branch (1400:37): [True: 0, False: 0]
  |  Branch (1400:52): [True: 0, False: 0]
  ------------------
 1401|       |                    /* Always read extra bits, this keeps the logic simple,
 1402|       |                     * avoids branches, and avoids accidentally reading 0 bits.
 1403|       |                     */
 1404|      0|                    U32 const extraBits = LONG_OFFSETS_MAX_EXTRA_BITS_32;
  ------------------
  |  | 1254|      0|    (ZSTD_WINDOWLOG_MAX_32 > STREAM_ACCUMULATOR_MIN_32       \
  |  |  ------------------
  |  |  |  | 1363|      0|#define ZSTD_WINDOWLOG_MAX_32    30
  |  |  ------------------
  |  |                   (ZSTD_WINDOWLOG_MAX_32 > STREAM_ACCUMULATOR_MIN_32       \
  |  |  ------------------
  |  |  |  |   43|      0|#define STREAM_ACCUMULATOR_MIN_32  25
  |  |  ------------------
  |  |  |  Branch (1254:6): [True: 0, Folded]
  |  |  ------------------
  |  | 1255|      0|        ? ZSTD_WINDOWLOG_MAX_32 - STREAM_ACCUMULATOR_MIN_32  \
  |  |  ------------------
  |  |  |  | 1363|      0|#define ZSTD_WINDOWLOG_MAX_32    30
  |  |  ------------------
  |  |                       ? ZSTD_WINDOWLOG_MAX_32 - STREAM_ACCUMULATOR_MIN_32  \
  |  |  ------------------
  |  |  |  |   43|      0|#define STREAM_ACCUMULATOR_MIN_32  25
  |  |  ------------------
  |  | 1256|      0|        : 0)
  ------------------
 1405|      0|                    offset = ofBase + (BIT_readBitsFast(&seqState->DStream, ofBits - extraBits) << extraBits);
 1406|      0|                    BIT_reloadDStream(&seqState->DStream);
 1407|      0|                    offset += BIT_readBitsFast(&seqState->DStream, extraBits);
 1408|  9.94k|                } else {
 1409|  9.94k|                    offset = ofBase + BIT_readBitsFast(&seqState->DStream, ofBits/*>0*/);   /* <=  (ZSTD_WINDOWLOG_MAX-1) bits */
 1410|  9.94k|                    if (MEM_32bits()) BIT_reloadDStream(&seqState->DStream);
  ------------------
  |  Branch (1410:25): [True: 0, False: 9.94k]
  ------------------
 1411|  9.94k|                }
 1412|  9.94k|                seqState->prevOffset[2] = seqState->prevOffset[1];
 1413|  9.94k|                seqState->prevOffset[1] = seqState->prevOffset[0];
 1414|  9.94k|                seqState->prevOffset[0] = offset;
 1415|  9.94k|            } else {
 1416|  7.00k|                U32 const ll0 = (llDInfo->baseValue == 0);
 1417|  7.00k|                if (LIKELY((ofBits == 0))) {
  ------------------
  |  |  195|  7.00k|#define LIKELY(x) (__builtin_expect((x), 1))
  |  |  ------------------
  |  |  |  Branch (195:19): [True: 5.72k, False: 1.27k]
  |  |  ------------------
  ------------------
 1418|  5.72k|                    offset = seqState->prevOffset[ll0];
 1419|  5.72k|                    seqState->prevOffset[1] = seqState->prevOffset[!ll0];
 1420|  5.72k|                    seqState->prevOffset[0] = offset;
 1421|  5.72k|                } else {
 1422|  1.27k|                    offset = ofBase + ll0 + BIT_readBitsFast(&seqState->DStream, 1);
 1423|  1.27k|                    {   size_t temp = (offset==3) ? seqState->prevOffset[0] - 1 : seqState->prevOffset[offset];
  ------------------
  |  Branch (1423:39): [True: 0, False: 1.27k]
  ------------------
 1424|  1.27k|                        temp -= !temp; /* 0 is not valid: input corrupted => force offset to -1 => corruption detected at execSequence */
 1425|  1.27k|                        if (offset != 1) seqState->prevOffset[2] = seqState->prevOffset[1];
  ------------------
  |  Branch (1425:29): [True: 736, False: 542]
  ------------------
 1426|  1.27k|                        seqState->prevOffset[1] = seqState->prevOffset[0];
 1427|  1.27k|                        seqState->prevOffset[0] = offset = temp;
 1428|  1.27k|            }   }   }
 1429|  16.9k|            seq.offset = offset;
 1430|  16.9k|        }
 1431|       |
 1432|  16.9k|        if (mlBits > 0)
  ------------------
  |  Branch (1432:13): [True: 1.24k, False: 15.7k]
  ------------------
 1433|  1.24k|            seq.matchLength += BIT_readBitsFast(&seqState->DStream, mlBits/*>0*/);
 1434|       |
 1435|  16.9k|        if (MEM_32bits() && (mlBits+llBits >= STREAM_ACCUMULATOR_MIN_32-LONG_OFFSETS_MAX_EXTRA_BITS_32))
  ------------------
  |  |   43|      0|#define STREAM_ACCUMULATOR_MIN_32  25
  ------------------
                      if (MEM_32bits() && (mlBits+llBits >= STREAM_ACCUMULATOR_MIN_32-LONG_OFFSETS_MAX_EXTRA_BITS_32))
  ------------------
  |  | 1254|      0|    (ZSTD_WINDOWLOG_MAX_32 > STREAM_ACCUMULATOR_MIN_32       \
  |  |  ------------------
  |  |  |  | 1363|      0|#define ZSTD_WINDOWLOG_MAX_32    30
  |  |  ------------------
  |  |                   (ZSTD_WINDOWLOG_MAX_32 > STREAM_ACCUMULATOR_MIN_32       \
  |  |  ------------------
  |  |  |  |   43|      0|#define STREAM_ACCUMULATOR_MIN_32  25
  |  |  ------------------
  |  |  |  Branch (1254:6): [True: 0, Folded]
  |  |  ------------------
  |  | 1255|      0|        ? ZSTD_WINDOWLOG_MAX_32 - STREAM_ACCUMULATOR_MIN_32  \
  |  |  ------------------
  |  |  |  | 1363|      0|#define ZSTD_WINDOWLOG_MAX_32    30
  |  |  ------------------
  |  |                       ? ZSTD_WINDOWLOG_MAX_32 - STREAM_ACCUMULATOR_MIN_32  \
  |  |  ------------------
  |  |  |  |   43|      0|#define STREAM_ACCUMULATOR_MIN_32  25
  |  |  ------------------
  |  | 1256|      0|        : 0)
  ------------------
  |  Branch (1435:13): [True: 0, False: 16.9k]
  |  Branch (1435:29): [True: 0, False: 0]
  ------------------
 1436|      0|            BIT_reloadDStream(&seqState->DStream);
 1437|  16.9k|        if (MEM_64bits() && UNLIKELY(totalBits >= STREAM_ACCUMULATOR_MIN_64-(LLFSELog+MLFSELog+OffFSELog)))
  ------------------
  |  |  196|  16.9k|#define UNLIKELY(x) (__builtin_expect((x), 0))
  |  |  ------------------
  |  |  |  Branch (196:21): [True: 0, False: 16.9k]
  |  |  ------------------
  ------------------
  |  Branch (1437:13): [True: 16.9k, False: 0]
  ------------------
 1438|      0|            BIT_reloadDStream(&seqState->DStream);
 1439|       |        /* Ensure there are enough bits to read the rest of data in 64-bit mode. */
 1440|  16.9k|        ZSTD_STATIC_ASSERT(16+LLFSELog+MLFSELog+OffFSELog < STREAM_ACCUMULATOR_MIN_64);
  ------------------
  |  |   43|  16.9k|#define ZSTD_STATIC_ASSERT(c) DEBUG_STATIC_ASSERT(c)
  |  |  ------------------
  |  |  |  |   39|  16.9k|#define DEBUG_STATIC_ASSERT(c) (void)sizeof(char[(c) ? 1 : -1])
  |  |  ------------------
  ------------------
 1441|       |
 1442|  16.9k|        if (llBits > 0)
  ------------------
  |  Branch (1442:13): [True: 3.32k, False: 13.6k]
  ------------------
 1443|  3.32k|            seq.litLength += BIT_readBitsFast(&seqState->DStream, llBits/*>0*/);
 1444|       |
 1445|  16.9k|        if (MEM_32bits())
  ------------------
  |  Branch (1445:13): [True: 0, False: 16.9k]
  ------------------
 1446|      0|            BIT_reloadDStream(&seqState->DStream);
 1447|       |
 1448|  16.9k|        DEBUGLOG(6, "seq: litL=%u, matchL=%u, offset=%u",
  ------------------
  |  |  104|  16.9k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 16.9k]
  |  |  ------------------
  ------------------
 1449|  16.9k|                    (U32)seq.litLength, (U32)seq.matchLength, (U32)seq.offset);
 1450|       |
 1451|  16.9k|        if (!isLastSeq) {
  ------------------
  |  Branch (1451:13): [True: 13.1k, False: 3.80k]
  ------------------
 1452|       |            /* Don't update FSE state for last sequence. */
 1453|  13.1k|            ZSTD_updateFseStateWithDInfo(&seqState->stateLL, &seqState->DStream,
 1454|  13.1k|                                         llDInfo->nextState, llDInfo->nbBits);    /* <=  9 bits */
 1455|  13.1k|            ZSTD_updateFseStateWithDInfo(&seqState->stateML, &seqState->DStream,
 1456|  13.1k|                                         mlDInfo->nextState, mlDInfo->nbBits);    /* <=  9 bits */
 1457|  13.1k|            if (MEM_32bits()) BIT_reloadDStream(&seqState->DStream);    /* <= 18 bits */
  ------------------
  |  Branch (1457:17): [True: 0, False: 13.1k]
  ------------------
 1458|  13.1k|            ZSTD_updateFseStateWithDInfo(&seqState->stateOffb, &seqState->DStream,
 1459|  13.1k|                                         ofDInfo->nextState, ofDInfo->nbBits);    /* <=  8 bits */
 1460|  13.1k|            BIT_reloadDStream(&seqState->DStream);
 1461|  13.1k|        }
 1462|  16.9k|    }
 1463|  16.9k|#endif  /* defined(__aarch64__) */
 1464|       |
 1465|  16.9k|    return seq;
 1466|  16.9k|}
zstd_decompress_block.c:ZSTD_updateFseStateWithDInfo:
 1243|  39.4k|{
 1244|  39.4k|    size_t const lowBits = BIT_readBits(bitD, nbBits);
 1245|  39.4k|    DStatePtr->state = nextState + lowBits;
 1246|  39.4k|}
zstd_decompress_block.c:ZSTD_execSequence:
 1043|  16.9k|{
 1044|  16.9k|    BYTE* const oLitEnd = op + sequence.litLength;
 1045|  16.9k|    size_t const sequenceLength = sequence.litLength + sequence.matchLength;
 1046|  16.9k|    BYTE* const oMatchEnd = op + sequenceLength;   /* risk : address space overflow (32-bits) */
 1047|  16.9k|    BYTE* const oend_w = oend - WILDCOPY_OVERLENGTH;   /* risk : address space underflow on oend=NULL */
  ------------------
  |  |  201|  16.9k|#define WILDCOPY_OVERLENGTH 32
  ------------------
 1048|  16.9k|    const BYTE* const iLitEnd = *litPtr + sequence.litLength;
 1049|  16.9k|    const BYTE* match = oLitEnd - sequence.offset;
 1050|       |
 1051|  16.9k|    assert(op != NULL /* Precondition */);
  ------------------
  |  |   70|  16.9k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1052|  16.9k|    assert(oend_w < oend /* No underflow */);
  ------------------
  |  |   70|  16.9k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1053|       |
 1054|       |#if defined(__aarch64__)
 1055|       |    /* prefetch sequence starting from match that will be used for copy later */
 1056|       |    PREFETCH_L1(match);
 1057|       |#endif
 1058|       |    /* Handle edge cases in a slow path:
 1059|       |     *   - Read beyond end of literals
 1060|       |     *   - Match end is within WILDCOPY_OVERLIMIT of oend
 1061|       |     *   - 32-bit mode and the match length overflows
 1062|       |     */
 1063|  16.9k|    if (UNLIKELY(
  ------------------
  |  |  196|  74.0k|#define UNLIKELY(x) (__builtin_expect((x), 0))
  |  |  ------------------
  |  |  |  Branch (196:21): [True: 5.34k, False: 11.5k]
  |  |  |  Branch (196:40): [True: 9, False: 16.9k]
  |  |  |  Branch (196:40): [True: 5.33k, False: 11.5k]
  |  |  |  Branch (196:40): [True: 0, False: 11.5k]
  |  |  |  Branch (196:40): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1064|  16.9k|        iLitEnd > litLimit ||
 1065|  16.9k|        oMatchEnd > oend_w ||
 1066|  16.9k|        (MEM_32bits() && (size_t)(oend - op) < sequenceLength + WILDCOPY_OVERLENGTH)))
 1067|  5.34k|        return ZSTD_execSequenceEnd(op, oend, sequence, litPtr, litLimit, prefixStart, virtualStart, dictEnd);
 1068|       |
 1069|       |    /* Assumptions (everything else goes into ZSTD_execSequenceEnd()) */
 1070|  11.5k|    assert(op <= oLitEnd /* No overflow */);
  ------------------
  |  |   70|  11.5k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1071|  11.5k|    assert(oLitEnd < oMatchEnd /* Non-zero match & no overflow */);
  ------------------
  |  |   70|  11.5k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1072|  11.5k|    assert(oMatchEnd <= oend /* No underflow */);
  ------------------
  |  |   70|  11.5k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1073|  11.5k|    assert(iLitEnd <= litLimit /* Literal length is in bounds */);
  ------------------
  |  |   70|  11.5k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1074|  11.5k|    assert(oLitEnd <= oend_w /* Can wildcopy literals */);
  ------------------
  |  |   70|  11.5k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1075|  11.5k|    assert(oMatchEnd <= oend_w /* Can wildcopy matches */);
  ------------------
  |  |   70|  11.5k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1076|       |
 1077|       |    /* Copy Literals:
 1078|       |     * Split out litLength <= 16 since it is nearly always true. +1.6% on gcc-9.
 1079|       |     * We likely don't need the full 32-byte wildcopy.
 1080|       |     */
 1081|  11.5k|    assert(WILDCOPY_OVERLENGTH >= 16);
  ------------------
  |  |   70|  11.5k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1082|  11.5k|    ZSTD_copy16(op, (*litPtr));
 1083|  11.5k|    if (UNLIKELY(sequence.litLength > 16)) {
  ------------------
  |  |  196|  11.5k|#define UNLIKELY(x) (__builtin_expect((x), 0))
  |  |  ------------------
  |  |  |  Branch (196:21): [True: 2.35k, False: 9.24k]
  |  |  ------------------
  ------------------
 1084|  2.35k|        ZSTD_wildcopy(op + 16, (*litPtr) + 16, sequence.litLength - 16, ZSTD_no_overlap);
 1085|  2.35k|    }
 1086|  11.5k|    op = oLitEnd;
 1087|  11.5k|    *litPtr = iLitEnd;   /* update for next sequence */
 1088|       |
 1089|       |    /* Copy Match */
 1090|  11.5k|    if (sequence.offset > (size_t)(oLitEnd - prefixStart)) {
  ------------------
  |  Branch (1090:9): [True: 2, False: 11.5k]
  ------------------
 1091|       |        /* offset beyond prefix -> go into extDict */
 1092|      2|        RETURN_ERROR_IF(UNLIKELY(sequence.offset > (size_t)(oLitEnd - virtualStart)), corruption_detected, "");
  ------------------
  |  |  114|      2|    do {                                                                       \
  |  |  115|      2|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 2, False: 0]
  |  |  ------------------
  |  |  116|      2|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|      2|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 2]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|      2|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|      2|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|      2|    do {                                           \
  |  |  |  |   99|      2|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 2]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      2|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 2]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|      2|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|      2|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 2]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|      2|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|      2|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 2]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|      2|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|      2|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|      2|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      2|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|      2|        }                                                                      \
  |  |  123|      2|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1093|      0|        match = dictEnd + (match - prefixStart);
 1094|      0|        if (match + sequence.matchLength <= dictEnd) {
  ------------------
  |  Branch (1094:13): [True: 0, False: 0]
  ------------------
 1095|      0|            ZSTD_memmove(oLitEnd, match, sequence.matchLength);
  ------------------
  |  |   45|      0|# define ZSTD_memmove(d,s,l) __builtin_memmove((d),(s),(l))
  ------------------
 1096|      0|            return sequenceLength;
 1097|      0|        }
 1098|       |        /* span extDict & currentPrefixSegment */
 1099|      0|        {   size_t const length1 = (size_t)(dictEnd - match);
 1100|      0|            ZSTD_memmove(oLitEnd, match, length1);
  ------------------
  |  |   45|      0|# define ZSTD_memmove(d,s,l) __builtin_memmove((d),(s),(l))
  ------------------
 1101|      0|            op = oLitEnd + length1;
 1102|      0|            sequence.matchLength -= length1;
 1103|      0|            match = prefixStart;
 1104|      0|        }
 1105|      0|    }
 1106|       |    /* Match within prefix of 1 or more bytes */
 1107|  11.5k|    assert(op <= oMatchEnd);
  ------------------
  |  |   70|  11.5k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1108|  11.5k|    assert(oMatchEnd <= oend_w);
  ------------------
  |  |   70|  11.5k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1109|  11.5k|    assert(match >= prefixStart);
  ------------------
  |  |   70|  11.5k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1110|  11.5k|    assert(sequence.matchLength >= 1);
  ------------------
  |  |   70|  11.5k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1111|       |
 1112|       |    /* Nearly all offsets are >= WILDCOPY_VECLEN bytes, which means we can use wildcopy
 1113|       |     * without overlap checking.
 1114|       |     */
 1115|  11.5k|    if (LIKELY(sequence.offset >= WILDCOPY_VECLEN)) {
  ------------------
  |  |  195|  11.5k|#define LIKELY(x) (__builtin_expect((x), 1))
  |  |  ------------------
  |  |  |  Branch (195:19): [True: 5.51k, False: 6.07k]
  |  |  ------------------
  ------------------
 1116|       |        /* We bet on a full wildcopy for matches, since we expect matches to be
 1117|       |         * longer than literals (in general). In silesia, ~10% of matches are longer
 1118|       |         * than 16 bytes.
 1119|       |         */
 1120|  5.51k|        ZSTD_wildcopy(op, match, sequence.matchLength, ZSTD_no_overlap);
 1121|  5.51k|        return sequenceLength;
 1122|  5.51k|    }
 1123|  6.07k|    assert(sequence.offset < WILDCOPY_VECLEN);
  ------------------
  |  |   70|  6.07k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1124|       |
 1125|       |    /* Copy 8 bytes and spread the offset to be >= 8. */
 1126|  6.07k|    ZSTD_overlapCopy8(&op, &match, sequence.offset);
 1127|       |
 1128|       |    /* If the match length is > 8 bytes, then continue with the wildcopy. */
 1129|  6.07k|    if (sequence.matchLength > 8) {
  ------------------
  |  Branch (1129:9): [True: 2.68k, False: 3.39k]
  ------------------
 1130|  2.68k|        assert(op < oMatchEnd);
  ------------------
  |  |   70|  2.68k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1131|  2.68k|        ZSTD_wildcopy(op, match, sequence.matchLength - 8, ZSTD_overlap_src_before_dst);
 1132|  2.68k|    }
 1133|  6.07k|    return sequenceLength;
 1134|  11.5k|}
zstd_decompress_block.c:ZSTD_execSequenceEnd:
  946|  5.34k|{
  947|  5.34k|    BYTE* const oLitEnd = op + sequence.litLength;
  948|  5.34k|    size_t const sequenceLength = sequence.litLength + sequence.matchLength;
  949|  5.34k|    const BYTE* const iLitEnd = *litPtr + sequence.litLength;
  950|  5.34k|    const BYTE* match = oLitEnd - sequence.offset;
  951|  5.34k|    BYTE* const oend_w = oend - WILDCOPY_OVERLENGTH;
  ------------------
  |  |  201|  5.34k|#define WILDCOPY_OVERLENGTH 32
  ------------------
  952|       |
  953|       |    /* bounds checks : careful of address space overflow in 32-bit mode */
  954|  5.34k|    RETURN_ERROR_IF(sequenceLength > (size_t)(oend - op), dstSize_tooSmall, "last match must fit within dstBuffer");
  ------------------
  |  |  114|  5.34k|    do {                                                                       \
  |  |  115|  5.34k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 1, False: 5.34k]
  |  |  ------------------
  |  |  116|      1|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|      1|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|      1|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|      1|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|      1|    do {                                           \
  |  |  |  |   99|      1|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 1]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      1|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|      1|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|      1|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|      1|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|      1|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|      1|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|      1|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|      1|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      1|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|      1|        }                                                                      \
  |  |  123|  5.34k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 5.34k]
  |  |  ------------------
  ------------------
  955|  5.34k|    RETURN_ERROR_IF(sequence.litLength > (size_t)(litLimit - *litPtr), corruption_detected, "try to read beyond literal buffer");
  ------------------
  |  |  114|  5.34k|    do {                                                                       \
  |  |  115|  5.34k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 8, False: 5.33k]
  |  |  ------------------
  |  |  116|      8|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|      8|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 8]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|      8|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|      8|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|      8|    do {                                           \
  |  |  |  |   99|      8|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 8]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      8|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 8]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|      8|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|      8|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 8]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|      8|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|      8|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 8]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|      8|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|      8|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|      8|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      8|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|      8|        }                                                                      \
  |  |  123|  5.34k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 5.33k]
  |  |  ------------------
  ------------------
  956|  5.33k|    assert(op < op + sequenceLength);
  ------------------
  |  |   70|  5.33k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  957|  5.33k|    assert(oLitEnd < op + sequenceLength);
  ------------------
  |  |   70|  5.33k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  958|       |
  959|       |    /* copy literals */
  960|  5.33k|    ZSTD_safecopy(op, oend_w, *litPtr, sequence.litLength, ZSTD_no_overlap);
  961|  5.33k|    op = oLitEnd;
  962|  5.33k|    *litPtr = iLitEnd;
  963|       |
  964|       |    /* copy Match */
  965|  5.33k|    if (sequence.offset > (size_t)(oLitEnd - prefixStart)) {
  ------------------
  |  Branch (965:9): [True: 0, False: 5.33k]
  ------------------
  966|       |        /* offset beyond prefix */
  967|      0|        RETURN_ERROR_IF(sequence.offset > (size_t)(oLitEnd - virtualStart), corruption_detected, "");
  ------------------
  |  |  114|      0|    do {                                                                       \
  |  |  115|      0|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 0, False: 0]
  |  |  ------------------
  |  |  116|      0|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|      0|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|      0|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|      0|    do {                                           \
  |  |  |  |   99|      0|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|      0|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|      0|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|      0|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|      0|        }                                                                      \
  |  |  123|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  968|      0|        match = dictEnd - (prefixStart - match);
  969|      0|        if (match + sequence.matchLength <= dictEnd) {
  ------------------
  |  Branch (969:13): [True: 0, False: 0]
  ------------------
  970|      0|            ZSTD_memmove(oLitEnd, match, sequence.matchLength);
  ------------------
  |  |   45|      0|# define ZSTD_memmove(d,s,l) __builtin_memmove((d),(s),(l))
  ------------------
  971|      0|            return sequenceLength;
  972|      0|        }
  973|       |        /* span extDict & currentPrefixSegment */
  974|      0|        {   size_t const length1 = (size_t)(dictEnd - match);
  975|      0|            ZSTD_memmove(oLitEnd, match, length1);
  ------------------
  |  |   45|      0|# define ZSTD_memmove(d,s,l) __builtin_memmove((d),(s),(l))
  ------------------
  976|      0|            op = oLitEnd + length1;
  977|      0|            sequence.matchLength -= length1;
  978|      0|            match = prefixStart;
  979|      0|        }
  980|      0|    }
  981|  5.33k|    ZSTD_safecopy(op, oend_w, match, sequence.matchLength, ZSTD_overlap_src_before_dst);
  982|  5.33k|    return sequenceLength;
  983|  5.33k|}
zstd_decompress_block.c:ZSTD_safecopy:
  867|  10.6k|{
  868|  10.6k|    ptrdiff_t const diff = op - ip;
  869|  10.6k|    BYTE* const oend = op + length;
  870|       |
  871|  10.6k|    assert((ovtype == ZSTD_no_overlap && (diff <= -8 || diff >= 8 || op >= oend_w)) ||
  ------------------
  |  |   70|  10.6k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  872|  10.6k|           (ovtype == ZSTD_overlap_src_before_dst && diff >= 0));
  873|       |
  874|  10.6k|    if (length < 8) {
  ------------------
  |  Branch (874:9): [True: 5.99k, False: 4.67k]
  ------------------
  875|       |        /* Handle short lengths. */
  876|  22.8k|        while (op < oend) *op++ = *ip++;
  ------------------
  |  Branch (876:16): [True: 16.8k, False: 5.99k]
  ------------------
  877|  5.99k|        return;
  878|  5.99k|    }
  879|  4.67k|    if (ovtype == ZSTD_overlap_src_before_dst) {
  ------------------
  |  Branch (879:9): [True: 3.27k, False: 1.40k]
  ------------------
  880|       |        /* Copy 8 bytes and ensure the offset >= 8 when there can be overlap. */
  881|  3.27k|        assert(length >= 8);
  ------------------
  |  |   70|  3.27k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  882|  3.27k|        assert(diff > 0);
  ------------------
  |  |   70|  3.27k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  883|  3.27k|        ZSTD_overlapCopy8(&op, &ip, (size_t)diff);
  884|  3.27k|        length -= 8;
  885|  3.27k|        assert(op - ip >= 8);
  ------------------
  |  |   70|  3.27k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  886|  3.27k|        assert(op <= oend);
  ------------------
  |  |   70|  3.27k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  887|  3.27k|    }
  888|       |
  889|  4.67k|    if (oend <= oend_w) {
  ------------------
  |  Branch (889:9): [True: 306, False: 4.37k]
  ------------------
  890|       |        /* No risk of overwrite. */
  891|    306|        ZSTD_wildcopy(op, ip, length, ovtype);
  892|    306|        return;
  893|    306|    }
  894|  4.37k|    if (op <= oend_w) {
  ------------------
  |  Branch (894:9): [True: 1.96k, False: 2.40k]
  ------------------
  895|       |        /* Wildcopy until we get close to the end. */
  896|  1.96k|        assert(oend > oend_w);
  ------------------
  |  |   70|  1.96k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  897|  1.96k|        ZSTD_wildcopy(op, ip, (size_t)(oend_w - op), ovtype);
  898|  1.96k|        ip += oend_w - op;
  899|  1.96k|        op += oend_w - op;
  900|  1.96k|    }
  901|       |    /* Handle the leftovers. */
  902|  55.5k|    while (op < oend) *op++ = *ip++;
  ------------------
  |  Branch (902:12): [True: 51.1k, False: 4.37k]
  ------------------
  903|  4.37k|}
zstd_decompress_block.c:ZSTD_overlapCopy8:
  832|  9.34k|{
  833|  9.34k|    assert(*ip <= *op);
  ------------------
  |  |   70|  9.34k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  834|  9.34k|    if (offset < 8) {
  ------------------
  |  Branch (834:9): [True: 5.23k, False: 4.11k]
  ------------------
  835|       |        /* close range match, overlap */
  836|  5.23k|        static const U32 dec32table[] = { 0, 1, 2, 1, 4, 4, 4, 4 };   /* added */
  837|  5.23k|        static const int dec64table[] = { 8, 8, 8, 7, 8, 9,10,11 };   /* subtracted */
  838|  5.23k|        int const sub2 = dec64table[offset];
  839|  5.23k|        (*op)[0] = (*ip)[0];
  840|  5.23k|        (*op)[1] = (*ip)[1];
  841|  5.23k|        (*op)[2] = (*ip)[2];
  842|  5.23k|        (*op)[3] = (*ip)[3];
  843|  5.23k|        *ip += dec32table[offset];
  844|  5.23k|        ZSTD_copy4(*op+4, *ip);
  845|  5.23k|        *ip -= sub2;
  846|  5.23k|    } else {
  847|  4.11k|        ZSTD_copy8(*op, *ip);
  848|  4.11k|    }
  849|  9.34k|    *ip += 8;
  850|  9.34k|    *op += 8;
  851|  9.34k|    assert(*op - *ip >= 8);
  ------------------
  |  |   70|  9.34k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  852|  9.34k|}
zstd_decompress_block.c:ZSTD_copy4:
   47|  5.23k|static void ZSTD_copy4(void* dst, const void* src) { ZSTD_memcpy(dst, src, 4); }
  ------------------
  |  |   44|  5.23k|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  ------------------
zstd_decompress_block.c:ZSTD_decompressSequences:
 2074|  4.82k|{
 2075|  4.82k|    DEBUGLOG(5, "ZSTD_decompressSequences");
  ------------------
  |  |  104|  4.82k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 4.82k]
  |  |  ------------------
  ------------------
 2076|  4.82k|    if (ZSTD_USE_BMI2(ZSTD_DCtx_get_bmi2(dctx))) {
  ------------------
  |  |   36|  4.82k|#  define ZSTD_USE_BMI2(bmi2) (bmi2)
  |  |  ------------------
  |  |  |  Branch (36:31): [True: 4.82k, False: 0]
  |  |  ------------------
  ------------------
 2077|  4.82k|        return ZSTD_decompressSequences_bmi2(dctx, dst, maxDstSize, seqStart, seqSize, nbSeq, isLongOffset);
 2078|  4.82k|    }
 2079|      0|    return ZSTD_decompressSequences_default(dctx, dst, maxDstSize, seqStart, seqSize, nbSeq, isLongOffset);
 2080|  4.82k|}
zstd_decompress_block.c:ZSTD_decompressSequences_bmi2:
 2032|  4.82k|{
 2033|  4.82k|    return ZSTD_decompressSequences_body(dctx, dst, maxDstSize, seqStart, seqSize, nbSeq, isLongOffset);
 2034|  4.82k|}
zstd_decompress_block.c:ZSTD_decompressSequences_body:
 1738|  4.82k|{
 1739|  4.82k|    BYTE* const ostart = (BYTE*)dst;
 1740|  4.82k|    BYTE* const oend = (dctx->litBufferLocation == ZSTD_not_in_dst) ?
  ------------------
  |  Branch (1740:24): [True: 4.78k, False: 37]
  ------------------
 1741|  4.78k|                        (BYTE*)ZSTD_maybeNullPtrAdd(ostart, (ptrdiff_t)maxDstSize) :
 1742|  4.82k|                        dctx->litBuffer;
 1743|  4.82k|    BYTE* op = ostart;
 1744|  4.82k|    const BYTE* litPtr = dctx->litPtr;
 1745|  4.82k|    const BYTE* const litEnd = litPtr + dctx->litSize;
 1746|  4.82k|    const BYTE* const prefixStart = (const BYTE*)(dctx->prefixStart);
 1747|  4.82k|    const BYTE* const vBase = (const BYTE*)(dctx->virtualStart);
 1748|  4.82k|    const BYTE* const dictEnd = (const BYTE*)(dctx->dictEnd);
 1749|  4.82k|    DEBUGLOG(5, "ZSTD_decompressSequences_body: nbSeq = %d", nbSeq);
  ------------------
  |  |  104|  4.82k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 4.82k]
  |  |  ------------------
  ------------------
 1750|       |
 1751|       |    /* Regen sequences */
 1752|  4.82k|    if (nbSeq) {
  ------------------
  |  Branch (1752:9): [True: 3.84k, False: 979]
  ------------------
 1753|  3.84k|        seqState_t seqState;
 1754|  3.84k|        dctx->fseEntropy = 1;
 1755|  15.3k|        { U32 i; for (i = 0; i < ZSTD_REP_NUM; i++) seqState.prevOffset[i] = dctx->entropy.rep[i]; }
  ------------------
  |  |   64|  15.3k|#define ZSTD_REP_NUM      3                 /* number of repcodes */
  ------------------
  |  Branch (1755:30): [True: 11.5k, False: 3.84k]
  ------------------
 1756|  3.84k|        RETURN_ERROR_IF(
  ------------------
  |  |  114|  3.84k|    do {                                                                       \
  |  |  115|  3.84k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 27, False: 3.81k]
  |  |  ------------------
  |  |  116|     27|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|     27|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 27]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|     27|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|     27|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|     27|    do {                                           \
  |  |  |  |   99|     27|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 27]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|     27|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 27]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|     27|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|     27|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 27]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|     27|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|     27|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 27]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|     27|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|     27|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|     27|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|     27|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|     27|        }                                                                      \
  |  |  123|  3.84k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 3.81k]
  |  |  ------------------
  ------------------
 1757|  3.84k|            ERR_isError(BIT_initDStream(&seqState.DStream, seqStart, seqSize)),
 1758|  3.84k|            corruption_detected, "");
 1759|  3.81k|        ZSTD_initFseState(&seqState.stateLL, &seqState.DStream, dctx->LLTptr);
 1760|  3.81k|        ZSTD_initFseState(&seqState.stateOffb, &seqState.DStream, dctx->OFTptr);
 1761|  3.81k|        ZSTD_initFseState(&seqState.stateML, &seqState.DStream, dctx->MLTptr);
 1762|  3.81k|        assert(dst != NULL);
  ------------------
  |  |   70|  3.81k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1763|       |
 1764|  3.81k|#if defined(__GNUC__) && defined(__x86_64__)
 1765|  3.81k|            __asm__(".p2align 6");
 1766|  3.81k|            __asm__("nop");
 1767|       |#  if __GNUC__ >= 7
 1768|       |            __asm__(".p2align 5");
 1769|       |            __asm__("nop");
 1770|       |            __asm__(".p2align 3");
 1771|       |#  else
 1772|  3.81k|            __asm__(".p2align 4");
 1773|  3.81k|            __asm__("nop");
 1774|  3.81k|            __asm__(".p2align 3");
 1775|  3.81k|#  endif
 1776|  3.81k|#endif
 1777|       |
 1778|  20.7k|        for ( ; nbSeq ; nbSeq--) {
  ------------------
  |  Branch (1778:17): [True: 16.9k, False: 3.80k]
  ------------------
 1779|  16.9k|            seq_t const sequence = ZSTD_decodeSequence(&seqState, isLongOffset, nbSeq==1);
 1780|  16.9k|            size_t const oneSeqSize = ZSTD_execSequence(op, oend, sequence, &litPtr, litEnd, prefixStart, vBase, dictEnd);
 1781|       |#if defined(FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION) && defined(FUZZING_ASSERT_VALID_SEQUENCE)
 1782|       |            assert(!ZSTD_isError(oneSeqSize));
 1783|       |            ZSTD_assertValidSequence(dctx, op, oend, sequence, prefixStart, vBase);
 1784|       |#endif
 1785|  16.9k|            if (UNLIKELY(ZSTD_isError(oneSeqSize)))
  ------------------
  |  |  196|  16.9k|#define UNLIKELY(x) (__builtin_expect((x), 0))
  |  |  ------------------
  |  |  |  Branch (196:21): [True: 11, False: 16.9k]
  |  |  ------------------
  ------------------
 1786|     11|                return oneSeqSize;
 1787|  16.9k|            DEBUGLOG(6, "regenerated sequence size : %u", (U32)oneSeqSize);
  ------------------
  |  |  104|  16.9k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 16.9k]
  |  |  ------------------
  ------------------
 1788|  16.9k|            op += oneSeqSize;
 1789|  16.9k|        }
 1790|       |
 1791|       |        /* check if reached exact end */
 1792|  3.80k|        assert(nbSeq == 0);
  ------------------
  |  |   70|  3.80k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1793|  3.80k|        RETURN_ERROR_IF(!BIT_endOfDStream(&seqState.DStream), corruption_detected, "");
  ------------------
  |  |  114|  3.80k|    do {                                                                       \
  |  |  115|  3.80k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 1, False: 3.80k]
  |  |  ------------------
  |  |  116|      1|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|      1|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|      1|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|      1|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|      1|    do {                                           \
  |  |  |  |   99|      1|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 1]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      1|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|      1|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|      1|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|      1|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|      1|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|      1|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|      1|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|      1|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      1|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|      1|        }                                                                      \
  |  |  123|  3.80k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 3.80k]
  |  |  ------------------
  ------------------
 1794|       |        /* save reps for next block */
 1795|  15.2k|        { U32 i; for (i=0; i<ZSTD_REP_NUM; i++) dctx->entropy.rep[i] = (U32)(seqState.prevOffset[i]); }
  ------------------
  |  |   64|  15.2k|#define ZSTD_REP_NUM      3                 /* number of repcodes */
  ------------------
  |  Branch (1795:28): [True: 11.4k, False: 3.80k]
  ------------------
 1796|  3.80k|    }
 1797|       |
 1798|       |    /* last literal segment */
 1799|  4.78k|    {   size_t const lastLLSize = (size_t)(litEnd - litPtr);
 1800|  4.78k|        DEBUGLOG(6, "copy last literals : %u", (U32)lastLLSize);
  ------------------
  |  |  104|  4.78k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 4.78k]
  |  |  ------------------
  ------------------
 1801|  4.78k|        RETURN_ERROR_IF(lastLLSize > (size_t)(oend-op), dstSize_tooSmall, "");
  ------------------
  |  |  114|  4.78k|    do {                                                                       \
  |  |  115|  4.78k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 0, False: 4.78k]
  |  |  ------------------
  |  |  116|      0|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|      0|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|      0|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|      0|    do {                                           \
  |  |  |  |   99|      0|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|      0|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|      0|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|      0|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|      0|        }                                                                      \
  |  |  123|  4.78k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 4.78k]
  |  |  ------------------
  ------------------
 1802|  4.78k|        if (op != NULL) {
  ------------------
  |  Branch (1802:13): [True: 4.78k, False: 0]
  ------------------
 1803|  4.78k|            ZSTD_memcpy(op, litPtr, lastLLSize);
  ------------------
  |  |   44|  4.78k|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  ------------------
 1804|  4.78k|            op += lastLLSize;
 1805|  4.78k|    }   }
 1806|       |
 1807|  4.78k|    DEBUGLOG(6, "decoded block of size %u bytes", (U32)(op - ostart));
  ------------------
  |  |  104|  4.78k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 4.78k]
  |  |  ------------------
  ------------------
 1808|  4.78k|    return (size_t)(op - ostart);
 1809|  4.78k|}

zstd_decompress_block.c:ZSTD_DCtx_get_bmi2:
  228|  19.1k|MEM_STATIC int ZSTD_DCtx_get_bmi2(const struct ZSTD_DCtx_s *dctx) {
  229|  19.1k|#if DYNAMIC_BMI2
  230|  19.1k|    return dctx->bmi2;
  231|       |#else
  232|       |    (void)dctx;
  233|       |    return 0;
  234|       |#endif
  235|  19.1k|}

b2nd_serialize_meta:
   43|     70|                        uint8_t **smeta) {
   44|     70|  if (dtype == NULL) {
  ------------------
  |  Branch (44:7): [True: 0, False: 70]
  ------------------
   45|      0|    dtype = B2ND_DEFAULT_DTYPE;
  ------------------
  |  |   61|      0|#define B2ND_DEFAULT_DTYPE "|u1"
  ------------------
   46|      0|  }
   47|       |  // dtype checks
   48|     70|  if (dtype_format < 0) {
  ------------------
  |  Branch (48:7): [True: 0, False: 70]
  ------------------
   49|      0|    BLOSC_TRACE_ERROR("dtype_format cannot be negative");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
   50|      0|    BLOSC_ERROR(BLOSC2_ERROR_FAILURE);
  ------------------
  |  |  111|      0|    do {                                            \
  |  |  112|      0|        int rc_ = (rc);                             \
  |  |  113|      0|        if (rc_ < BLOSC2_ERROR_SUCCESS) {           \
  |  |  ------------------
  |  |  |  Branch (113:13): [True: 0, False: 0]
  |  |  ------------------
  |  |  114|      0|            char *error_msg = print_error(rc_);     \
  |  |  115|      0|            BLOSC_TRACE_ERROR("%s", error_msg);     \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  116|      0|            return rc_;                             \
  |  |  117|      0|        }                                           \
  |  |  118|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (118:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
   51|      0|  }
   52|     70|  size_t dtype_len0 = strlen(dtype);
   53|     70|  if (dtype_len0 > INT32_MAX) {
  ------------------
  |  Branch (53:7): [True: 0, False: 70]
  ------------------
   54|      0|    BLOSC_TRACE_ERROR("dtype is too large (len > %d)", INT32_MAX);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   54|      0|    BLOSC_TRACE_ERROR("dtype is too large (len > %d)", INT32_MAX);
  |  |  |  |  ------------------
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
   55|      0|    BLOSC_ERROR(BLOSC2_ERROR_FAILURE);
  ------------------
  |  |  111|      0|    do {                                            \
  |  |  112|      0|        int rc_ = (rc);                             \
  |  |  113|      0|        if (rc_ < BLOSC2_ERROR_SUCCESS) {           \
  |  |  ------------------
  |  |  |  Branch (113:13): [True: 0, False: 0]
  |  |  ------------------
  |  |  114|      0|            char *error_msg = print_error(rc_);     \
  |  |  115|      0|            BLOSC_TRACE_ERROR("%s", error_msg);     \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  116|      0|            return rc_;                             \
  |  |  117|      0|        }                                           \
  |  |  118|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (118:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
   56|      0|  }
   57|     70|  const int32_t dtype_len = (int32_t) dtype_len0;
   58|       |  // Allocate space for b2nd metalayer
   59|     70|  int32_t max_smeta_len = (int32_t) (1 + 1 + 1 + (1 + ndim * (1 + sizeof(int64_t))) +
   60|     70|                                     (1 + ndim * (1 + sizeof(int32_t))) + (1 + ndim * (1 + sizeof(int32_t))) +
   61|     70|                                     1 + 1 + sizeof(int32_t) + dtype_len);
   62|     70|  *smeta = malloc((size_t) max_smeta_len);
   63|     70|  BLOSC_ERROR_NULL(*smeta, BLOSC2_ERROR_MEMORY_ALLOC);
  ------------------
  |  |  104|     70|    do {                                            \
  |  |  105|     70|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 70]
  |  |  ------------------
  |  |  106|      0|            BLOSC_TRACE_ERROR("Pointer is null");   \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  107|      0|            return (rc);                            \
  |  |  108|      0|        }                                           \
  |  |  109|     70|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 70]
  |  |  ------------------
  ------------------
   64|     70|  uint8_t *pmeta = *smeta;
   65|       |
   66|       |  // Build an array with 7 entries (version, ndim, shape, chunkshape, blockshape, dtype_format, dtype)
   67|     70|  *pmeta++ = 0x90 + 7;
   68|       |
   69|       |  // version entry
   70|     70|  *pmeta++ = B2ND_METALAYER_VERSION;  // positive fixnum (7-bit positive integer)
  ------------------
  |  |   47|     70|#define B2ND_METALAYER_VERSION 0
  ------------------
   71|       |
   72|       |  // ndim entry
   73|     70|  *pmeta++ = (uint8_t) ndim;  // positive fixnum (7-bit positive integer)
   74|       |
   75|       |  // shape entry
   76|     70|  *pmeta++ = (uint8_t) (0x90) + ndim;  // fix array with ndim elements
   77|    323|  for (uint8_t i = 0; i < ndim; i++) {
  ------------------
  |  Branch (77:23): [True: 253, False: 70]
  ------------------
   78|    253|    *pmeta++ = 0xd3;  // int64
   79|    253|    swap_store(pmeta, shape + i, sizeof(int64_t));
   80|    253|    pmeta += sizeof(int64_t);
   81|    253|  }
   82|       |
   83|       |  // chunkshape entry
   84|     70|  *pmeta++ = (uint8_t) (0x90) + ndim;  // fix array with ndim elements
   85|    323|  for (uint8_t i = 0; i < ndim; i++) {
  ------------------
  |  Branch (85:23): [True: 253, False: 70]
  ------------------
   86|    253|    *pmeta++ = 0xd2;  // int32
   87|    253|    swap_store(pmeta, chunkshape + i, sizeof(int32_t));
   88|    253|    pmeta += sizeof(int32_t);
   89|    253|  }
   90|       |
   91|       |  // blockshape entry
   92|     70|  *pmeta++ = (uint8_t) (0x90) + ndim;  // fix array with ndim elements
   93|    323|  for (uint8_t i = 0; i < ndim; i++) {
  ------------------
  |  Branch (93:23): [True: 253, False: 70]
  ------------------
   94|    253|    *pmeta++ = 0xd2;  // int32
   95|    253|    swap_store(pmeta, blockshape + i, sizeof(int32_t));
   96|    253|    pmeta += sizeof(int32_t);
   97|    253|  }
   98|       |
   99|       |  // dtype entry
  100|     70|  *pmeta++ = dtype_format;  // positive fixint (7-bit positive integer)
  101|     70|  *pmeta++ = (uint8_t) (0xdb);  // str with up to 2^31 elements
  102|     70|  swap_store(pmeta, &dtype_len, sizeof(int32_t));
  103|     70|  pmeta += sizeof(int32_t);
  104|     70|  memcpy(pmeta, dtype, dtype_len);
  105|     70|  pmeta += dtype_len;
  106|       |
  107|     70|  int32_t slen = (int32_t) (pmeta - *smeta);
  108|     70|  if (max_smeta_len != slen) {
  ------------------
  |  Branch (108:7): [True: 0, False: 70]
  ------------------
  109|      0|    BLOSC_TRACE_ERROR("meta length is inconsistent!");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  110|      0|    return BLOSC2_ERROR_FAILURE;
  111|      0|  }
  112|       |
  113|     70|  return (int)slen;
  114|     70|}
b2nd_deserialize_meta:
  118|  1.54k|                          int32_t *chunkshape, int32_t *blockshape, char **dtype, int8_t *dtype_format) {
  119|  1.54k|  return b2nd_deserialize_meta_inline(smeta, smeta_len, ndim, shape, chunkshape, blockshape, dtype, dtype_format);
  120|  1.54k|}
update_shape:
  302|    139|                 const int32_t *chunkshape, const int32_t *blockshape) {
  303|    139|  BLOSC_ERROR(update_shape_struct(array, ndim, shape, chunkshape, blockshape));
  ------------------
  |  |  111|    139|    do {                                            \
  |  |  112|    139|        int rc_ = (rc);                             \
  |  |  113|    139|        if (rc_ < BLOSC2_ERROR_SUCCESS) {           \
  |  |  ------------------
  |  |  |  Branch (113:13): [True: 0, False: 139]
  |  |  ------------------
  |  |  114|      0|            char *error_msg = print_error(rc_);     \
  |  |  115|      0|            BLOSC_TRACE_ERROR("%s", error_msg);     \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  116|      0|            return rc_;                             \
  |  |  117|      0|        }                                           \
  |  |  118|    139|    } while (0)
  |  |  ------------------
  |  |  |  Branch (118:14): [Folded, False: 139]
  |  |  ------------------
  ------------------
  304|    139|  return publish_shape_meta(array);
  305|    139|}
array_without_schunk:
  380|    139|int array_without_schunk(b2nd_context_t *ctx, b2nd_array_t **array) {
  381|       |  /* Create a b2nd_array_t buffer */
  382|    139|  (*array) = (b2nd_array_t *) malloc(sizeof(b2nd_array_t));
  383|    139|  BLOSC_ERROR_NULL(*array, BLOSC2_ERROR_MEMORY_ALLOC);
  ------------------
  |  |  104|    139|    do {                                            \
  |  |  105|    139|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 139]
  |  |  ------------------
  |  |  106|      0|            BLOSC_TRACE_ERROR("Pointer is null");   \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  107|      0|            return (rc);                            \
  |  |  108|      0|        }                                           \
  |  |  109|    139|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 139]
  |  |  ------------------
  ------------------
  384|       |
  385|    139|  (*array)->sc = NULL;
  386|    139|  (*array)->last_tick = 0;
  387|       |
  388|    139|  (*array)->ndim = ctx->ndim;
  389|    139|  int64_t *shape = ctx->shape;
  390|    139|  int32_t *chunkshape = ctx->chunkshape;
  391|    139|  int32_t *blockshape = ctx->blockshape;
  392|       |  // update_shape() rejects shapes whose products overflow, so this can fail on
  393|       |  // crafted metadata.  Hand back NULL rather than the half-built array, which
  394|       |  // would otherwise leak and leave callers with a non-NULL pointer on error.
  395|    139|  int rc = update_shape(*array, ctx->ndim, shape, chunkshape, blockshape);
  396|    139|  if (rc < 0) {
  ------------------
  |  Branch (396:7): [True: 0, False: 139]
  ------------------
  397|      0|    free(*array);
  398|      0|    *array = NULL;
  399|      0|    BLOSC_ERROR(rc);
  ------------------
  |  |  111|      0|    do {                                            \
  |  |  112|      0|        int rc_ = (rc);                             \
  |  |  113|      0|        if (rc_ < BLOSC2_ERROR_SUCCESS) {           \
  |  |  ------------------
  |  |  |  Branch (113:13): [True: 0, False: 0]
  |  |  ------------------
  |  |  114|      0|            char *error_msg = print_error(rc_);     \
  |  |  115|      0|            BLOSC_TRACE_ERROR("%s", error_msg);     \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  116|      0|            return rc_;                             \
  |  |  117|      0|        }                                           \
  |  |  118|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (118:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  400|      0|  }
  401|       |
  402|    139|  if (ctx->dtype != NULL) {
  ------------------
  |  Branch (402:7): [True: 139, False: 0]
  ------------------
  403|    139|    (*array)->dtype = malloc(strlen(ctx->dtype) + 1);
  404|    139|    strcpy((*array)->dtype, ctx->dtype);
  405|    139|  } else {
  406|      0|    (*array)->dtype = NULL;
  407|      0|  }
  408|       |
  409|    139|  (*array)->dtype_format = ctx->dtype_format;
  410|       |
  411|       |  // The partition cache (empty initially)
  412|    139|  (*array)->chunk_cache.data = NULL;
  413|    139|  (*array)->chunk_cache.nchunk = -1;  // means no valid cache yet
  414|       |
  415|    139|  return BLOSC2_ERROR_SUCCESS;
  416|    139|}
array_new:
  419|     70|int array_new(b2nd_context_t *ctx, int special_value, b2nd_array_t **array) {
  420|     70|  BLOSC_ERROR(array_without_schunk(ctx, array));
  ------------------
  |  |  111|     70|    do {                                            \
  |  |  112|     70|        int rc_ = (rc);                             \
  |  |  113|     70|        if (rc_ < BLOSC2_ERROR_SUCCESS) {           \
  |  |  ------------------
  |  |  |  Branch (113:13): [True: 0, False: 70]
  |  |  ------------------
  |  |  114|      0|            char *error_msg = print_error(rc_);     \
  |  |  115|      0|            BLOSC_TRACE_ERROR("%s", error_msg);     \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  116|      0|            return rc_;                             \
  |  |  117|      0|        }                                           \
  |  |  118|     70|    } while (0)
  |  |  ------------------
  |  |  |  Branch (118:14): [Folded, False: 70]
  |  |  ------------------
  ------------------
  421|       |
  422|     70|  int rc = BLOSC2_ERROR_FAILURE;
  423|     70|  blosc2_schunk *sc = blosc2_schunk_new(ctx->b2_storage);
  424|     70|  if (sc == NULL) {
  ------------------
  |  Branch (424:7): [True: 0, False: 70]
  ------------------
  425|      0|    BLOSC_TRACE_ERROR("Pointer is NULL");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  426|      0|    goto failed;
  427|      0|  }
  428|       |  // Freed with the array on failure
  429|     70|  (*array)->sc = sc;
  430|       |  // Set the chunksize for the schunk, as it cannot be derived from storage
  431|     70|  if (sc->typesize <= 0) {
  ------------------
  |  Branch (431:7): [True: 0, False: 70]
  ------------------
  432|      0|    BLOSC_TRACE_ERROR("Invalid chunk parameters");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  433|      0|    rc = BLOSC2_ERROR_INVALID_PARAM;
  434|      0|    goto failed;
  435|      0|  }
  436|     70|  if ((*array)->extchunknitems < 0) {
  ------------------
  |  Branch (436:7): [True: 0, False: 70]
  ------------------
  437|      0|    BLOSC_TRACE_ERROR("Invalid chunk parameters");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  438|      0|    rc = BLOSC2_ERROR_INVALID_PARAM;
  439|      0|    goto failed;
  440|      0|  }
  441|     70|  if ((uint64_t)(*array)->extchunknitems > (uint64_t)SIZE_MAX) {
  ------------------
  |  Branch (441:7): [True: 0, False: 70]
  ------------------
  442|      0|    BLOSC_TRACE_ERROR("extchunknitems too large");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  443|      0|    rc = BLOSC2_ERROR_INVALID_PARAM;
  444|      0|    goto failed;
  445|      0|  }
  446|     70|  size_t chunkbytes_size = 0;
  447|     70|  if (!blosc2_checked_mul_size((size_t)(*array)->extchunknitems, (size_t)sc->typesize, &chunkbytes_size)) {
  ------------------
  |  Branch (447:7): [True: 0, False: 70]
  ------------------
  448|      0|    BLOSC_TRACE_ERROR("Chunksize overflows size limits");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  449|      0|    rc = BLOSC2_ERROR_INVALID_PARAM;
  450|      0|    goto failed;
  451|      0|  }
  452|     70|  if (chunkbytes_size > BLOSC2_MAX_BUFFERSIZE || chunkbytes_size > INT32_MAX) {
  ------------------
  |  Branch (452:7): [True: 0, False: 70]
  |  Branch (452:50): [True: 0, False: 70]
  ------------------
  453|      0|    BLOSC_TRACE_ERROR("Chunksize exceeds maximum of %d", BLOSC2_MAX_BUFFERSIZE);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  454|      0|    rc = BLOSC2_ERROR_MAX_BUFSIZE_EXCEEDED;
  455|      0|    goto failed;
  456|      0|  }
  457|     70|  int32_t chunksize = (int32_t)chunkbytes_size;
  458|     70|  sc->chunksize = chunksize;
  459|       |
  460|       |  // Serialize the dimension info
  461|     70|  if (sc->nmetalayers >= BLOSC2_MAX_METALAYERS) {
  ------------------
  |  | 1895|     70|#define BLOSC2_MAX_METALAYERS 16
  ------------------
  |  Branch (461:7): [True: 0, False: 70]
  ------------------
  462|      0|    BLOSC_TRACE_ERROR("the number of metalayers for this schunk has been exceeded");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  463|      0|    goto failed;
  464|      0|  }
  465|     70|  uint8_t *smeta = NULL;
  466|     70|  int32_t smeta_len = b2nd_serialize_meta(ctx->ndim,
  467|     70|                                          (*array)->shape,
  468|     70|                                          (*array)->chunkshape,
  469|     70|                                          (*array)->blockshape,
  470|     70|                                          (*array)->dtype,
  471|     70|                                          (*array)->dtype_format,
  472|     70|                                          &smeta);
  473|     70|  if (smeta_len < 0) {
  ------------------
  |  Branch (473:7): [True: 0, False: 70]
  ------------------
  474|      0|    BLOSC_TRACE_ERROR("error during serializing dims info for Blosc2 NDim");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  475|      0|    goto failed;
  476|      0|  }
  477|       |
  478|       |  // And store it in b2nd metalayer
  479|     70|  int meta_rc = blosc2_meta_add(sc, "b2nd", smeta, smeta_len);
  480|     70|  free(smeta);
  481|     70|  if (meta_rc < 0) {
  ------------------
  |  Branch (481:7): [True: 0, False: 70]
  ------------------
  482|      0|    goto failed;
  483|      0|  }
  484|       |
  485|     70|  for (int i = 0; i < ctx->nmetalayers; ++i) {
  ------------------
  |  Branch (485:19): [True: 0, False: 70]
  ------------------
  486|      0|    char *name = ctx->metalayers[i].name;
  487|      0|    uint8_t *data = ctx->metalayers[i].content;
  488|      0|    int32_t size = ctx->metalayers[i].content_len;
  489|      0|    if (blosc2_meta_add(sc, name, data, size) < 0) {
  ------------------
  |  Branch (489:9): [True: 0, False: 0]
  ------------------
  490|      0|      goto failed;
  491|      0|    }
  492|      0|  }
  493|       |
  494|       |  // Fill schunk with uninit values
  495|     70|  if ((*array)->nitems != 0) {
  ------------------
  |  Branch (495:7): [True: 70, False: 0]
  ------------------
  496|     70|    int64_t nchunks = (*array)->extnitems / (*array)->chunknitems;
  497|     70|    int64_t nitems = nchunks * (*array)->extchunknitems;
  498|     70|    if (blosc2_schunk_fill_special(sc, nitems, special_value, chunksize) < 0) {
  ------------------
  |  Branch (498:9): [True: 0, False: 70]
  ------------------
  499|      0|      BLOSC_TRACE_ERROR("Error filling the super-chunk");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  500|      0|      goto failed;
  501|      0|    }
  502|     70|  }
  503|       |
  504|     70|  return BLOSC2_ERROR_SUCCESS;
  505|       |
  506|      0|  failed:
  507|      0|  b2nd_free(*array);
  508|       |  *array = NULL;
  509|      0|  return rc;
  510|     70|}
b2nd_empty:
  523|     70|int b2nd_empty(b2nd_context_t *ctx, b2nd_array_t **array) {
  524|     70|  BLOSC_ERROR_NULL(ctx, BLOSC2_ERROR_NULL_POINTER);
  ------------------
  |  |  104|     70|    do {                                            \
  |  |  105|     70|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 70]
  |  |  ------------------
  |  |  106|      0|            BLOSC_TRACE_ERROR("Pointer is null");   \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  107|      0|            return (rc);                            \
  |  |  108|      0|        }                                           \
  |  |  109|     70|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 70]
  |  |  ------------------
  ------------------
  525|     70|  BLOSC_ERROR_NULL(array, BLOSC2_ERROR_NULL_POINTER);
  ------------------
  |  |  104|     70|    do {                                            \
  |  |  105|     70|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 70]
  |  |  ------------------
  |  |  106|      0|            BLOSC_TRACE_ERROR("Pointer is null");   \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  107|      0|            return (rc);                            \
  |  |  108|      0|        }                                           \
  |  |  109|     70|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 70]
  |  |  ------------------
  ------------------
  526|       |
  527|       |  // Fill with zeros to avoid variable cratios
  528|     70|  BLOSC_ERROR(array_new(ctx, BLOSC2_SPECIAL_ZERO, array));
  ------------------
  |  |  111|     70|    do {                                            \
  |  |  112|     70|        int rc_ = (rc);                             \
  |  |  113|     70|        if (rc_ < BLOSC2_ERROR_SUCCESS) {           \
  |  |  ------------------
  |  |  |  Branch (113:13): [True: 0, False: 70]
  |  |  ------------------
  |  |  114|      0|            char *error_msg = print_error(rc_);     \
  |  |  115|      0|            BLOSC_TRACE_ERROR("%s", error_msg);     \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  116|      0|            return rc_;                             \
  |  |  117|      0|        }                                           \
  |  |  118|     70|    } while (0)
  |  |  ------------------
  |  |  |  Branch (118:14): [Folded, False: 70]
  |  |  ------------------
  ------------------
  529|       |
  530|     70|  return BLOSC2_ERROR_SUCCESS;
  531|     70|}
b2nd_from_schunk:
  643|     69|int b2nd_from_schunk(blosc2_schunk *schunk, b2nd_array_t **array) {
  644|     69|  BLOSC_ERROR_NULL(schunk, BLOSC2_ERROR_NULL_POINTER);
  ------------------
  |  |  104|     69|    do {                                            \
  |  |  105|     69|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 69]
  |  |  ------------------
  |  |  106|      0|            BLOSC_TRACE_ERROR("Pointer is null");   \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  107|      0|            return (rc);                            \
  |  |  108|      0|        }                                           \
  |  |  109|     69|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 69]
  |  |  ------------------
  ------------------
  645|     69|  BLOSC_ERROR_NULL(array, BLOSC2_ERROR_NULL_POINTER);
  ------------------
  |  |  104|     69|    do {                                            \
  |  |  105|     69|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 69]
  |  |  ------------------
  |  |  106|      0|            BLOSC_TRACE_ERROR("Pointer is null");   \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  107|      0|            return (rc);                            \
  |  |  108|      0|        }                                           \
  |  |  109|     69|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 69]
  |  |  ------------------
  ------------------
  646|       |
  647|     69|  if (schunk == NULL) {
  ------------------
  |  Branch (647:7): [True: 0, False: 69]
  ------------------
  648|      0|    BLOSC_TRACE_ERROR("Schunk is null");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  649|      0|    return BLOSC2_ERROR_NULL_POINTER;
  650|      0|  }
  651|       |
  652|     69|  blosc2_cparams *cparams;
  653|     69|  if (blosc2_schunk_get_cparams(schunk, &cparams) < 0) {
  ------------------
  |  Branch (653:7): [True: 0, False: 69]
  ------------------
  654|      0|    BLOSC_TRACE_ERROR("Blosc error");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  655|      0|    return BLOSC2_ERROR_NULL_POINTER;
  656|      0|  }
  657|     69|  free(cparams);
  658|       |
  659|     69|  b2nd_context_t params = {0};
  660|     69|  params.b2_storage = schunk->storage;
  661|       |
  662|       |  // Deserialize the b2nd metalayer
  663|     69|  uint8_t *smeta;
  664|     69|  int32_t smeta_len;
  665|     69|  if (blosc2_meta_get(schunk, "b2nd", &smeta, &smeta_len) < 0) {
  ------------------
  |  Branch (665:7): [True: 0, False: 69]
  ------------------
  666|       |    // Try with a caterva metalayer; we are meant to be backward compatible with it
  667|      0|    if (blosc2_meta_get(schunk, "caterva", &smeta, &smeta_len) < 0) {
  ------------------
  |  Branch (667:9): [True: 0, False: 0]
  ------------------
  668|      0|      BLOSC_ERROR(BLOSC2_ERROR_METALAYER_NOT_FOUND);
  ------------------
  |  |  111|      0|    do {                                            \
  |  |  112|      0|        int rc_ = (rc);                             \
  |  |  113|      0|        if (rc_ < BLOSC2_ERROR_SUCCESS) {           \
  |  |  ------------------
  |  |  |  Branch (113:13): [True: 0, False: 0]
  |  |  ------------------
  |  |  114|      0|            char *error_msg = print_error(rc_);     \
  |  |  115|      0|            BLOSC_TRACE_ERROR("%s", error_msg);     \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  116|      0|            return rc_;                             \
  |  |  117|      0|        }                                           \
  |  |  118|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (118:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  669|      0|    }
  670|      0|  }
  671|     69|  int rc_meta = b2nd_deserialize_meta(smeta, smeta_len, &params.ndim, params.shape,
  672|     69|                                      params.chunkshape, params.blockshape, &params.dtype,
  673|     69|                                      &params.dtype_format);
  674|     69|  free(smeta);
  675|     69|  BLOSC_ERROR(rc_meta);
  ------------------
  |  |  111|     69|    do {                                            \
  |  |  112|     69|        int rc_ = (rc);                             \
  |  |  113|     69|        if (rc_ < BLOSC2_ERROR_SUCCESS) {           \
  |  |  ------------------
  |  |  |  Branch (113:13): [True: 0, False: 69]
  |  |  ------------------
  |  |  114|      0|            char *error_msg = print_error(rc_);     \
  |  |  115|      0|            BLOSC_TRACE_ERROR("%s", error_msg);     \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  116|      0|            return rc_;                             \
  |  |  117|      0|        }                                           \
  |  |  118|     69|    } while (0)
  |  |  ------------------
  |  |  |  Branch (118:14): [Folded, False: 69]
  |  |  ------------------
  ------------------
  676|       |
  677|       |  // Reject crafted metalayers that pair shape[i]>0 with chunkshape[i]==0 or
  678|       |  // blockshape[i]==0.  validate_shape_chunkshape_blockshape is intentionally
  679|       |  // lenient about chunkshape==0/blockshape==0 to support the placeholder
  680|       |  // pattern in b2nd_create_ctx (see example_empty_shape.c), where the
  681|       |  // companion shape entry is also 0 so no divide-by-zero ever materializes.
  682|       |  // Crafted on-wire metadata can violate that pairing, and many code paths
  683|       |  // downstream (b2nd_get_slice, b2nd_set_slice, set/get_orthogonal_selection,
  684|       |  // squeeze, resize) divide or mod by chunkshape[i] / blockshape[i] without
  685|       |  // re-checking.  Enforce the pairing here so the deserialization path is
  686|       |  // strict even when the create-ctx path remains permissive.
  687|    319|  for (int i = 0; i < params.ndim; ++i) {
  ------------------
  |  Branch (687:19): [True: 250, False: 69]
  ------------------
  688|    250|    if (params.shape[i] != 0 &&
  ------------------
  |  Branch (688:9): [True: 250, False: 0]
  ------------------
  689|    250|        (params.chunkshape[i] == 0 || params.blockshape[i] == 0)) {
  ------------------
  |  Branch (689:10): [True: 0, False: 250]
  |  Branch (689:39): [True: 0, False: 250]
  ------------------
  690|      0|      BLOSC_TRACE_ERROR("b2nd metalayer: shape[%d] is non-zero but "
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  691|      0|                        "chunkshape[%d] or blockshape[%d] is zero", i, i, i);
  692|      0|      free(params.dtype);
  693|      0|      return BLOSC2_ERROR_INVALID_PARAM;
  694|      0|    }
  695|    250|  }
  696|       |
  697|       |  // Free the deserialized dtype whether or not the array could be built; the
  698|       |  // rejection path is now reachable for crafted shapes (see #795)
  699|     69|  int rc = array_without_schunk(&params, array);
  700|     69|  free(params.dtype);
  701|     69|  BLOSC_ERROR(rc);
  ------------------
  |  |  111|     69|    do {                                            \
  |  |  112|     69|        int rc_ = (rc);                             \
  |  |  113|     69|        if (rc_ < BLOSC2_ERROR_SUCCESS) {           \
  |  |  ------------------
  |  |  |  Branch (113:13): [True: 0, False: 69]
  |  |  ------------------
  |  |  114|      0|            char *error_msg = print_error(rc_);     \
  |  |  115|      0|            BLOSC_TRACE_ERROR("%s", error_msg);     \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  116|      0|            return rc_;                             \
  |  |  117|      0|        }                                           \
  |  |  118|     69|    } while (0)
  |  |  ------------------
  |  |  |  Branch (118:14): [Folded, False: 69]
  |  |  ------------------
  ------------------
  702|       |
  703|     69|  rc = check_schunk_matches_meta(schunk, *array);
  704|     69|  if (rc < 0) {
  ------------------
  |  Branch (704:7): [True: 0, False: 69]
  ------------------
  705|       |    // The schunk stays with the caller
  706|      0|    b2nd_free(*array);
  707|      0|    *array = NULL;
  708|      0|    BLOSC_ERROR(rc);
  ------------------
  |  |  111|      0|    do {                                            \
  |  |  112|      0|        int rc_ = (rc);                             \
  |  |  113|      0|        if (rc_ < BLOSC2_ERROR_SUCCESS) {           \
  |  |  ------------------
  |  |  |  Branch (113:13): [True: 0, False: 0]
  |  |  ------------------
  |  |  114|      0|            char *error_msg = print_error(rc_);     \
  |  |  115|      0|            BLOSC_TRACE_ERROR("%s", error_msg);     \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  116|      0|            return rc_;                             \
  |  |  117|      0|        }                                           \
  |  |  118|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (118:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  709|      0|  }
  710|       |
  711|     69|  (*array)->sc = schunk;
  712|     69|  (*array)->last_tick = schunk->change_tick;
  713|       |
  714|     69|  if ((*array) == NULL) {
  ------------------
  |  Branch (714:7): [True: 0, False: 69]
  ------------------
  715|      0|    BLOSC_TRACE_ERROR("Error creating a b2nd container from a frame");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  716|      0|    return BLOSC2_ERROR_NULL_POINTER;
  717|      0|  }
  718|       |
  719|     69|  return BLOSC2_ERROR_SUCCESS;
  720|     69|}
b2nd_to_cframe:
  724|     69|                   bool *needs_free) {
  725|     69|  BLOSC_ERROR_NULL(array, BLOSC2_ERROR_NULL_POINTER);
  ------------------
  |  |  104|     69|    do {                                            \
  |  |  105|     69|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 69]
  |  |  ------------------
  |  |  106|      0|            BLOSC_TRACE_ERROR("Pointer is null");   \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  107|      0|            return (rc);                            \
  |  |  108|      0|        }                                           \
  |  |  109|     69|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 69]
  |  |  ------------------
  ------------------
  726|     69|  BLOSC_ERROR_NULL(cframe, BLOSC2_ERROR_NULL_POINTER);
  ------------------
  |  |  104|     69|    do {                                            \
  |  |  105|     69|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 69]
  |  |  ------------------
  |  |  106|      0|            BLOSC_TRACE_ERROR("Pointer is null");   \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  107|      0|            return (rc);                            \
  |  |  108|      0|        }                                           \
  |  |  109|     69|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 69]
  |  |  ------------------
  ------------------
  727|     69|  BLOSC_ERROR_NULL(cframe_len, BLOSC2_ERROR_NULL_POINTER);
  ------------------
  |  |  104|     69|    do {                                            \
  |  |  105|     69|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 69]
  |  |  ------------------
  |  |  106|      0|            BLOSC_TRACE_ERROR("Pointer is null");   \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  107|      0|            return (rc);                            \
  |  |  108|      0|        }                                           \
  |  |  109|     69|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 69]
  |  |  ------------------
  ------------------
  728|     69|  BLOSC_ERROR_NULL(needs_free, BLOSC2_ERROR_NULL_POINTER);
  ------------------
  |  |  104|     69|    do {                                            \
  |  |  105|     69|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 69]
  |  |  ------------------
  |  |  106|      0|            BLOSC_TRACE_ERROR("Pointer is null");   \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  107|      0|            return (rc);                            \
  |  |  108|      0|        }                                           \
  |  |  109|     69|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 69]
  |  |  ------------------
  ------------------
  729|       |
  730|     69|  *cframe_len = blosc2_schunk_to_buffer(array->sc, cframe, needs_free);
  731|     69|  if (*cframe_len <= 0) {
  ------------------
  |  Branch (731:7): [True: 0, False: 69]
  ------------------
  732|      0|    BLOSC_TRACE_ERROR("Error serializing the b2nd array");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  733|      0|    return BLOSC2_ERROR_FAILURE;
  734|      0|  }
  735|     69|  return BLOSC2_ERROR_SUCCESS;
  736|     69|}
b2nd_from_cframe:
  739|  1.96k|int b2nd_from_cframe(uint8_t *cframe, int64_t cframe_len, bool copy, b2nd_array_t **array) {
  740|  1.96k|  BLOSC_ERROR_NULL(cframe, BLOSC2_ERROR_NULL_POINTER);
  ------------------
  |  |  104|  1.96k|    do {                                            \
  |  |  105|  1.96k|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 1.96k]
  |  |  ------------------
  |  |  106|      0|            BLOSC_TRACE_ERROR("Pointer is null");   \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  107|      0|            return (rc);                            \
  |  |  108|      0|        }                                           \
  |  |  109|  1.96k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 1.96k]
  |  |  ------------------
  ------------------
  741|  1.96k|  BLOSC_ERROR_NULL(array, BLOSC2_ERROR_NULL_POINTER);
  ------------------
  |  |  104|  1.96k|    do {                                            \
  |  |  105|  1.96k|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 1.96k]
  |  |  ------------------
  |  |  106|      0|            BLOSC_TRACE_ERROR("Pointer is null");   \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  107|      0|            return (rc);                            \
  |  |  108|      0|        }                                           \
  |  |  109|  1.96k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 1.96k]
  |  |  ------------------
  ------------------
  742|       |
  743|  1.96k|  blosc2_schunk *sc = blosc2_schunk_from_buffer(cframe, cframe_len, copy);
  744|  1.96k|  if (sc == NULL) {
  ------------------
  |  Branch (744:7): [True: 1.89k, False: 69]
  ------------------
  745|  1.89k|    BLOSC_TRACE_ERROR("Blosc error");
  ------------------
  |  |   93|  1.89k|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|  1.89k|    do {                                            \
  |  |  |  |   98|  1.89k|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|  1.89k|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 1.89k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|  1.89k|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  746|  1.89k|    return BLOSC2_ERROR_FAILURE;
  747|  1.89k|  }
  748|       |  // ...and create a b2nd array out of it
  749|     69|  int rc = b2nd_from_schunk(sc, array);
  750|     69|  if (rc < 0) {
  ------------------
  |  Branch (750:7): [True: 0, False: 69]
  ------------------
  751|      0|    blosc2_schunk_free(sc);
  752|      0|    return rc;
  753|      0|  }
  754|       |
  755|     69|  return BLOSC2_ERROR_SUCCESS;
  756|     69|}
b2nd_free:
  799|    139|int b2nd_free(b2nd_array_t *array) {
  800|    139|  BLOSC_ERROR_NULL(array, BLOSC2_ERROR_NULL_POINTER);
  ------------------
  |  |  104|    139|    do {                                            \
  |  |  105|    139|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 139]
  |  |  ------------------
  |  |  106|      0|            BLOSC_TRACE_ERROR("Pointer is null");   \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  107|      0|            return (rc);                            \
  |  |  108|      0|        }                                           \
  |  |  109|    139|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 139]
  |  |  ------------------
  ------------------
  801|       |
  802|    139|  int rc = BLOSC2_ERROR_SUCCESS;
  803|    139|  if (array) {
  ------------------
  |  Branch (803:7): [True: 139, False: 0]
  ------------------
  804|    139|    if (array->sc != NULL) {
  ------------------
  |  Branch (804:9): [True: 139, False: 0]
  ------------------
  805|    139|      rc = blosc2_schunk_free(array->sc);
  806|    139|      if (rc > 0) {
  ------------------
  |  Branch (806:11): [True: 0, False: 139]
  ------------------
  807|      0|        rc = BLOSC2_ERROR_FAILURE;
  808|      0|      }
  809|    139|    }
  810|    139|    free(array->dtype);
  811|    139|    free(array);
  812|    139|  }
  813|    139|  return rc;
  814|    139|}
b2nd_from_cbuffer:
  823|     70|int b2nd_from_cbuffer(b2nd_context_t *ctx, b2nd_array_t **array, const void *buffer, int64_t buffersize) {
  824|     70|  BLOSC_ERROR_NULL(ctx, BLOSC2_ERROR_NULL_POINTER);
  ------------------
  |  |  104|     70|    do {                                            \
  |  |  105|     70|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 70]
  |  |  ------------------
  |  |  106|      0|            BLOSC_TRACE_ERROR("Pointer is null");   \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  107|      0|            return (rc);                            \
  |  |  108|      0|        }                                           \
  |  |  109|     70|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 70]
  |  |  ------------------
  ------------------
  825|     70|  BLOSC_ERROR_NULL(buffer, BLOSC2_ERROR_NULL_POINTER);
  ------------------
  |  |  104|     70|    do {                                            \
  |  |  105|     70|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 70]
  |  |  ------------------
  |  |  106|      0|            BLOSC_TRACE_ERROR("Pointer is null");   \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  107|      0|            return (rc);                            \
  |  |  108|      0|        }                                           \
  |  |  109|     70|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 70]
  |  |  ------------------
  ------------------
  826|     70|  BLOSC_ERROR_NULL(array, BLOSC2_ERROR_NULL_POINTER);
  ------------------
  |  |  104|     70|    do {                                            \
  |  |  105|     70|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 70]
  |  |  ------------------
  |  |  106|      0|            BLOSC_TRACE_ERROR("Pointer is null");   \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  107|      0|            return (rc);                            \
  |  |  108|      0|        }                                           \
  |  |  109|     70|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 70]
  |  |  ------------------
  ------------------
  827|       |
  828|     70|  BLOSC_ERROR(b2nd_empty(ctx, array));
  ------------------
  |  |  111|     70|    do {                                            \
  |  |  112|     70|        int rc_ = (rc);                             \
  |  |  113|     70|        if (rc_ < BLOSC2_ERROR_SUCCESS) {           \
  |  |  ------------------
  |  |  |  Branch (113:13): [True: 0, False: 70]
  |  |  ------------------
  |  |  114|      0|            char *error_msg = print_error(rc_);     \
  |  |  115|      0|            BLOSC_TRACE_ERROR("%s", error_msg);     \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  116|      0|            return rc_;                             \
  |  |  117|      0|        }                                           \
  |  |  118|     70|    } while (0)
  |  |  ------------------
  |  |  |  Branch (118:14): [Folded, False: 70]
  |  |  ------------------
  ------------------
  829|       |
  830|     70|  if (buffersize < (int64_t) (*array)->nitems * (*array)->sc->typesize) {
  ------------------
  |  Branch (830:7): [True: 0, False: 70]
  ------------------
  831|      0|    BLOSC_TRACE_ERROR("The buffersize (%lld) is smaller than the array size (%lld)",
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  832|      0|                        (long long) buffersize, (long long) (*array)->nitems * (*array)->sc->typesize);
  833|      0|    BLOSC_ERROR(BLOSC2_ERROR_INVALID_PARAM);
  ------------------
  |  |  111|      0|    do {                                            \
  |  |  112|      0|        int rc_ = (rc);                             \
  |  |  113|      0|        if (rc_ < BLOSC2_ERROR_SUCCESS) {           \
  |  |  ------------------
  |  |  |  Branch (113:13): [True: 0, False: 0]
  |  |  ------------------
  |  |  114|      0|            char *error_msg = print_error(rc_);     \
  |  |  115|      0|            BLOSC_TRACE_ERROR("%s", error_msg);     \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  116|      0|            return rc_;                             \
  |  |  117|      0|        }                                           \
  |  |  118|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (118:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  834|      0|  }
  835|       |
  836|     70|  if ((*array)->nitems == 0) {
  ------------------
  |  Branch (836:7): [True: 0, False: 70]
  ------------------
  837|      0|    return BLOSC2_ERROR_SUCCESS;
  838|      0|  }
  839|       |
  840|     70|  int64_t start[B2ND_MAX_DIM] = {0};
  841|     70|  int64_t *stop = (*array)->shape;
  842|     70|  int64_t *shape = (*array)->shape;
  843|     70|  BLOSC_ERROR(b2nd_set_slice_cbuffer(buffer, shape, buffersize, start, stop, *array));
  ------------------
  |  |  111|     70|    do {                                            \
  |  |  112|     70|        int rc_ = (rc);                             \
  |  |  113|     70|        if (rc_ < BLOSC2_ERROR_SUCCESS) {           \
  |  |  ------------------
  |  |  |  Branch (113:13): [True: 1, False: 69]
  |  |  ------------------
  |  |  114|      1|            char *error_msg = print_error(rc_);     \
  |  |  115|      1|            BLOSC_TRACE_ERROR("%s", error_msg);     \
  |  |  ------------------
  |  |  |  |   93|      1|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      1|    do {                                            \
  |  |  |  |  |  |   98|      1|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      1|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 1, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      1|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  116|      1|            return rc_;                             \
  |  |  117|      1|        }                                           \
  |  |  118|     70|    } while (0)
  |  |  ------------------
  |  |  |  Branch (118:14): [Folded, False: 69]
  |  |  ------------------
  ------------------
  844|       |
  845|     69|  return BLOSC2_ERROR_SUCCESS;
  846|     70|}
b2nd_to_cbuffer:
  850|    138|                    int64_t buffersize) {
  851|    138|  BLOSC_ERROR_NULL(array, BLOSC2_ERROR_NULL_POINTER);
  ------------------
  |  |  104|    138|    do {                                            \
  |  |  105|    138|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 138]
  |  |  ------------------
  |  |  106|      0|            BLOSC_TRACE_ERROR("Pointer is null");   \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  107|      0|            return (rc);                            \
  |  |  108|      0|        }                                           \
  |  |  109|    138|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 138]
  |  |  ------------------
  ------------------
  852|    138|  BLOSC_ERROR_NULL(buffer, BLOSC2_ERROR_NULL_POINTER);
  ------------------
  |  |  104|    138|    do {                                            \
  |  |  105|    138|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 138]
  |  |  ------------------
  |  |  106|      0|            BLOSC_TRACE_ERROR("Pointer is null");   \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  107|      0|            return (rc);                            \
  |  |  108|      0|        }                                           \
  |  |  109|    138|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 138]
  |  |  ------------------
  ------------------
  853|    138|  BLOSC_ERROR(refresh_if_stale((b2nd_array_t *) array));
  ------------------
  |  |  111|    138|    do {                                            \
  |  |  112|    138|        int rc_ = (rc);                             \
  |  |  113|    138|        if (rc_ < BLOSC2_ERROR_SUCCESS) {           \
  |  |  ------------------
  |  |  |  Branch (113:13): [True: 0, False: 138]
  |  |  ------------------
  |  |  114|      0|            char *error_msg = print_error(rc_);     \
  |  |  115|      0|            BLOSC_TRACE_ERROR("%s", error_msg);     \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  116|      0|            return rc_;                             \
  |  |  117|      0|        }                                           \
  |  |  118|    138|    } while (0)
  |  |  ------------------
  |  |  |  Branch (118:14): [Folded, False: 138]
  |  |  ------------------
  ------------------
  854|       |
  855|    138|  if (buffersize < (int64_t) array->nitems * array->sc->typesize) {
  ------------------
  |  Branch (855:7): [True: 0, False: 138]
  ------------------
  856|      0|    BLOSC_ERROR(BLOSC2_ERROR_INVALID_PARAM);
  ------------------
  |  |  111|      0|    do {                                            \
  |  |  112|      0|        int rc_ = (rc);                             \
  |  |  113|      0|        if (rc_ < BLOSC2_ERROR_SUCCESS) {           \
  |  |  ------------------
  |  |  |  Branch (113:13): [True: 0, False: 0]
  |  |  ------------------
  |  |  114|      0|            char *error_msg = print_error(rc_);     \
  |  |  115|      0|            BLOSC_TRACE_ERROR("%s", error_msg);     \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  116|      0|            return rc_;                             \
  |  |  117|      0|        }                                           \
  |  |  118|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (118:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  857|      0|  }
  858|       |
  859|    138|  if (array->nitems == 0) {
  ------------------
  |  Branch (859:7): [True: 0, False: 138]
  ------------------
  860|      0|    return BLOSC2_ERROR_SUCCESS;
  861|      0|  }
  862|       |
  863|    138|  int64_t start[B2ND_MAX_DIM] = {0};
  864|    138|  const int64_t *stop = array->shape;
  865|    138|  BLOSC_ERROR(b2nd_get_slice_cbuffer(array, start, stop, buffer, array->shape, buffersize));
  ------------------
  |  |  111|    138|    do {                                            \
  |  |  112|    138|        int rc_ = (rc);                             \
  |  |  113|    138|        if (rc_ < BLOSC2_ERROR_SUCCESS) {           \
  |  |  ------------------
  |  |  |  Branch (113:13): [True: 0, False: 138]
  |  |  ------------------
  |  |  114|      0|            char *error_msg = print_error(rc_);     \
  |  |  115|      0|            BLOSC_TRACE_ERROR("%s", error_msg);     \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  116|      0|            return rc_;                             \
  |  |  117|      0|        }                                           \
  |  |  118|    138|    } while (0)
  |  |  ------------------
  |  |  |  Branch (118:14): [Folded, False: 138]
  |  |  ------------------
  ------------------
  866|    138|  return BLOSC2_ERROR_SUCCESS;
  867|    138|}
get_set_slice:
 1541|    208|                  prefetch_batch *prefetch) {
 1542|    208|  BLOSC_ERROR_NULL(buffer, BLOSC2_ERROR_NULL_POINTER);
  ------------------
  |  |  104|    208|    do {                                            \
  |  |  105|    208|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 208]
  |  |  ------------------
  |  |  106|      0|            BLOSC_TRACE_ERROR("Pointer is null");   \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  107|      0|            return (rc);                            \
  |  |  108|      0|        }                                           \
  |  |  109|    208|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 208]
  |  |  ------------------
  ------------------
 1543|    208|  BLOSC_ERROR_NULL(start, BLOSC2_ERROR_NULL_POINTER);
  ------------------
  |  |  104|    208|    do {                                            \
  |  |  105|    208|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 208]
  |  |  ------------------
  |  |  106|      0|            BLOSC_TRACE_ERROR("Pointer is null");   \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  107|      0|            return (rc);                            \
  |  |  108|      0|        }                                           \
  |  |  109|    208|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 208]
  |  |  ------------------
  ------------------
 1544|    208|  BLOSC_ERROR_NULL(stop, BLOSC2_ERROR_NULL_POINTER);
  ------------------
  |  |  104|    208|    do {                                            \
  |  |  105|    208|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 208]
  |  |  ------------------
  |  |  106|      0|            BLOSC_TRACE_ERROR("Pointer is null");   \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  107|      0|            return (rc);                            \
  |  |  108|      0|        }                                           \
  |  |  109|    208|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 208]
  |  |  ------------------
  ------------------
 1545|    208|  BLOSC_ERROR_NULL(array, BLOSC2_ERROR_NULL_POINTER);
  ------------------
  |  |  104|    208|    do {                                            \
  |  |  105|    208|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 208]
  |  |  ------------------
  |  |  106|      0|            BLOSC_TRACE_ERROR("Pointer is null");   \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  107|      0|            return (rc);                            \
  |  |  108|      0|        }                                           \
  |  |  109|    208|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 208]
  |  |  ------------------
  ------------------
 1546|    208|  if (buffersize < 0) {
  ------------------
  |  Branch (1546:7): [True: 0, False: 208]
  ------------------
 1547|      0|    BLOSC_TRACE_ERROR("buffersize is < 0");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1548|      0|    BLOSC_ERROR(BLOSC2_ERROR_INVALID_PARAM);
  ------------------
  |  |  111|      0|    do {                                            \
  |  |  112|      0|        int rc_ = (rc);                             \
  |  |  113|      0|        if (rc_ < BLOSC2_ERROR_SUCCESS) {           \
  |  |  ------------------
  |  |  |  Branch (113:13): [True: 0, False: 0]
  |  |  ------------------
  |  |  114|      0|            char *error_msg = print_error(rc_);     \
  |  |  115|      0|            BLOSC_TRACE_ERROR("%s", error_msg);     \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  116|      0|            return rc_;                             \
  |  |  117|      0|        }                                           \
  |  |  118|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (118:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1549|      0|  }
 1550|       |
 1551|    208|  uint8_t *buffer_b = buffer;
 1552|    208|  int8_t ndim = array->ndim;
 1553|       |
 1554|       |  // 0-dim case
 1555|    208|  if (ndim == 0) {
  ------------------
  |  Branch (1555:7): [True: 0, False: 208]
  ------------------
 1556|      0|    if (set_slice) {
  ------------------
  |  Branch (1556:9): [True: 0, False: 0]
  ------------------
 1557|      0|      int32_t chunk_size = array->sc->typesize + BLOSC2_MAX_OVERHEAD;
 1558|      0|      uint8_t *chunk = malloc(chunk_size);
 1559|      0|      BLOSC_ERROR_NULL(chunk, BLOSC2_ERROR_MEMORY_ALLOC);
  ------------------
  |  |  104|      0|    do {                                            \
  |  |  105|      0|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 0]
  |  |  ------------------
  |  |  106|      0|            BLOSC_TRACE_ERROR("Pointer is null");   \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  107|      0|            return (rc);                            \
  |  |  108|      0|        }                                           \
  |  |  109|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1560|      0|      if (blosc2_compress_ctx(array->sc->cctx, buffer_b, array->sc->typesize, chunk, chunk_size) < 0 ||
  ------------------
  |  Branch (1560:11): [True: 0, False: 0]
  ------------------
 1561|      0|          blosc2_schunk_update_chunk(array->sc, 0, chunk, false) < 0) {
  ------------------
  |  Branch (1561:11): [True: 0, False: 0]
  ------------------
 1562|       |        // Neither a failed compression nor a failed update took the chunk
 1563|      0|        free(chunk);
 1564|      0|        BLOSC_ERROR(BLOSC2_ERROR_FAILURE);
  ------------------
  |  |  111|      0|    do {                                            \
  |  |  112|      0|        int rc_ = (rc);                             \
  |  |  113|      0|        if (rc_ < BLOSC2_ERROR_SUCCESS) {           \
  |  |  ------------------
  |  |  |  Branch (113:13): [True: 0, False: 0]
  |  |  ------------------
  |  |  114|      0|            char *error_msg = print_error(rc_);     \
  |  |  115|      0|            BLOSC_TRACE_ERROR("%s", error_msg);     \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  116|      0|            return rc_;                             \
  |  |  117|      0|        }                                           \
  |  |  118|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (118:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1565|      0|      }
 1566|       |
 1567|      0|    } else {
 1568|       |      // The item is the whole slice: zero it first (an uninitialized chunk
 1569|       |      // decompresses to nothing), with slice_only nothing else
 1570|      0|      memset(buffer_b, 0, slice_only ? (size_t)array->sc->typesize : (size_t)buffersize);
  ------------------
  |  Branch (1570:27): [True: 0, False: 0]
  ------------------
 1571|      0|      if (blosc2_schunk_decompress_chunk(array->sc, 0, buffer_b, array->sc->typesize) < 0) {
  ------------------
  |  Branch (1571:11): [True: 0, False: 0]
  ------------------
 1572|      0|        BLOSC_ERROR(BLOSC2_ERROR_FAILURE);
  ------------------
  |  |  111|      0|    do {                                            \
  |  |  112|      0|        int rc_ = (rc);                             \
  |  |  113|      0|        if (rc_ < BLOSC2_ERROR_SUCCESS) {           \
  |  |  ------------------
  |  |  |  Branch (113:13): [True: 0, False: 0]
  |  |  ------------------
  |  |  114|      0|            char *error_msg = print_error(rc_);     \
  |  |  115|      0|            BLOSC_TRACE_ERROR("%s", error_msg);     \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  116|      0|            return rc_;                             \
  |  |  117|      0|        }                                           \
  |  |  118|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (118:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1573|      0|      }
 1574|      0|    }
 1575|      0|    return BLOSC2_ERROR_SUCCESS;
 1576|      0|  }
 1577|       |
 1578|    208|  if (array->nitems == 0) {
  ------------------
  |  Branch (1578:7): [True: 0, False: 208]
  ------------------
 1579|      0|    if (!set_slice && !slice_only) {
  ------------------
  |  Branch (1579:9): [True: 0, False: 0]
  |  Branch (1579:23): [True: 0, False: 0]
  ------------------
 1580|      0|      memset(buffer_b, 0, (size_t)buffersize);
 1581|      0|    }
 1582|      0|    return BLOSC2_ERROR_SUCCESS;
 1583|      0|  }
 1584|       |
 1585|    208|  int64_t nelems_slice = 1;
 1586|    961|  for (int i = 0; i < array->ndim; ++i) {
  ------------------
  |  Branch (1586:19): [True: 753, False: 208]
  ------------------
 1587|    753|    if (stop[i] - start[i] > shape[i]) {
  ------------------
  |  Branch (1587:9): [True: 0, False: 753]
  ------------------
 1588|      0|      BLOSC_TRACE_ERROR("The buffer shape can not be smaller than the slice shape");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1589|      0|      return BLOSC2_ERROR_INVALID_PARAM;
 1590|      0|    }
 1591|    753|    nelems_slice *= stop[i] - start[i];
 1592|    753|  }
 1593|    208|  int64_t slice_nbytes = nelems_slice * array->sc->typesize;
 1594|       |  // Compute in 64 bits and range-check: the cast used to bind to extchunknitems
 1595|       |  // alone, truncating it before the multiply and sizing buffers from the
 1596|       |  // wrapped value while offsets kept using the full extent (see #795)
 1597|    208|  int64_t data_nbytes_64 = 0;
 1598|    208|  if (!blosc2_checked_mul_i64_nonneg(array->extchunknitems, array->sc->typesize, &data_nbytes_64) ||
  ------------------
  |  Branch (1598:7): [True: 0, False: 208]
  ------------------
 1599|    208|      data_nbytes_64 > INT32_MAX) {
  ------------------
  |  Branch (1599:7): [True: 0, False: 208]
  ------------------
 1600|      0|    BLOSC_TRACE_ERROR("Chunk buffer size overflows the maximum of %d bytes", INT32_MAX);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1600|      0|    BLOSC_TRACE_ERROR("Chunk buffer size overflows the maximum of %d bytes", INT32_MAX);
  |  |  |  |  ------------------
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1601|      0|    return BLOSC2_ERROR_INVALID_PARAM;
 1602|      0|  }
 1603|    208|  int32_t data_nbytes = (int32_t) data_nbytes_64;
 1604|       |
 1605|    208|  if (buffersize < slice_nbytes) {
  ------------------
  |  Branch (1605:7): [True: 0, False: 208]
  ------------------
 1606|      0|    BLOSC_ERROR(BLOSC2_ERROR_INVALID_PARAM);
  ------------------
  |  |  111|      0|    do {                                            \
  |  |  112|      0|        int rc_ = (rc);                             \
  |  |  113|      0|        if (rc_ < BLOSC2_ERROR_SUCCESS) {           \
  |  |  ------------------
  |  |  |  Branch (113:13): [True: 0, False: 0]
  |  |  ------------------
  |  |  114|      0|            char *error_msg = print_error(rc_);     \
  |  |  115|      0|            BLOSC_TRACE_ERROR("%s", error_msg);     \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  116|      0|            return rc_;                             \
  |  |  117|      0|        }                                           \
  |  |  118|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (118:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1607|      0|  }
 1608|       |
 1609|    208|  int64_t buffer_strides[B2ND_MAX_DIM];
 1610|    208|  buffer_strides[ndim - 1] = 1;
 1611|    753|  for (int i = ndim - 2; i >= 0; --i) {
  ------------------
  |  Branch (1611:26): [True: 545, False: 208]
  ------------------
 1612|    545|    buffer_strides[i] = buffer_strides[i + 1] * shape[i + 1];
 1613|    545|  }
 1614|       |
 1615|    208|  bool prefault = false;
 1616|    208|  bool slice_zeroed = false;  // all items of the slice are zeros in the buffer already
 1617|    208|  if (!set_slice && slice_only) {
  ------------------
  |  Branch (1617:7): [True: 138, False: 70]
  |  Branch (1617:21): [True: 0, False: 138]
  ------------------
 1618|       |    // Only the slice's box gets written, but a fresh buffer still wants its
 1619|       |    // pages faulted in before several threads decompress into it (see
 1620|       |    // buffer_wants_prefault()).  That maps pages and changes no byte.
 1621|      0|    int64_t last = 0;
 1622|      0|    for (int i = 0; i < ndim; ++i) {
  ------------------
  |  Branch (1622:21): [True: 0, False: 0]
  ------------------
 1623|      0|      last += (stop[i] - start[i] - 1) * buffer_strides[i];
 1624|      0|    }
 1625|      0|    prefault = buffer_wants_prefault(buffer_b, (last + 1) * array->sc->typesize, array->sc->dctx->nthreads);
 1626|      0|  }
 1627|    208|  else if (!set_slice) {
  ------------------
  |  Branch (1627:12): [True: 138, False: 70]
  ------------------
 1628|    138|    bool slice_fills_buffer = true;
 1629|       |    // The get paths below write every item of the slice, so only buffer
 1630|       |    // bytes outside of it need to be pre-initialized to be defined and
 1631|       |    // deterministic.  Skipping the rest saves a pass over the buffer, which
 1632|       |    // for a freshly allocated one is also where all its page faults hit.
 1633|    638|    for (int i = 0; i < ndim; ++i) {
  ------------------
  |  Branch (1633:21): [True: 500, False: 138]
  ------------------
 1634|    500|      if (start[i] < 0 || stop[i] < start[i] || stop[i] > array->shape[i] ||
  ------------------
  |  Branch (1634:11): [True: 0, False: 500]
  |  Branch (1634:27): [True: 0, False: 500]
  |  Branch (1634:49): [True: 0, False: 500]
  ------------------
 1635|    500|          stop[i] - start[i] != shape[i]) {
  ------------------
  |  Branch (1635:11): [True: 0, False: 500]
  ------------------
 1636|      0|        slice_fills_buffer = false;
 1637|      0|        break;
 1638|      0|      }
 1639|    500|    }
 1640|    138|    if (slice_fills_buffer) {
  ------------------
  |  Branch (1640:9): [True: 138, False: 0]
  ------------------
 1641|    138|      memset(buffer_b + slice_nbytes, 0, (size_t)(buffersize - slice_nbytes));
 1642|    138|      prefault = buffer_wants_prefault(buffer_b, slice_nbytes, array->sc->dctx->nthreads);
 1643|    138|    }
 1644|      0|    else {
 1645|      0|      memset(buffer_b, 0, (size_t)buffersize);
 1646|      0|      slice_zeroed = true;
 1647|      0|    }
 1648|    138|  }
 1649|       |
 1650|       |  // Chunk-sized scratch (see scratch_malloc()), allocated lazily: the compact
 1651|       |  // get path below never needs it, and for large chunks just the malloc/free
 1652|       |  // pair costs O(chunksize) in page-table work (it is way above the malloc
 1653|       |  // mmap threshold), which would dominate small reads.
 1654|    208|  uint8_t *data = NULL;
 1655|    208|  size_t data_capacity = 0;
 1656|       |  // Block-sized scratch for the compact get path (lazily allocated too).
 1657|    208|  uint8_t *block_data = NULL;
 1658|    208|  size_t block_data_capacity = 0;
 1659|    208|  int32_t block_nbytes = (int32_t) (array->blocknitems * array->sc->typesize);
 1660|    208|  bool *block_maskout = NULL;
 1661|    208|  int rc = BLOSC2_ERROR_SUCCESS;
 1662|       |
 1663|    208|  int64_t chunks_in_array[B2ND_MAX_DIM] = {0};
 1664|    961|  for (int i = 0; i < ndim; ++i) {
  ------------------
  |  Branch (1664:19): [True: 753, False: 208]
  ------------------
 1665|    753|    chunks_in_array[i] = array->extshape[i] / array->chunkshape[i];
 1666|    753|  }
 1667|       |
 1668|    208|  int64_t chunks_in_array_strides[B2ND_MAX_DIM];
 1669|    208|  chunks_in_array_strides[ndim - 1] = 1;
 1670|    753|  for (int i = ndim - 2; i >= 0; --i) {
  ------------------
  |  Branch (1670:26): [True: 545, False: 208]
  ------------------
 1671|    545|    chunks_in_array_strides[i] = chunks_in_array_strides[i + 1] * chunks_in_array[i + 1];
 1672|    545|  }
 1673|       |
 1674|    208|  int64_t blocks_in_chunk[B2ND_MAX_DIM] = {0};
 1675|    961|  for (int i = 0; i < ndim; ++i) {
  ------------------
  |  Branch (1675:19): [True: 753, False: 208]
  ------------------
 1676|    753|    blocks_in_chunk[i] = array->extchunkshape[i] / array->blockshape[i];
 1677|    753|  }
 1678|    208|  int32_t nblocks = (int32_t) array->extchunknitems / array->blocknitems;
 1679|    208|  int64_t blockshape[B2ND_MAX_DIM];
 1680|    961|  for (int i = 0; i < ndim; ++i) {
  ------------------
  |  Branch (1680:19): [True: 753, False: 208]
  ------------------
 1681|    753|    blockshape[i] = array->blockshape[i];
 1682|    753|  }
 1683|       |
 1684|    208|  bool blocks_in_c_order = chunk_blocks_in_c_order(array);
 1685|    208|  bool has_delta = filters_contain(array->sc->filters, BLOSC_DELTA);
 1686|    208|  blosc2_context *dctx = array->sc->dctx;
 1687|       |  // The scatter get path brings its own postfilter, so it cannot serve
 1688|       |  // handles that have one (e.g. python-blosc2's lazy UDFs).
 1689|    208|  bool can_scatter = !has_delta && dctx->postfilter == NULL;
  ------------------
  |  Branch (1689:22): [True: 184, False: 24]
  |  Branch (1689:36): [True: 184, False: 0]
  ------------------
 1690|       |  // Likewise for the gather set path and prefilters (python-blosc2 installs
 1691|       |  // some for lazy expressions); DELTA encodes against the first block of the
 1692|       |  // compressor input, which the gather does not fill.
 1693|    208|  blosc2_context *cctx = array->sc->cctx;
 1694|    208|  bool can_gather = cctx->prefilter == NULL && !filters_contain(cctx->filters, BLOSC_DELTA);
  ------------------
  |  Branch (1694:21): [True: 208, False: 0]
  |  Branch (1694:48): [True: 184, False: 24]
  ------------------
 1695|       |
 1696|       |  // Compute the number of chunks to update
 1697|    208|  int64_t update_start[B2ND_MAX_DIM];
 1698|    208|  int64_t update_shape[B2ND_MAX_DIM];
 1699|       |
 1700|    208|  int64_t update_nchunks = 1;
 1701|    961|  for (int i = 0; i < ndim; ++i) {
  ------------------
  |  Branch (1701:19): [True: 753, False: 208]
  ------------------
 1702|    753|    int64_t pos = 0;
 1703|  1.50k|    while (pos <= start[i]) {
  ------------------
  |  Branch (1703:12): [True: 753, False: 753]
  ------------------
 1704|    753|      pos += array->chunkshape[i];
 1705|    753|    }
 1706|    753|    update_start[i] = pos / array->chunkshape[i] - 1;
 1707|  1.25k|    while (pos < stop[i]) {
  ------------------
  |  Branch (1707:12): [True: 504, False: 753]
  ------------------
 1708|    504|      pos += array->chunkshape[i];
 1709|    504|    }
 1710|    753|    update_shape[i] = pos / array->chunkshape[i] - update_start[i];
 1711|    753|    update_nchunks *= update_shape[i];
 1712|    753|  }
 1713|       |
 1714|    208|  prefetch_batch *own_prefetch = set_slice || prefetch != NULL ? NULL : prefetch_slice(array, start, stop);
  ------------------
  |  Branch (1714:34): [True: 70, False: 138]
  |  Branch (1714:47): [True: 0, False: 138]
  ------------------
 1715|    208|  prefetch = own_prefetch != NULL ? own_prefetch : prefetch;
  ------------------
  |  Branch (1715:14): [True: 0, False: 208]
  ------------------
 1716|       |
 1717|       |  // Chunks of zeros (b2nd_zeros(), sparse data) and uninitialized ones read
 1718|       |  // as zeros without decompression.  Find them from the index first; if they
 1719|       |  // hold a good part of the slice, zero the slice in one pass and skip them
 1720|       |  // (zeroing chunk by chunk writes many short rows: an all-zero 384^3 float16
 1721|       |  // box took 24 ms that way, 1.9 ms in one pass), else zero their boxes only.
 1722|       |  // Not with a postfilter, which may compute the items of special chunks,
 1723|       |  // and not for slices smaller than a block, where decompressing is cheap.
 1724|    208|  int64_t *slice_chunks = NULL;  // the slice's chunks in loop order, then...
 1725|    208|  uint8_t *zero_chunk = NULL;  // ...whether each reads as zeros (same allocation)
 1726|    208|  if (!set_slice && dctx->postfilter == NULL && nelems_slice >= array->blocknitems) {
  ------------------
  |  Branch (1726:7): [True: 138, False: 70]
  |  Branch (1726:21): [True: 138, False: 0]
  |  Branch (1726:49): [True: 138, False: 0]
  ------------------
 1727|    138|    slice_chunks = malloc((size_t) update_nchunks * (sizeof(int64_t) + 1));
 1728|    138|    if (slice_chunks == NULL) {
  ------------------
  |  Branch (1728:9): [True: 0, False: 138]
  ------------------
 1729|      0|      rc = BLOSC2_ERROR_MEMORY_ALLOC;
 1730|      0|      goto out;
 1731|      0|    }
 1732|    138|    zero_chunk = (uint8_t *) (slice_chunks + update_nchunks);
 1733|  1.35k|    for (int64_t u = 0; u < update_nchunks; ++u) {
  ------------------
  |  Branch (1733:25): [True: 1.22k, False: 138]
  ------------------
 1734|  1.22k|      int64_t idx[B2ND_MAX_DIM] = {0};
 1735|  1.22k|      blosc2_unidim_to_multidim(ndim, update_shape, u, idx);
 1736|  5.95k|      for (int i = 0; i < ndim; ++i) {
  ------------------
  |  Branch (1736:23): [True: 4.73k, False: 1.22k]
  ------------------
 1737|  4.73k|        idx[i] += update_start[i];
 1738|  4.73k|      }
 1739|  1.22k|      blosc2_multidim_to_unidim(idx, ndim, chunks_in_array_strides, &slice_chunks[u]);
 1740|  1.22k|    }
 1741|    138|    if (chunks_special(array->sc, slice_chunks, update_nchunks, zero_chunk) < 0) {
  ------------------
  |  Branch (1741:9): [True: 0, False: 138]
  ------------------
 1742|      0|      memset(zero_chunk, 0, (size_t) update_nchunks);  // the normal path reports what is wrong
 1743|      0|    }
 1744|    138|    int64_t zero_nitems = 0;
 1745|  1.35k|    for (int64_t u = 0; u < update_nchunks; ++u) {
  ------------------
  |  Branch (1745:25): [True: 1.22k, False: 138]
  ------------------
 1746|  1.22k|      zero_chunk[u] = zero_chunk[u] == BLOSC2_SPECIAL_ZERO || zero_chunk[u] == BLOSC2_SPECIAL_UNINIT;
  ------------------
  |  Branch (1746:23): [True: 64, False: 1.15k]
  |  Branch (1746:63): [True: 0, False: 1.15k]
  ------------------
 1747|  1.22k|      if (zero_chunk[u]) {
  ------------------
  |  Branch (1747:11): [True: 64, False: 1.15k]
  ------------------
 1748|     64|        int64_t cstart[B2ND_MAX_DIM], cstop[B2ND_MAX_DIM], bstart[B2ND_MAX_DIM], bstop[B2ND_MAX_DIM];
 1749|     64|        chunk_box(array, slice_chunks[u], start, stop, cstart, cstop);
 1750|     64|        zero_nitems += chunk_slice_box(ndim, cstart, cstop, start, stop, bstart, bstop);
 1751|     64|      }
 1752|  1.22k|    }
 1753|    138|    if (!slice_zeroed && 4 * zero_nitems >= nelems_slice) {
  ------------------
  |  Branch (1753:9): [True: 138, False: 0]
  |  Branch (1753:26): [True: 6, False: 132]
  ------------------
 1754|       |      // The slice's box of the buffer (the whole buffer unless slice_only; one memset() then)
 1755|      6|      int64_t zstart[B2ND_MAX_DIM] = {0};
 1756|      6|      int64_t zstop[B2ND_MAX_DIM];
 1757|     30|      for (int i = 0; i < ndim; ++i) {
  ------------------
  |  Branch (1757:23): [True: 24, False: 6]
  ------------------
 1758|     24|        zstop[i] = stop[i] - start[i];
 1759|     24|      }
 1760|      6|      b2nd_zero_box(ndim, array->sc->typesize, buffer_b, shape, zstart, zstop);
 1761|      6|      slice_zeroed = true;
 1762|      6|    }
 1763|    138|  }
 1764|       |
 1765|  2.03k|  for (int64_t update_nchunk = 0; update_nchunk < update_nchunks; ++update_nchunk) {
  ------------------
  |  Branch (1765:35): [True: 1.83k, False: 207]
  ------------------
 1766|  1.83k|    int64_t nchunk_ndim[B2ND_MAX_DIM] = {0};
 1767|  1.83k|    blosc2_unidim_to_multidim(ndim, update_shape, update_nchunk, nchunk_ndim);
 1768|  8.93k|    for (int i = 0; i < ndim; ++i) {
  ------------------
  |  Branch (1768:21): [True: 7.10k, False: 1.83k]
  ------------------
 1769|  7.10k|      nchunk_ndim[i] += update_start[i];
 1770|  7.10k|    }
 1771|  1.83k|    int64_t nchunk;
 1772|  1.83k|    blosc2_multidim_to_unidim(nchunk_ndim, ndim, chunks_in_array_strides, &nchunk);
 1773|       |
 1774|       |    // Check if the chunk needs to be updated
 1775|  1.83k|    int64_t chunk_start[B2ND_MAX_DIM] = {0};
 1776|  1.83k|    int64_t chunk_stop[B2ND_MAX_DIM] = {0};
 1777|  8.93k|    for (int i = 0; i < ndim; ++i) {
  ------------------
  |  Branch (1777:21): [True: 7.10k, False: 1.83k]
  ------------------
 1778|  7.10k|      chunk_start[i] = nchunk_ndim[i] * array->chunkshape[i];
 1779|  7.10k|      chunk_stop[i] = chunk_start[i] + array->chunkshape[i];
 1780|  7.10k|      if (chunk_stop[i] > array->shape[i]) {
  ------------------
  |  Branch (1780:11): [True: 1.23k, False: 5.86k]
  ------------------
 1781|  1.23k|        chunk_stop[i] = array->shape[i];
 1782|  1.23k|      }
 1783|  7.10k|    }
 1784|  1.83k|    bool chunk_empty = false;
 1785|  8.93k|    for (int i = 0; i < ndim; ++i) {
  ------------------
  |  Branch (1785:21): [True: 7.10k, False: 1.83k]
  ------------------
 1786|  7.10k|      chunk_empty |= (chunk_stop[i] <= start[i] || chunk_start[i] >= stop[i]);
  ------------------
  |  Branch (1786:23): [True: 0, False: 7.10k]
  |  Branch (1786:52): [True: 0, False: 7.10k]
  ------------------
 1787|  7.10k|    }
 1788|  1.83k|    if (chunk_empty) {
  ------------------
  |  Branch (1788:9): [True: 0, False: 1.83k]
  ------------------
 1789|      0|      continue;
 1790|      0|    }
 1791|  1.83k|    if (zero_chunk != NULL && zero_chunk[update_nchunk]) {
  ------------------
  |  Branch (1791:9): [True: 1.22k, False: 611]
  |  Branch (1791:31): [True: 64, False: 1.15k]
  ------------------
 1792|     64|      if (!slice_zeroed) {
  ------------------
  |  Branch (1792:11): [True: 6, False: 58]
  ------------------
 1793|      6|        int64_t box_start[B2ND_MAX_DIM];
 1794|      6|        int64_t box_stop[B2ND_MAX_DIM];
 1795|      6|        chunk_slice_box(ndim, chunk_start, chunk_stop, start, stop, box_start, box_stop);
 1796|      6|        b2nd_zero_box(ndim, array->sc->typesize, buffer_b, shape, box_start, box_stop);
 1797|      6|      }
 1798|     64|      continue;
 1799|     64|    }
 1800|       |    // Decompress each chunk as soon as it has been read ahead, while the later ones are still coming in
 1801|  1.76k|    prefetch_batch_wait(prefetch, nchunk);
 1802|  1.76k|    slice_chunk_t slice_chunk;
 1803|  1.76k|    memset(&slice_chunk, 0, sizeof(slice_chunk));
 1804|  1.76k|    slice_chunk.array = array;
 1805|  1.76k|    slice_chunk.buffer = buffer_b;
 1806|  1.76k|    slice_chunk.buffershape = shape;
 1807|  1.76k|    slice_chunk.start = start;
 1808|  1.76k|    slice_chunk.stop = stop;
 1809|  1.76k|    slice_chunk.chunk_start = chunk_start;
 1810|  1.76k|    slice_chunk.chunk_stop = chunk_stop;
 1811|  1.76k|    slice_chunk.blocks_in_chunk = blocks_in_chunk;
 1812|  1.76k|    slice_chunk.blockshape = blockshape;
 1813|       |
 1814|       |    // A whole chunk that is one run of the buffer in its decompressed layout
 1815|       |    // is (de)compressed straight from/into the buffer.
 1816|  1.76k|    int64_t run_offset;
 1817|  1.76k|    if (blocks_in_c_order &&
  ------------------
  |  Branch (1817:9): [True: 411, False: 1.35k]
  ------------------
 1818|    411|        chunk_contiguous_in_buffer(array, chunk_start, start, stop, shape, &run_offset)) {
  ------------------
  |  Branch (1818:9): [True: 43, False: 368]
  ------------------
 1819|     43|      uint8_t *run = buffer_b + run_offset;
 1820|     43|      if (set_slice) {
  ------------------
  |  Branch (1820:11): [True: 15, False: 28]
  ------------------
 1821|     15|        rc = compress_update_chunk(array, nchunk, run, data_nbytes, NULL);
 1822|     15|        if (rc < 0) {
  ------------------
  |  Branch (1822:13): [True: 1, False: 14]
  ------------------
 1823|      1|          goto out;
 1824|      1|        }
 1825|     15|      }
 1826|     28|      else {
 1827|       |        // All threads start writing their blocks at once; with shares
 1828|       |        // below a huge page several of them hit each one
 1829|     28|        if (prefault && data_nbytes / dctx->nthreads < (1 << 20) &&
  ------------------
  |  Branch (1829:13): [True: 0, False: 28]
  |  Branch (1829:25): [True: 0, False: 0]
  ------------------
 1830|      0|            block_nbytes < (1 << 20)) {
  ------------------
  |  Branch (1830:13): [True: 0, False: 0]
  ------------------
 1831|      0|          prefault_range(run, data_nbytes);
 1832|      0|        }
 1833|     28|        rc = blosc2_schunk_decompress_chunk(array->sc, nchunk, run, data_nbytes);
 1834|     28|        if (rc < 0) {
  ------------------
  |  Branch (1834:13): [True: 0, False: 28]
  ------------------
 1835|      0|          BLOSC_TRACE_ERROR("Error decompressing chunk");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1836|      0|          goto out;
 1837|      0|        }
 1838|     28|        if (decoded_nothing(dctx, rc)) {
  ------------------
  |  Branch (1838:13): [True: 0, False: 28]
  ------------------
 1839|      0|          memset(run, 0, (size_t)data_nbytes);
 1840|      0|        }
 1841|     28|        rc = BLOSC2_ERROR_SUCCESS;
 1842|     28|      }
 1843|     42|      continue;
 1844|     43|    }
 1845|       |
 1846|       |    // Compact get path state for this chunk (see below).
 1847|  1.76k|    bool use_compact = false;
 1848|  1.72k|    uint8_t *lazychunk = NULL;
 1849|  1.72k|    bool lazychunk_needs_free = false;
 1850|  1.72k|    int32_t lazychunk_cbytes = 0;
 1851|  1.72k|    if (set_slice) {
  ------------------
  |  Branch (1851:9): [True: 596, False: 1.12k]
  ------------------
 1852|    596|      if (data == NULL) {
  ------------------
  |  Branch (1852:11): [True: 57, False: 539]
  ------------------
 1853|     57|        data = scratch_malloc(array, data_nbytes, &data_capacity);
 1854|     57|        if (data == NULL) {
  ------------------
  |  Branch (1854:13): [True: 0, False: 57]
  ------------------
 1855|      0|          rc = BLOSC2_ERROR_MEMORY_ALLOC;
 1856|      0|          goto out;
 1857|      0|        }
 1858|     57|      }
 1859|       |      // Check if all the chunk is going to be updated and avoid the decompression
 1860|    596|      bool decompress_chunk = false;
 1861|  2.92k|      for (int i = 0; i < ndim; ++i) {
  ------------------
  |  Branch (1861:23): [True: 2.32k, False: 596]
  ------------------
 1862|  2.32k|        decompress_chunk |= (chunk_start[i] < start[i] || chunk_stop[i] > stop[i]);
  ------------------
  |  Branch (1862:30): [True: 0, False: 2.32k]
  |  Branch (1862:59): [True: 0, False: 2.32k]
  ------------------
 1863|  2.32k|      }
 1864|       |
 1865|       |      // On a partly overwritten chunk the gather copies every block that
 1866|       |      // keeps old items once more, so it only pays when the slice covers a
 1867|       |      // good part of the chunk.
 1868|    596|      int64_t box_start[B2ND_MAX_DIM];
 1869|    596|      int64_t box_stop[B2ND_MAX_DIM];
 1870|    596|      int64_t overlap_nitems = chunk_slice_box(ndim, chunk_start, chunk_stop, start, stop,
 1871|    596|                                               box_start, box_stop);
 1872|    596|      if (can_gather && (!decompress_chunk || 2 * overlap_nitems >= array->extchunknitems)) {
  ------------------
  |  Branch (1872:11): [True: 538, False: 58]
  |  Branch (1872:26): [True: 538, False: 0]
  |  Branch (1872:47): [True: 0, False: 0]
  ------------------
 1873|       |        // Gather path: the compression threads take the new items straight
 1874|       |        // from the buffer.  Only blocks keeping some old items need the old
 1875|       |        // chunk, and when there are none `data` stays untouched.
 1876|    538|        if (decompress_chunk) {
  ------------------
  |  Branch (1876:13): [True: 0, False: 538]
  ------------------
 1877|      0|          if (block_maskout == NULL) {
  ------------------
  |  Branch (1877:15): [True: 0, False: 0]
  ------------------
 1878|      0|            block_maskout = malloc(nblocks);
 1879|      0|            if (block_maskout == NULL) {
  ------------------
  |  Branch (1879:17): [True: 0, False: 0]
  ------------------
 1880|      0|              rc = BLOSC2_ERROR_MEMORY_ALLOC;
 1881|      0|              goto out;
 1882|      0|            }
 1883|      0|          }
 1884|      0|          for (int nblock = 0; nblock < nblocks; ++nblock) {
  ------------------
  |  Branch (1884:32): [True: 0, False: 0]
  ------------------
 1885|      0|            block_overlap_t overlap;
 1886|      0|            block_maskout[nblock] = block_slice_overlap(&slice_chunk, nblock, &overlap) &&
  ------------------
  |  Branch (1886:37): [True: 0, False: 0]
  ------------------
 1887|      0|                                    overlap.whole_block;
  ------------------
  |  Branch (1887:37): [True: 0, False: 0]
  ------------------
 1888|      0|          }
 1889|      0|          int err = schunk_decompress_masked(array->sc, nchunk, NULL, 0, block_maskout, nblocks,
 1890|      0|                                             NULL, NULL, data, data_nbytes);
 1891|      0|          if (err < 0) {
  ------------------
  |  Branch (1891:15): [True: 0, False: 0]
  ------------------
 1892|      0|            BLOSC_TRACE_ERROR("Error decompressing chunk");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1893|      0|            rc = BLOSC2_ERROR_FAILURE;
 1894|      0|            goto out;
 1895|      0|          }
 1896|      0|          if (decoded_nothing(dctx, err)) {
  ------------------
  |  Branch (1896:15): [True: 0, False: 0]
  ------------------
 1897|      0|            memset(data, 0, data_nbytes);
 1898|      0|          }
 1899|      0|        }
 1900|    538|        slice_chunk.keep_old = decompress_chunk;
 1901|    538|        rc = compress_update_chunk(array, nchunk, data, data_nbytes, &slice_chunk);
 1902|    538|        if (rc < 0) {
  ------------------
  |  Branch (1902:13): [True: 0, False: 538]
  ------------------
 1903|      0|          goto out;
 1904|      0|        }
 1905|    538|        continue;
 1906|    538|      }
 1907|       |
 1908|     58|      if (decompress_chunk) {
  ------------------
  |  Branch (1908:11): [True: 0, False: 58]
  ------------------
 1909|      0|        int err = blosc2_schunk_decompress_chunk(array->sc, nchunk, data, data_nbytes);
 1910|      0|        if (err < 0) {
  ------------------
  |  Branch (1910:13): [True: 0, False: 0]
  ------------------
 1911|      0|          BLOSC_TRACE_ERROR("Error decompressing chunk");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1912|      0|          rc = BLOSC2_ERROR_FAILURE;
 1913|      0|          goto out;
 1914|      0|        }
 1915|      0|        if (decoded_nothing(dctx, err)) {
  ------------------
  |  Branch (1915:13): [True: 0, False: 0]
  ------------------
 1916|      0|          memset(data, 0, data_nbytes);
 1917|      0|        }
 1918|     58|      } else {
 1919|       |        // Avoid writing non zero padding from previous chunk
 1920|     58|        memset(data, 0, data_nbytes);
 1921|     58|      }
 1922|  1.12k|    } else {
 1923|  1.12k|      if (block_maskout == NULL) {
  ------------------
  |  Branch (1923:11): [True: 114, False: 1.01k]
  ------------------
 1924|    114|        block_maskout = malloc(nblocks);
 1925|    114|        if (block_maskout == NULL) {
  ------------------
  |  Branch (1925:13): [True: 0, False: 114]
  ------------------
 1926|      0|          rc = BLOSC2_ERROR_MEMORY_ALLOC;
 1927|      0|          goto out;
 1928|      0|        }
 1929|    114|      }
 1930|       |      // Delta filter encodes subsequent blocks relative to the reference block (block 0): if any block in the chunk
 1931|       |      // is needed, block 0 must be decompressed as reference
 1932|  1.12k|      int32_t nblocks_needed = (int32_t) slice_chunk_maskout(&slice_chunk, nblocks, has_delta, block_maskout);
 1933|       |
 1934|       |      // Compact get path: when only a fraction of the chunk's blocks is
 1935|       |      // needed, decompress just those blocks -- one at a time, straight
 1936|       |      // from the (lazy)chunk -- instead of decompressing into a chunk-sized
 1937|       |      // scratch.  This keeps the working buffer at one block, so small reads
 1938|       |      // from arrays with large chunks stay O(request), not O(chunksize).
 1939|       |      // Larger requests keep the maskout path, which decompresses the needed
 1940|       |      // blocks in parallel.
 1941|       |      //
 1942|       |      // The threshold depends on the storage backend.  On disk, the maskout
 1943|       |      // path reads the *whole* compressed chunk per call while the compact
 1944|       |      // path only reads the touched blocks, so compact wins by 10-100x well
 1945|       |      // past needed == nblocks/4 for typical data.  In memory there is no
 1946|       |      // I/O to save: for poorly-compressible data the maskout path's
 1947|       |      // parallel decompression overtakes the compact path's serial one at
 1948|       |      // around 2-4 needed blocks, so stay conservative there (1/16 keeps
 1949|       |      // the possible loss window narrow while still capturing the common
 1950|       |      // 1-2 block reads, where compact always wins or ties).
 1951|       |      //
 1952|       |      // If DELTA is used, blocks cannot be decompressed independently; keep maskout path.
 1953|  1.12k|      use_compact = slice_chunk_compact(array, nblocks_needed, has_delta);
 1954|  1.12k|      if (use_compact) {
  ------------------
  |  Branch (1954:11): [True: 2, False: 1.12k]
  ------------------
 1955|      2|        lazychunk_cbytes = blosc2_schunk_get_lazychunk(array->sc, nchunk, &lazychunk,
 1956|      2|                                                       &lazychunk_needs_free);
 1957|      2|        if (lazychunk_cbytes < 0) {
  ------------------
  |  Branch (1957:13): [True: 0, False: 2]
  ------------------
 1958|      0|          BLOSC_TRACE_ERROR("Error getting the lazy chunk");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1959|      0|          rc = BLOSC2_ERROR_FAILURE;
 1960|      0|          goto out;
 1961|      0|        }
 1962|      2|        if (block_data == NULL) {
  ------------------
  |  Branch (1962:13): [True: 2, False: 0]
  ------------------
 1963|      2|          block_data = scratch_malloc(array, block_nbytes, &block_data_capacity);
 1964|      2|          if (block_data == NULL) {
  ------------------
  |  Branch (1964:15): [True: 0, False: 2]
  ------------------
 1965|      0|            if (lazychunk_needs_free) {
  ------------------
  |  Branch (1965:17): [True: 0, False: 0]
  ------------------
 1966|      0|              free(lazychunk);
 1967|      0|            }
 1968|      0|            rc = BLOSC2_ERROR_MEMORY_ALLOC;
 1969|      0|            goto out;
 1970|      0|          }
 1971|      2|        }
 1972|  1.12k|      } else {
 1973|  1.12k|        if (data == NULL) {
  ------------------
  |  Branch (1973:13): [True: 114, False: 1.01k]
  ------------------
 1974|    114|          data = scratch_malloc(array, data_nbytes, &data_capacity);
 1975|    114|          if (data == NULL) {
  ------------------
  |  Branch (1975:15): [True: 0, False: 114]
  ------------------
 1976|      0|            rc = BLOSC2_ERROR_MEMORY_ALLOC;
 1977|      0|            goto out;
 1978|      0|          }
 1979|    114|        }
 1980|  1.12k|        bool scattered = false;
 1981|  1.12k|        if (can_scatter) {
  ------------------
  |  Branch (1981:13): [True: 1.01k, False: 112]
  ------------------
 1982|       |          // Scatter path: the needed blocks go from the worker threads that
 1983|       |          // decode them straight to the buffer.  `data` only satisfies the
 1984|       |          // decompressor's destination size and stays untouched.
 1985|  1.01k|          int64_t box_start[B2ND_MAX_DIM];
 1986|  1.01k|          int64_t box_stop[B2ND_MAX_DIM];
 1987|  1.01k|          chunk_slice_box(ndim, chunk_start, chunk_stop, start, stop, box_start, box_stop);
 1988|  1.01k|          if (prefault) {
  ------------------
  |  Branch (1988:15): [True: 0, False: 1.01k]
  ------------------
 1989|      0|            int64_t box_last[B2ND_MAX_DIM];
 1990|      0|            for (int i = 0; i < ndim; ++i) {
  ------------------
  |  Branch (1990:29): [True: 0, False: 0]
  ------------------
 1991|      0|              box_last[i] = box_stop[i] - 1;
 1992|      0|            }
 1993|      0|            int64_t first;
 1994|      0|            int64_t last;
 1995|      0|            blosc2_multidim_to_unidim(box_start, ndim, buffer_strides, &first);
 1996|      0|            blosc2_multidim_to_unidim(box_last, ndim, buffer_strides, &last);
 1997|      0|            prefault_range(buffer_b + first * array->sc->typesize,
 1998|      0|                           (last + 1 - first) * array->sc->typesize);
 1999|      0|          }
 2000|  1.01k|          int err = schunk_decompress_masked(array->sc, nchunk, NULL, 0, block_maskout, nblocks,
 2001|  1.01k|                                             slice_scatter_postfilter, &slice_chunk, data, data_nbytes);
 2002|  1.01k|          if (err < 0) {
  ------------------
  |  Branch (2002:15): [True: 0, False: 1.01k]
  ------------------
 2003|      0|            BLOSC_TRACE_ERROR("Error decompressing chunk");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2004|      0|            rc = BLOSC2_ERROR_FAILURE;
 2005|      0|            goto out;
 2006|      0|          }
 2007|  1.01k|          if (err == 0) {
  ------------------
  |  Branch (2007:15): [True: 0, False: 1.01k]
  ------------------
 2008|       |            // Missing chunk: nothing was decoded
 2009|      0|            b2nd_zero_box(ndim, array->sc->typesize, buffer_b, shape, box_start, box_stop);
 2010|      0|          }
 2011|  1.01k|          scattered = err == 0 || !scatter_unsupported(dctx);
  ------------------
  |  Branch (2011:23): [True: 0, False: 1.01k]
  |  Branch (2011:35): [True: 1.01k, False: 0]
  ------------------
 2012|  1.01k|        }
 2013|  1.12k|        if (scattered) {
  ------------------
  |  Branch (2013:13): [True: 1.01k, False: 112]
  ------------------
 2014|  1.01k|          continue;
 2015|  1.01k|        }
 2016|    112|        int err = schunk_decompress_masked(array->sc, nchunk, NULL, 0, block_maskout, nblocks,
 2017|    112|                                           NULL, NULL, data, data_nbytes);
 2018|    112|        if (err < 0) {
  ------------------
  |  Branch (2018:13): [True: 0, False: 112]
  ------------------
 2019|      0|          BLOSC_TRACE_ERROR("Error decompressing chunk");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2020|      0|          rc = BLOSC2_ERROR_FAILURE;
 2021|      0|          goto out;
 2022|      0|        }
 2023|    112|        if (decoded_nothing(dctx, err)) {
  ------------------
  |  Branch (2023:13): [True: 0, False: 112]
  ------------------
 2024|      0|          memset(data, 0, data_nbytes);
 2025|      0|        }
 2026|    112|      }
 2027|  1.12k|    }
 2028|       |
 2029|       |    // Iterate over blocks
 2030|       |
 2031|  2.80k|    for (int nblock = 0; nblock < nblocks; ++nblock) {
  ------------------
  |  Branch (2031:26): [True: 2.63k, False: 172]
  ------------------
 2032|  2.63k|      block_overlap_t overlap;
 2033|  2.63k|      if (!block_slice_overlap(&slice_chunk, nblock, &overlap)) {
  ------------------
  |  Branch (2033:11): [True: 414, False: 2.21k]
  ------------------
 2034|    414|        continue;
 2035|    414|      }
 2036|       |
 2037|  2.21k|      uint8_t *dst;
 2038|  2.21k|      if (use_compact) {
  ------------------
  |  Branch (2038:11): [True: 2, False: 2.21k]
  ------------------
 2039|       |        // Decompress just this block from the (lazy)chunk.
 2040|      2|        int grc = blosc2_getitem_bytes_ctx(array->sc->dctx, lazychunk, lazychunk_cbytes,
 2041|      2|                                           (int32_t) ((int64_t) nblock * block_nbytes), block_nbytes,
 2042|      2|                                           block_data, block_nbytes);
 2043|      2|        if (grc < 0) {
  ------------------
  |  Branch (2043:13): [True: 0, False: 2]
  ------------------
 2044|      0|          BLOSC_TRACE_ERROR("Error decompressing block");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2045|      0|          if (lazychunk_needs_free) {
  ------------------
  |  Branch (2045:15): [True: 0, False: 0]
  ------------------
 2046|      0|            free(lazychunk);
 2047|      0|          }
 2048|      0|          rc = BLOSC2_ERROR_FAILURE;
 2049|      0|          goto out;
 2050|      0|        }
 2051|      2|        if (decoded_nothing(dctx, grc)) {
  ------------------
  |  Branch (2051:13): [True: 0, False: 2]
  ------------------
 2052|      0|          memset(block_data, 0, block_nbytes);
 2053|      0|        }
 2054|      2|        dst = block_data;
 2055|  2.21k|      } else {
 2056|  2.21k|        dst = &data[nblock * array->blocknitems * array->sc->typesize];
 2057|  2.21k|      }
 2058|       |
 2059|  2.21k|      if (set_slice) {
  ------------------
  |  Branch (2059:11): [True: 740, False: 1.47k]
  ------------------
 2060|    740|        b2nd_copy_buffer2(ndim, array->sc->typesize,
 2061|    740|                          buffer_b, shape, overlap.dst_start, overlap.dst_stop,
 2062|    740|                          dst, blockshape, overlap.src_start);
 2063|  1.47k|      } else {
 2064|  1.47k|        b2nd_copy_buffer2(ndim, array->sc->typesize,
 2065|  1.47k|                          dst, blockshape, overlap.src_start, overlap.src_stop,
 2066|  1.47k|                          buffer_b, shape, overlap.dst_start);
 2067|  1.47k|      }
 2068|  2.21k|    }
 2069|       |
 2070|    172|    if (use_compact && lazychunk_needs_free) {
  ------------------
  |  Branch (2070:9): [True: 2, False: 170]
  |  Branch (2070:24): [True: 0, False: 2]
  ------------------
 2071|      0|      free(lazychunk);
 2072|      0|    }
 2073|       |
 2074|    172|    if (set_slice) {
  ------------------
  |  Branch (2074:9): [True: 58, False: 114]
  ------------------
 2075|     58|      rc = compress_update_chunk(array, nchunk, data, data_nbytes, NULL);
 2076|     58|      if (rc < 0) {
  ------------------
  |  Branch (2076:11): [True: 0, False: 58]
  ------------------
 2077|      0|        goto out;
 2078|      0|      }
 2079|     58|    }
 2080|    172|  }
 2081|       |
 2082|    208|  out:
 2083|    208|  free(slice_chunks);
 2084|    208|  prefetch_batch_free(own_prefetch);
 2085|    208|  blosc2_tmp_free(data, data_capacity);
 2086|    208|  blosc2_tmp_free(block_data, block_data_capacity);
 2087|    208|  free(block_maskout);
 2088|       |
 2089|    208|  return rc;
 2090|    208|}
b2nd_get_slice_cbuffer:
 2130|    138|                           void *buffer, const int64_t *buffershape, int64_t buffersize) {
 2131|    138|  BLOSC_ERROR_NULL(array, BLOSC2_ERROR_NULL_POINTER);
  ------------------
  |  |  104|    138|    do {                                            \
  |  |  105|    138|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 138]
  |  |  ------------------
  |  |  106|      0|            BLOSC_TRACE_ERROR("Pointer is null");   \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  107|      0|            return (rc);                            \
  |  |  108|      0|        }                                           \
  |  |  109|    138|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 138]
  |  |  ------------------
  ------------------
 2132|    138|  BLOSC_ERROR_NULL(start, BLOSC2_ERROR_NULL_POINTER);
  ------------------
  |  |  104|    138|    do {                                            \
  |  |  105|    138|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 138]
  |  |  ------------------
  |  |  106|      0|            BLOSC_TRACE_ERROR("Pointer is null");   \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  107|      0|            return (rc);                            \
  |  |  108|      0|        }                                           \
  |  |  109|    138|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 138]
  |  |  ------------------
  ------------------
 2133|    138|  BLOSC_ERROR_NULL(stop, BLOSC2_ERROR_NULL_POINTER);
  ------------------
  |  |  104|    138|    do {                                            \
  |  |  105|    138|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 138]
  |  |  ------------------
  |  |  106|      0|            BLOSC_TRACE_ERROR("Pointer is null");   \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  107|      0|            return (rc);                            \
  |  |  108|      0|        }                                           \
  |  |  109|    138|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 138]
  |  |  ------------------
  ------------------
 2134|    138|  BLOSC_ERROR_NULL(buffershape, BLOSC2_ERROR_NULL_POINTER);
  ------------------
  |  |  104|    138|    do {                                            \
  |  |  105|    138|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 138]
  |  |  ------------------
  |  |  106|      0|            BLOSC_TRACE_ERROR("Pointer is null");   \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  107|      0|            return (rc);                            \
  |  |  108|      0|        }                                           \
  |  |  109|    138|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 138]
  |  |  ------------------
  ------------------
 2135|    138|  BLOSC_ERROR_NULL(buffer, BLOSC2_ERROR_NULL_POINTER);
  ------------------
  |  |  104|    138|    do {                                            \
  |  |  105|    138|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 138]
  |  |  ------------------
  |  |  106|      0|            BLOSC_TRACE_ERROR("Pointer is null");   \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  107|      0|            return (rc);                            \
  |  |  108|      0|        }                                           \
  |  |  109|    138|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 138]
  |  |  ------------------
  ------------------
 2136|       |
 2137|    138|  return locked_get_set_slice(buffer, buffersize, start, stop, buffershape, (b2nd_array_t *) array,
 2138|    138|                              false, false, NULL);
 2139|    138|}
b2nd_set_slice_cbuffer:
 2189|     70|                           b2nd_array_t *array) {
 2190|     70|  BLOSC_ERROR_NULL(buffer, BLOSC2_ERROR_NULL_POINTER);
  ------------------
  |  |  104|     70|    do {                                            \
  |  |  105|     70|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 70]
  |  |  ------------------
  |  |  106|      0|            BLOSC_TRACE_ERROR("Pointer is null");   \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  107|      0|            return (rc);                            \
  |  |  108|      0|        }                                           \
  |  |  109|     70|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 70]
  |  |  ------------------
  ------------------
 2191|     70|  BLOSC_ERROR_NULL(start, BLOSC2_ERROR_NULL_POINTER);
  ------------------
  |  |  104|     70|    do {                                            \
  |  |  105|     70|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 70]
  |  |  ------------------
  |  |  106|      0|            BLOSC_TRACE_ERROR("Pointer is null");   \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  107|      0|            return (rc);                            \
  |  |  108|      0|        }                                           \
  |  |  109|     70|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 70]
  |  |  ------------------
  ------------------
 2192|     70|  BLOSC_ERROR_NULL(stop, BLOSC2_ERROR_NULL_POINTER);
  ------------------
  |  |  104|     70|    do {                                            \
  |  |  105|     70|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 70]
  |  |  ------------------
  |  |  106|      0|            BLOSC_TRACE_ERROR("Pointer is null");   \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  107|      0|            return (rc);                            \
  |  |  108|      0|        }                                           \
  |  |  109|     70|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 70]
  |  |  ------------------
  ------------------
 2193|     70|  BLOSC_ERROR_NULL(array, BLOSC2_ERROR_NULL_POINTER);
  ------------------
  |  |  104|     70|    do {                                            \
  |  |  105|     70|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 70]
  |  |  ------------------
  |  |  106|      0|            BLOSC_TRACE_ERROR("Pointer is null");   \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  107|      0|            return (rc);                            \
  |  |  108|      0|        }                                           \
  |  |  109|     70|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 70]
  |  |  ------------------
  ------------------
 2194|       |
 2195|     70|  return locked_get_set_slice((void *) buffer, buffersize, start, stop, buffershape, array, true, false, NULL);
 2196|     70|}
b2nd_create_ctx:
 3742|     70|                int32_t nmetalayers) {
 3743|     70|  if (ndim < 0 || ndim > B2ND_MAX_DIM) {
  ------------------
  |  |   50|     70|#define B2ND_MAX_DIM 16
  ------------------
  |  Branch (3743:7): [True: 0, False: 70]
  |  Branch (3743:19): [True: 0, False: 70]
  ------------------
 3744|      0|    BLOSC_TRACE_ERROR("ndim must be in [0, %d]", B2ND_MAX_DIM);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  ------------------
  |  |  |  |  |  | 3744|      0|    BLOSC_TRACE_ERROR("ndim must be in [0, %d]", B2ND_MAX_DIM);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   50|      0|#define B2ND_MAX_DIM 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3745|      0|    return NULL;
 3746|      0|  }
 3747|       |
 3748|     70|  if (ndim > 0) {
  ------------------
  |  Branch (3748:7): [True: 70, False: 0]
  ------------------
 3749|     70|    if (shape == NULL || chunkshape == NULL || blockshape == NULL) {
  ------------------
  |  Branch (3749:9): [True: 0, False: 70]
  |  Branch (3749:26): [True: 0, False: 70]
  |  Branch (3749:48): [True: 0, False: 70]
  ------------------
 3750|      0|      BLOSC_TRACE_ERROR("shape, chunkshape and blockshape cannot be NULL when ndim > 0");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3751|      0|      return NULL;
 3752|      0|    }
 3753|     70|    if (validate_shape_chunkshape_blockshape(ndim, shape, chunkshape, blockshape) < 0) {
  ------------------
  |  Branch (3753:9): [True: 0, False: 70]
  ------------------
 3754|      0|      return NULL;
 3755|      0|    }
 3756|     70|  }
 3757|       |
 3758|     70|  b2nd_context_t *ctx = malloc(sizeof(b2nd_context_t));
 3759|     70|  BLOSC_ERROR_NULL(ctx, NULL);
  ------------------
  |  |  104|     70|    do {                                            \
  |  |  105|     70|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 70]
  |  |  ------------------
  |  |  106|      0|            BLOSC_TRACE_ERROR("Pointer is null");   \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  107|      0|            return (rc);                            \
  |  |  108|      0|        }                                           \
  |  |  109|     70|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 70]
  |  |  ------------------
  ------------------
 3760|     70|  blosc2_storage *params_b2_storage = malloc(sizeof(blosc2_storage));
 3761|     70|  BLOSC_ERROR_NULL(params_b2_storage, NULL);
  ------------------
  |  |  104|     70|    do {                                            \
  |  |  105|     70|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 70]
  |  |  ------------------
  |  |  106|      0|            BLOSC_TRACE_ERROR("Pointer is null");   \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  107|      0|            return (rc);                            \
  |  |  108|      0|        }                                           \
  |  |  109|     70|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 70]
  |  |  ------------------
  ------------------
 3762|     70|  if (b2_storage == NULL) {
  ------------------
  |  Branch (3762:7): [True: 0, False: 70]
  ------------------
 3763|      0|    memcpy(params_b2_storage, &BLOSC2_STORAGE_DEFAULTS, sizeof(blosc2_storage));
 3764|      0|  }
 3765|     70|  else {
 3766|     70|    memcpy(params_b2_storage, b2_storage, sizeof(blosc2_storage));
 3767|     70|  }
 3768|     70|  blosc2_cparams *cparams = malloc(sizeof(blosc2_cparams));
 3769|     70|  BLOSC_ERROR_NULL(cparams, NULL);
  ------------------
  |  |  104|     70|    do {                                            \
  |  |  105|     70|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 70]
  |  |  ------------------
  |  |  106|      0|            BLOSC_TRACE_ERROR("Pointer is null");   \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  107|      0|            return (rc);                            \
  |  |  108|      0|        }                                           \
  |  |  109|     70|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 70]
  |  |  ------------------
  ------------------
 3770|       |  // We need a copy of cparams mainly to be able to modify blocksize
 3771|     70|  if (params_b2_storage->cparams == NULL) {
  ------------------
  |  Branch (3771:7): [True: 0, False: 70]
  ------------------
 3772|      0|    memcpy(cparams, &BLOSC2_CPARAMS_DEFAULTS, sizeof(blosc2_cparams));
 3773|      0|  }
 3774|     70|  else {
 3775|     70|    memcpy(cparams, params_b2_storage->cparams, sizeof(blosc2_cparams));
 3776|     70|  }
 3777|       |
 3778|     70|  if (dtype == NULL) {
  ------------------
  |  Branch (3778:7): [True: 70, False: 0]
  ------------------
 3779|       |    // ctx->dtype = strdup(B2ND_DEFAULT_DTYPE);
 3780|     70|    char buf[16] = {0};
 3781|     70|    snprintf(buf, sizeof(buf), "|S%d", cparams->typesize);
 3782|     70|    ctx->dtype = strdup(buf);
 3783|     70|  }
 3784|      0|  else {
 3785|      0|    ctx->dtype = strdup(dtype);
 3786|      0|  }
 3787|     70|  ctx->dtype_format = dtype_format;
 3788|       |
 3789|     70|  params_b2_storage->cparams = cparams;
 3790|     70|  ctx->b2_storage = params_b2_storage;
 3791|     70|  ctx->ndim = ndim;
 3792|     70|  int32_t blocknitems = 1;
 3793|     70|  bool blocksize_overflow = false;
 3794|    323|  for (int i = 0; i < ndim; i++) {
  ------------------
  |  Branch (3794:19): [True: 253, False: 70]
  ------------------
 3795|    253|    ctx->shape[i] = shape[i];
 3796|    253|    ctx->chunkshape[i] = chunkshape[i];
 3797|    253|    ctx->blockshape[i] = blockshape[i];
 3798|    253|    if (!blosc2_checked_mul_i32_nonneg(blocknitems, ctx->blockshape[i], &blocknitems)) {
  ------------------
  |  Branch (3798:9): [True: 0, False: 253]
  ------------------
 3799|      0|      blocksize_overflow = true;
 3800|      0|      break;
 3801|      0|    }
 3802|    253|  }
 3803|       |  // update_shape_struct() rejects this too, but only once an array is built out
 3804|       |  // of the context; catching it here keeps cparams->blocksize from wrapping
 3805|     70|  if (blocksize_overflow ||
  ------------------
  |  Branch (3805:7): [True: 0, False: 70]
  ------------------
 3806|     70|      !blosc2_checked_mul_i32_nonneg(blocknitems, cparams->typesize, &cparams->blocksize)) {
  ------------------
  |  Branch (3806:7): [True: 0, False: 70]
  ------------------
 3807|      0|    BLOSC_TRACE_ERROR("blockshape product overflows the maximum blocksize");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3808|      0|    free(ctx->dtype);
 3809|      0|    free(cparams);
 3810|      0|    free(params_b2_storage);
 3811|      0|    free(ctx);
 3812|      0|    return NULL;
 3813|      0|  }
 3814|       |
 3815|     70|  ctx->nmetalayers = nmetalayers;
 3816|     70|  for (int i = 0; i < nmetalayers; ++i) {
  ------------------
  |  Branch (3816:19): [True: 0, False: 70]
  ------------------
 3817|      0|    ctx->metalayers[i] = metalayers[i];
 3818|      0|  }
 3819|       |
 3820|       |#if defined(HAVE_ZFP)
 3821|       |  #include "blosc2/codecs-registry.h"
 3822|       |  if ((ctx->b2_storage->cparams->compcode >= BLOSC_CODEC_ZFP_FIXED_ACCURACY) &&
 3823|       |      (ctx->b2_storage->cparams->compcode <= BLOSC_CODEC_ZFP_FIXED_RATE)) {
 3824|       |    for (int i = 0; i < BLOSC2_MAX_FILTERS; ++i) {
 3825|       |      if ((ctx->b2_storage->cparams->filters[i] == BLOSC_SHUFFLE) ||
 3826|       |          (ctx->b2_storage->cparams->filters[i] == BLOSC_BITSHUFFLE)) {
 3827|       |        BLOSC_TRACE_ERROR("ZFP cannot be run in presence of SHUFFLE / BITSHUFFLE");
 3828|       |        return NULL;
 3829|       |      }
 3830|       |    }
 3831|       |  }
 3832|       |#endif /* HAVE_ZFP */
 3833|       |
 3834|     70|  return ctx;
 3835|     70|}
b2nd_free_ctx:
 3838|     70|int b2nd_free_ctx(b2nd_context_t *ctx) {
 3839|     70|  ctx->b2_storage->cparams->schunk = NULL;
 3840|     70|  free(ctx->b2_storage->cparams);
 3841|     70|  free(ctx->b2_storage);
 3842|     70|  free(ctx->dtype);
 3843|     70|  free(ctx);
 3844|       |
 3845|     70|  return BLOSC2_ERROR_SUCCESS;
 3846|     70|}
b2nd.c:update_shape_struct:
  155|    209|                               const int32_t *chunkshape, const int32_t *blockshape) {
  156|    209|  BLOSC_ERROR(validate_shape_chunkshape_blockshape(ndim, shape, chunkshape, blockshape));
  ------------------
  |  |  111|    209|    do {                                            \
  |  |  112|    209|        int rc_ = (rc);                             \
  |  |  113|    209|        if (rc_ < BLOSC2_ERROR_SUCCESS) {           \
  |  |  ------------------
  |  |  |  Branch (113:13): [True: 0, False: 209]
  |  |  ------------------
  |  |  114|      0|            char *error_msg = print_error(rc_);     \
  |  |  115|      0|            BLOSC_TRACE_ERROR("%s", error_msg);     \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  116|      0|            return rc_;                             \
  |  |  117|      0|        }                                           \
  |  |  118|    209|    } while (0)
  |  |  ------------------
  |  |  |  Branch (118:14): [Folded, False: 209]
  |  |  ------------------
  ------------------
  157|       |
  158|    209|  array->ndim = ndim;
  159|    209|  array->nitems = 1;
  160|    209|  array->extnitems = 1;
  161|    209|  array->extchunknitems = 1;
  162|    209|  array->chunknitems = 1;
  163|    209|  array->blocknitems = 1;
  164|  3.55k|  for (int i = 0; i < B2ND_MAX_DIM; ++i) {
  ------------------
  |  |   50|  3.55k|#define B2ND_MAX_DIM 16
  ------------------
  |  Branch (164:19): [True: 3.34k, False: 209]
  ------------------
  165|  3.34k|    if (i < ndim) {
  ------------------
  |  Branch (165:9): [True: 756, False: 2.58k]
  ------------------
  166|    756|      array->shape[i] = shape[i];
  167|    756|      array->chunkshape[i] = chunkshape[i];
  168|    756|      array->blockshape[i] = blockshape[i];
  169|    756|      if (array->chunkshape[i] != 0) {
  ------------------
  |  Branch (169:11): [True: 756, False: 0]
  ------------------
  170|    756|        if (shape[i] % array->chunkshape[i] == 0) {
  ------------------
  |  Branch (170:13): [True: 543, False: 213]
  ------------------
  171|    543|          array->extshape[i] = shape[i];
  172|    543|        } else {
  173|       |          // Rounding shape up to the next chunk must not wrap int64
  174|    213|          if (shape[i] > INT64_MAX - chunkshape[i]) {
  ------------------
  |  Branch (174:15): [True: 0, False: 213]
  ------------------
  175|      0|            BLOSC_TRACE_ERROR("shape[%d] is too large to round up to chunkshape[%d]", i, i);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  176|      0|            return BLOSC2_ERROR_INVALID_PARAM;
  177|      0|          }
  178|    213|          array->extshape[i] = shape[i] + chunkshape[i] - shape[i] % chunkshape[i];
  179|    213|        }
  180|    756|        if (chunkshape[i] % blockshape[i] == 0) {
  ------------------
  |  Branch (180:13): [True: 723, False: 33]
  ------------------
  181|    723|          array->extchunkshape[i] = chunkshape[i];
  182|    723|        } else {
  183|       |          // Done in 64 bits: the sum of two int32 values does not fit in int32,
  184|       |          // and extchunkshape is int64 anyway
  185|     33|          array->extchunkshape[i] =
  186|     33|                  (int64_t) chunkshape[i] + blockshape[i] - chunkshape[i] % blockshape[i];
  187|     33|        }
  188|    756|      } else {
  189|      0|        array->extchunkshape[i] = chunkshape[i];
  190|      0|        array->extshape[i] = 0;
  191|      0|      }
  192|  2.58k|    } else {
  193|  2.58k|      array->blockshape[i] = 1;
  194|  2.58k|      array->chunkshape[i] = 1;
  195|  2.58k|      array->extshape[i] = 1;
  196|  2.58k|      array->extchunkshape[i] = 1;
  197|  2.58k|      array->shape[i] = 1;
  198|  2.58k|    }
  199|       |    // Crafted metadata can make any of these products wrap, which is UB and
  200|       |    // lands in divisors and allocation sizes downstream (see #795)
  201|  3.34k|    if (!blosc2_checked_mul_i64_nonneg(array->nitems, array->shape[i], &array->nitems) ||
  ------------------
  |  Branch (201:9): [True: 0, False: 3.34k]
  ------------------
  202|  3.34k|        !blosc2_checked_mul_i64_nonneg(array->extnitems, array->extshape[i], &array->extnitems) ||
  ------------------
  |  Branch (202:9): [True: 0, False: 3.34k]
  ------------------
  203|  3.34k|        !blosc2_checked_mul_i64_nonneg(array->extchunknitems, array->extchunkshape[i],
  ------------------
  |  Branch (203:9): [True: 0, False: 3.34k]
  ------------------
  204|  3.34k|                                       &array->extchunknitems) ||
  205|  3.34k|        !blosc2_checked_mul_i32_nonneg(array->chunknitems, array->chunkshape[i], &array->chunknitems) ||
  ------------------
  |  Branch (205:9): [True: 0, False: 3.34k]
  ------------------
  206|  3.34k|        !blosc2_checked_mul_i32_nonneg(array->blocknitems, array->blockshape[i], &array->blocknitems)) {
  ------------------
  |  Branch (206:9): [True: 0, False: 3.34k]
  ------------------
  207|      0|      BLOSC_TRACE_ERROR("shape, chunkshape or blockshape product overflows at dimension %d", i);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  208|      0|      return BLOSC2_ERROR_INVALID_PARAM;
  209|      0|    }
  210|  3.34k|  }
  211|       |
  212|       |  // Compute strides
  213|    209|  if (ndim > 0) {
  ------------------
  |  Branch (213:7): [True: 209, False: 0]
  ------------------
  214|    209|    array->item_array_strides[ndim - 1] = 1;
  215|    209|    array->item_extchunk_strides[ndim - 1] = 1;
  216|    209|    array->item_chunk_strides[ndim - 1] = 1;
  217|    209|    array->item_block_strides[ndim - 1] = 1;
  218|    209|    array->block_chunk_strides[ndim - 1] = 1;
  219|    209|    array->chunk_array_strides[ndim - 1] = 1;
  220|    209|  }
  221|    756|  for (int i = ndim - 2; i >= 0; --i) {
  ------------------
  |  Branch (221:26): [True: 547, False: 209]
  ------------------
  222|       |    // Treat (chunkshape[i+1] == 0) the same as (shape[i+1] == 0):  the
  223|       |    // dimension carries no actual chunking and any stride into it is moot.
  224|       |    // validate_shape_chunkshape_blockshape allows the chunkshape==0
  225|       |    // combination (paired with blockshape==0) as a placeholder for empty
  226|       |    // contexts (see example_empty_shape.c).  Without this guard a crafted
  227|       |    // b2nd metalayer with shape[i+1]>0 but chunkshape[i+1]==blockshape[i+1]==0
  228|       |    // -- accepted by the validator -- reaches the (extchunkshape / blockshape)
  229|       |    // division below as 0/0, which is undefined behaviour and aborts the
  230|       |    // process with SIGFPE on x86.  Crafted cframes loaded via b2nd_from_schunk
  231|       |    // / b2nd_open / b2nd_from_cframe would otherwise crash any consumer.
  232|    547|    if (shape[i + 1] != 0 && array->chunkshape[i + 1] != 0 &&
  ------------------
  |  Branch (232:9): [True: 547, False: 0]
  |  Branch (232:30): [True: 547, False: 0]
  ------------------
  233|    547|        array->blockshape[i + 1] != 0) {
  ------------------
  |  Branch (233:9): [True: 547, False: 0]
  ------------------
  234|    547|      if (!blosc2_checked_mul_i64_nonneg(array->item_array_strides[i + 1], array->shape[i + 1],
  ------------------
  |  Branch (234:11): [True: 0, False: 547]
  ------------------
  235|    547|                                         &array->item_array_strides[i]) ||
  236|    547|          !blosc2_checked_mul_i64_nonneg(array->item_extchunk_strides[i + 1], array->extchunkshape[i + 1],
  ------------------
  |  Branch (236:11): [True: 0, False: 547]
  ------------------
  237|    547|                                         &array->item_extchunk_strides[i]) ||
  238|    547|          !blosc2_checked_mul_i64_nonneg(array->item_chunk_strides[i + 1], array->chunkshape[i + 1],
  ------------------
  |  Branch (238:11): [True: 0, False: 547]
  ------------------
  239|    547|                                         &array->item_chunk_strides[i]) ||
  240|    547|          !blosc2_checked_mul_i64_nonneg(array->item_block_strides[i + 1], array->blockshape[i + 1],
  ------------------
  |  Branch (240:11): [True: 0, False: 547]
  ------------------
  241|    547|                                         &array->item_block_strides[i]) ||
  242|    547|          !blosc2_checked_mul_i64_nonneg(array->block_chunk_strides[i + 1],
  ------------------
  |  Branch (242:11): [True: 0, False: 547]
  ------------------
  243|    547|                                         array->extchunkshape[i + 1] / array->blockshape[i + 1],
  244|    547|                                         &array->block_chunk_strides[i])) {
  245|      0|        BLOSC_TRACE_ERROR("Dimension stride overflow in array shape");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  246|      0|        return BLOSC2_ERROR_INVALID_PARAM;
  247|      0|      }
  248|       |      // Unused here, and this product can overflow for large (or damaged)
  249|       |      // shapes: 0 then, as for an empty dimension
  250|    547|      int64_t extent;
  251|    547|      if (!blosc2_checked_mul_i64_nonneg(array->extshape[i + 1], array->chunkshape[i + 1], &extent) ||
  ------------------
  |  Branch (251:11): [True: 0, False: 547]
  ------------------
  252|    547|          !blosc2_checked_mul_i64_nonneg(array->chunk_array_strides[i + 1], extent,
  ------------------
  |  Branch (252:11): [True: 0, False: 547]
  ------------------
  253|    547|                                         &array->chunk_array_strides[i])) {
  254|      0|        array->chunk_array_strides[i] = 0;
  255|      0|      }
  256|    547|    } else {
  257|      0|      array->item_array_strides[i] = 0;
  258|      0|      array->item_extchunk_strides[i] = 0;
  259|      0|      array->item_chunk_strides[i] = 0;
  260|      0|      array->item_block_strides[i] = 0;
  261|      0|      array->block_chunk_strides[i] = 0;
  262|      0|      array->chunk_array_strides[i] = 0;
  263|      0|    }
  264|    547|  }
  265|    209|  return BLOSC2_ERROR_SUCCESS;
  266|    209|}
b2nd.c:publish_shape_meta:
  270|    139|static int publish_shape_meta(b2nd_array_t *array) {
  271|    139|  if (!array->sc) {
  ------------------
  |  Branch (271:7): [True: 139, False: 0]
  ------------------
  272|    139|    return BLOSC2_ERROR_SUCCESS;
  273|    139|  }
  274|      0|  uint8_t *smeta = NULL;
  275|       |  // Serialize the dimension info ...
  276|      0|  int32_t smeta_len =
  277|      0|          b2nd_serialize_meta(array->ndim, array->shape, array->chunkshape, array->blockshape,
  278|      0|                              array->dtype, array->dtype_format, &smeta);
  279|      0|  if (smeta_len < 0) {
  ------------------
  |  Branch (279:7): [True: 0, False: 0]
  ------------------
  280|      0|    BLOSC_TRACE_ERROR("Error during serializing dims info for Blosc2 NDim");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  281|      0|    BLOSC_ERROR(BLOSC2_ERROR_FAILURE);
  ------------------
  |  |  111|      0|    do {                                            \
  |  |  112|      0|        int rc_ = (rc);                             \
  |  |  113|      0|        if (rc_ < BLOSC2_ERROR_SUCCESS) {           \
  |  |  ------------------
  |  |  |  Branch (113:13): [True: 0, False: 0]
  |  |  ------------------
  |  |  114|      0|            char *error_msg = print_error(rc_);     \
  |  |  115|      0|            BLOSC_TRACE_ERROR("%s", error_msg);     \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  116|      0|            return rc_;                             \
  |  |  117|      0|        }                                           \
  |  |  118|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (118:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  282|      0|  }
  283|       |  // ... and update it in its metalayer
  284|      0|  if (blosc2_meta_exists(array->sc, "b2nd") < 0) {
  ------------------
  |  Branch (284:7): [True: 0, False: 0]
  ------------------
  285|      0|    if (blosc2_meta_add(array->sc, "b2nd", smeta, smeta_len) < 0) {
  ------------------
  |  Branch (285:9): [True: 0, False: 0]
  ------------------
  286|      0|      BLOSC_ERROR(BLOSC2_ERROR_FAILURE);
  ------------------
  |  |  111|      0|    do {                                            \
  |  |  112|      0|        int rc_ = (rc);                             \
  |  |  113|      0|        if (rc_ < BLOSC2_ERROR_SUCCESS) {           \
  |  |  ------------------
  |  |  |  Branch (113:13): [True: 0, False: 0]
  |  |  ------------------
  |  |  114|      0|            char *error_msg = print_error(rc_);     \
  |  |  115|      0|            BLOSC_TRACE_ERROR("%s", error_msg);     \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  116|      0|            return rc_;                             \
  |  |  117|      0|        }                                           \
  |  |  118|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (118:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  287|      0|    }
  288|      0|  } else {
  289|      0|    if (blosc2_meta_update(array->sc, "b2nd", smeta, smeta_len) < 0) {
  ------------------
  |  Branch (289:9): [True: 0, False: 0]
  ------------------
  290|      0|      BLOSC_ERROR(BLOSC2_ERROR_FAILURE);
  ------------------
  |  |  111|      0|    do {                                            \
  |  |  112|      0|        int rc_ = (rc);                             \
  |  |  113|      0|        if (rc_ < BLOSC2_ERROR_SUCCESS) {           \
  |  |  ------------------
  |  |  |  Branch (113:13): [True: 0, False: 0]
  |  |  ------------------
  |  |  114|      0|            char *error_msg = print_error(rc_);     \
  |  |  115|      0|            BLOSC_TRACE_ERROR("%s", error_msg);     \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  116|      0|            return rc_;                             \
  |  |  117|      0|        }                                           \
  |  |  118|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (118:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  291|      0|    }
  292|      0|  }
  293|      0|  free(smeta);
  294|       |  // The meta mutation bumped the schunk change tick; this struct is in sync
  295|      0|  array->last_tick = array->sc->change_tick;
  296|       |
  297|      0|  return BLOSC2_ERROR_SUCCESS;
  298|      0|}
b2nd.c:refresh_if_stale:
  313|    346|static int refresh_if_stale(b2nd_array_t *array) {
  314|    346|  blosc2_schunk *sc = array->sc;
  315|    346|  if (sc == NULL || sc->frame == NULL) {
  ------------------
  |  Branch (315:7): [True: 0, False: 346]
  |  Branch (315:21): [True: 0, False: 346]
  ------------------
  316|      0|    return BLOSC2_ERROR_SUCCESS;
  317|      0|  }
  318|    346|  BLOSC_ERROR(frame_check_stale((blosc2_frame_s *) sc->frame));
  ------------------
  |  |  111|    346|    do {                                            \
  |  |  112|    346|        int rc_ = (rc);                             \
  |  |  113|    346|        if (rc_ < BLOSC2_ERROR_SUCCESS) {           \
  |  |  ------------------
  |  |  |  Branch (113:13): [True: 0, False: 346]
  |  |  ------------------
  |  |  114|      0|            char *error_msg = print_error(rc_);     \
  |  |  115|      0|            BLOSC_TRACE_ERROR("%s", error_msg);     \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  116|      0|            return rc_;                             \
  |  |  117|      0|        }                                           \
  |  |  118|    346|    } while (0)
  |  |  ------------------
  |  |  |  Branch (118:14): [Folded, False: 346]
  |  |  ------------------
  ------------------
  319|    346|  if (array->last_tick == sc->change_tick) {
  ------------------
  |  Branch (319:7): [True: 276, False: 70]
  ------------------
  320|    276|    return BLOSC2_ERROR_SUCCESS;
  321|    276|  }
  322|       |
  323|     70|  uint8_t *smeta;
  324|     70|  int32_t smeta_len;
  325|     70|  if (blosc2_meta_get(sc, "b2nd", &smeta, &smeta_len) < 0) {
  ------------------
  |  Branch (325:7): [True: 0, False: 70]
  ------------------
  326|      0|    if (blosc2_meta_get(sc, "caterva", &smeta, &smeta_len) < 0) {
  ------------------
  |  Branch (326:9): [True: 0, False: 0]
  ------------------
  327|       |      // blosc2_meta_get() itself is a pure in-memory lookup on
  328|       |      // schunk->metalayers[], but that array was just repopulated by
  329|       |      // frame_check_stale() -> frame_refresh_if_stale() -> frame_get_metalayers(),
  330|       |      // which does its *own*, fully independent disk read (its own fresh
  331|       |      // get_header_info() + header re-read, frame.c) -- separate from both
  332|       |      // frame_check_stale()'s header read and the trailer read a few lines
  333|       |      // up in this same call chain. Without locking, nothing holds these
  334|       |      // reads together atomically, so this one can catch the header mid
  335|       |      // rewrite just as easily as the other two; a b2nd array always has
  336|       |      // one of these two metalayers from creation, so a miss here reflects
  337|       |      // that specific read landing in a torn window, not a genuine
  338|       |      // absence. Same opportunistic treatment as those reads: keep the
  339|       |      // cached view and let the next poll (its own fresh, independent read)
  340|       |      // resolve it, instead of hard-erroring on what is normally transient.
  341|      0|      return BLOSC2_ERROR_SUCCESS;
  342|      0|    }
  343|      0|  }
  344|     70|  int8_t ndim;
  345|     70|  int64_t shape[B2ND_MAX_DIM];
  346|     70|  int32_t chunkshape[B2ND_MAX_DIM];
  347|     70|  int32_t blockshape[B2ND_MAX_DIM];
  348|     70|  char *dtype;
  349|     70|  int8_t dtype_format;
  350|     70|  int rc = b2nd_deserialize_meta(smeta, smeta_len, &ndim, shape, chunkshape, blockshape,
  351|     70|                                 &dtype, &dtype_format);
  352|     70|  free(smeta);
  353|     70|  BLOSC_ERROR(rc);
  ------------------
  |  |  111|     70|    do {                                            \
  |  |  112|     70|        int rc_ = (rc);                             \
  |  |  113|     70|        if (rc_ < BLOSC2_ERROR_SUCCESS) {           \
  |  |  ------------------
  |  |  |  Branch (113:13): [True: 0, False: 70]
  |  |  ------------------
  |  |  114|      0|            char *error_msg = print_error(rc_);     \
  |  |  115|      0|            BLOSC_TRACE_ERROR("%s", error_msg);     \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  116|      0|            return rc_;                             \
  |  |  117|      0|        }                                           \
  |  |  118|     70|    } while (0)
  |  |  ------------------
  |  |  |  Branch (118:14): [Folded, False: 70]
  |  |  ------------------
  ------------------
  354|     70|  free(dtype);
  355|       |
  356|       |  // Shape-only SWMR scope (matching HDF5): chunk/block geometry or ndim
  357|       |  // changing under a live handle is a misuse of the single-writer contract,
  358|       |  // not something to follow silently.
  359|     70|  if (ndim != array->ndim ||
  ------------------
  |  Branch (359:7): [True: 0, False: 70]
  ------------------
  360|     70|      memcmp(chunkshape, array->chunkshape, ndim * sizeof(int32_t)) != 0 ||
  ------------------
  |  Branch (360:7): [True: 0, False: 70]
  ------------------
  361|     70|      memcmp(blockshape, array->blockshape, ndim * sizeof(int32_t)) != 0) {
  ------------------
  |  Branch (361:7): [True: 0, False: 70]
  ------------------
  362|      0|    BLOSC_TRACE_ERROR("ndim/chunkshape/blockshape changed behind this handle; "
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  363|      0|                      "only shape changes are followed");
  364|      0|    BLOSC_ERROR(BLOSC2_ERROR_DATA);
  ------------------
  |  |  111|      0|    do {                                            \
  |  |  112|      0|        int rc_ = (rc);                             \
  |  |  113|      0|        if (rc_ < BLOSC2_ERROR_SUCCESS) {           \
  |  |  ------------------
  |  |  |  Branch (113:13): [True: 0, False: 0]
  |  |  ------------------
  |  |  114|      0|            char *error_msg = print_error(rc_);     \
  |  |  115|      0|            BLOSC_TRACE_ERROR("%s", error_msg);     \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  116|      0|            return rc_;                             \
  |  |  117|      0|        }                                           \
  |  |  118|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (118:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  365|      0|  }
  366|       |
  367|     70|  BLOSC_ERROR(update_shape_struct(array, ndim, shape, chunkshape, blockshape));
  ------------------
  |  |  111|     70|    do {                                            \
  |  |  112|     70|        int rc_ = (rc);                             \
  |  |  113|     70|        if (rc_ < BLOSC2_ERROR_SUCCESS) {           \
  |  |  ------------------
  |  |  |  Branch (113:13): [True: 0, False: 70]
  |  |  ------------------
  |  |  114|      0|            char *error_msg = print_error(rc_);     \
  |  |  115|      0|            BLOSC_TRACE_ERROR("%s", error_msg);     \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  116|      0|            return rc_;                             \
  |  |  117|      0|        }                                           \
  |  |  118|     70|    } while (0)
  |  |  ------------------
  |  |  |  Branch (118:14): [Folded, False: 70]
  |  |  ------------------
  ------------------
  368|     70|  array->last_tick = sc->change_tick;
  369|       |
  370|     70|  return 1;
  371|     70|}
b2nd.c:check_schunk_matches_meta:
  620|     69|static int check_schunk_matches_meta(const blosc2_schunk *schunk, const b2nd_array_t *array) {
  621|       |  // Every chunk the shape covers exists: arrays are created with all of them,
  622|       |  // and resizes add chunks before they publish a larger shape.  More are fine.
  623|     69|  int64_t needed_nchunks = array->chunknitems == 0 ? 0 : array->extnitems / array->chunknitems;
  ------------------
  |  Branch (623:28): [True: 0, False: 69]
  ------------------
  624|     69|  if (schunk->nchunks < needed_nchunks) {
  ------------------
  |  Branch (624:7): [True: 0, False: 69]
  ------------------
  625|      0|    BLOSC_TRACE_ERROR("The b2nd shape needs %" PRId64 " chunks, but the super-chunk holds %" PRId64,
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  626|      0|                      needed_nchunks, schunk->nchunks);
  627|      0|    return BLOSC2_ERROR_INVALID_HEADER;
  628|      0|  }
  629|       |  // The chunks hold the chunk shape (padded to whole blocks) in typesize items;
  630|       |  // a super-chunk without chunks or with chunks of varying size (<= 0) says nothing
  631|     69|  int64_t chunkbytes;
  632|     69|  if (schunk->nchunks > 0 && schunk->chunksize > 0 &&
  ------------------
  |  Branch (632:7): [True: 69, False: 0]
  |  Branch (632:30): [True: 69, False: 0]
  ------------------
  633|     69|      (!blosc2_checked_mul_i64_nonneg(array->extchunknitems, schunk->typesize, &chunkbytes) ||
  ------------------
  |  Branch (633:8): [True: 0, False: 69]
  ------------------
  634|     69|       chunkbytes != schunk->chunksize)) {
  ------------------
  |  Branch (634:8): [True: 0, False: 69]
  ------------------
  635|      0|    BLOSC_TRACE_ERROR("The b2nd chunk shape with typesize %d does not make the %d-byte chunks of the super-chunk",
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  636|      0|                      schunk->typesize, schunk->chunksize);
  637|      0|    return BLOSC2_ERROR_INVALID_HEADER;
  638|      0|  }
  639|     69|  return BLOSC2_ERROR_SUCCESS;
  640|     69|}
b2nd.c:buffer_wants_prefault:
 1216|    138|static bool buffer_wants_prefault(const uint8_t *buffer, int64_t nbytes, int nthreads) {
 1217|    138|#if defined(__linux__)
 1218|       |  // A huge page is 2 MB with 4 KB pages; other page sizes are not probed
 1219|    138|  enum { huge_page = 2 << 20, small_page = 4096, npages = huge_page / small_page };
 1220|    138|  if (nthreads < 2 || nbytes < 2 * huge_page || sysconf(_SC_PAGESIZE) != small_page) {
  ------------------
  |  Branch (1220:7): [True: 138, False: 0]
  |  Branch (1220:23): [True: 0, False: 0]
  |  Branch (1220:49): [True: 0, False: 0]
  ------------------
 1221|    138|    return false;
 1222|    138|  }
 1223|       |  // The aligned huge page around the middle lies inside a buffer of 4 MB or more,
 1224|       |  // away from its first page, where malloc writes its chunk header
 1225|      0|  uint8_t *block = (uint8_t *) (((uintptr_t) buffer + (uintptr_t) (nbytes / 2)) & ~(uintptr_t) (huge_page - 1));
 1226|      0|  unsigned char resident[npages];
 1227|      0|  if (mincore(block, huge_page, resident) != 0) {
  ------------------
  |  Branch (1227:7): [True: 0, False: 0]
  ------------------
 1228|      0|    return false;
 1229|      0|  }
 1230|      0|  for (int i = 0; i < npages; i++) {
  ------------------
  |  Branch (1230:19): [True: 0, False: 0]
  ------------------
 1231|      0|    if (resident[i] & 1) {
  ------------------
  |  Branch (1231:9): [True: 0, False: 0]
  ------------------
 1232|      0|      return false;
 1233|      0|    }
 1234|      0|  }
 1235|       |  // Fault in one page as a write would, and see whether the whole huge page came
 1236|       |  // with it (best effort: kernels before 5.14 cannot, and then nothing is prefaulted)
 1237|      0|  if (madvise(block + huge_page / 2, small_page, MADV_POPULATE_WRITE) != 0 ||
  ------------------
  |  Branch (1237:7): [True: 0, False: 0]
  ------------------
 1238|      0|      mincore(block, huge_page, resident) != 0) {
  ------------------
  |  Branch (1238:7): [True: 0, False: 0]
  ------------------
 1239|      0|    return false;
 1240|      0|  }
 1241|      0|  for (int i = 0; i < npages; i++) {
  ------------------
  |  Branch (1241:19): [True: 0, False: 0]
  ------------------
 1242|      0|    if ((resident[i] & 1) == 0) {
  ------------------
  |  Branch (1242:9): [True: 0, False: 0]
  ------------------
 1243|      0|      return false;
 1244|      0|    }
 1245|      0|  }
 1246|      0|  return true;
 1247|       |#else
 1248|       |  BLOSC_UNUSED_PARAM(buffer);
 1249|       |  BLOSC_UNUSED_PARAM(nbytes);
 1250|       |  BLOSC_UNUSED_PARAM(nthreads);
 1251|       |  return false;
 1252|       |#endif
 1253|      0|}
b2nd.c:chunk_blocks_in_c_order:
 1078|    208|static bool chunk_blocks_in_c_order(const b2nd_array_t *array) {
 1079|    208|  int k = 0;
 1080|    586|  for (int i = 0; i < array->ndim; ++i) {
  ------------------
  |  Branch (1080:19): [True: 501, False: 85]
  ------------------
 1081|    501|    if (array->chunkshape[i] % array->blockshape[i] != 0) {
  ------------------
  |  Branch (1081:9): [True: 18, False: 483]
  ------------------
 1082|     18|      return false;
 1083|     18|    }
 1084|    483|    if (i > k && array->chunkshape[i] != array->blockshape[i]) {
  ------------------
  |  Branch (1084:9): [True: 287, False: 196]
  |  Branch (1084:18): [True: 105, False: 182]
  ------------------
 1085|    105|      return false;
 1086|    105|    }
 1087|    378|    if (i == k && array->blockshape[i] == 1) {
  ------------------
  |  Branch (1087:9): [True: 196, False: 182]
  |  Branch (1087:19): [True: 6, False: 190]
  ------------------
 1088|      6|      k++;
 1089|      6|    }
 1090|    378|  }
 1091|     85|  return true;
 1092|    208|}
b2nd.c:prefetch_slice:
 1458|    138|static prefetch_batch* prefetch_slice(const b2nd_array_t *array, const int64_t *start, const int64_t *stop) {
 1459|    138|  blosc2_frame_s *frame = (blosc2_frame_s *) array->sc->frame;
 1460|    138|  if (!prefetch_applies(frame)) {
  ------------------
  |  Branch (1460:7): [True: 138, False: 0]
  ------------------
 1461|    138|    return NULL;
 1462|    138|  }
 1463|      0|  int8_t ndim = array->ndim;
 1464|      0|  int64_t nblocks = array->blocknitems > 0 ? array->extchunknitems / array->blocknitems : 0;
  ------------------
  |  Branch (1464:21): [True: 0, False: 0]
  ------------------
 1465|      0|  int64_t *nchunks = NULL;
 1466|      0|  int64_t n = b2nd_get_slice_nchunks(array, start, stop, &nchunks);
 1467|      0|  int64_t chunk_start[B2ND_MAX_DIM];
 1468|      0|  int64_t chunk_stop[B2ND_MAX_DIM];
 1469|      0|  int64_t npartial = 0;
 1470|      0|  for (int64_t c = 0; c < n && nblocks > 0; ++c) {
  ------------------
  |  Branch (1470:23): [True: 0, False: 0]
  |  Branch (1470:32): [True: 0, False: 0]
  ------------------
 1471|      0|    npartial += chunk_box(array, nchunks[c], start, stop, chunk_start, chunk_stop);
 1472|      0|  }
 1473|       |  // One maskout per chunk covered in part (NULL for a chunk read whole), all in one allocation
 1474|      0|  const bool **maskouts = NULL;
 1475|      0|  if (npartial > 0) {
  ------------------
  |  Branch (1475:7): [True: 0, False: 0]
  ------------------
 1476|      0|    maskouts = calloc(1, n * sizeof(bool *) + npartial * nblocks * sizeof(bool));
 1477|      0|  }
 1478|      0|  if (maskouts != NULL) {
  ------------------
  |  Branch (1478:7): [True: 0, False: 0]
  ------------------
 1479|      0|    bool *row = (bool *) (maskouts + n);
 1480|      0|    int64_t blocks_in_chunk[B2ND_MAX_DIM];
 1481|      0|    int64_t blockshape[B2ND_MAX_DIM];
 1482|      0|    for (int i = 0; i < ndim; ++i) {
  ------------------
  |  Branch (1482:21): [True: 0, False: 0]
  ------------------
 1483|      0|      blocks_in_chunk[i] = array->extchunkshape[i] / array->blockshape[i];
 1484|      0|      blockshape[i] = array->blockshape[i];
 1485|      0|    }
 1486|      0|    blosc2_io_cb *io_cb = blosc2_get_io_cb(array->sc->storage->io->id);
 1487|      0|    bool mapped = io_cb != NULL && !io_cb->is_allocation_necessary;
  ------------------
  |  Branch (1487:19): [True: 0, False: 0]
  |  Branch (1487:36): [True: 0, False: 0]
  ------------------
 1488|      0|    bool has_delta = filters_contain(array->sc->filters, BLOSC_DELTA);
 1489|      0|    slice_chunk_t slice_chunk;
 1490|      0|    memset(&slice_chunk, 0, sizeof(slice_chunk));
 1491|      0|    slice_chunk.array = array;
 1492|      0|    slice_chunk.start = start;
 1493|      0|    slice_chunk.stop = stop;
 1494|      0|    slice_chunk.chunk_start = chunk_start;
 1495|      0|    slice_chunk.chunk_stop = chunk_stop;
 1496|      0|    slice_chunk.blocks_in_chunk = blocks_in_chunk;
 1497|      0|    slice_chunk.blockshape = blockshape;
 1498|      0|    for (int64_t c = 0; c < n; ++c) {
  ------------------
  |  Branch (1498:25): [True: 0, False: 0]
  ------------------
 1499|      0|      if (!chunk_box(array, nchunks[c], start, stop, chunk_start, chunk_stop)) {
  ------------------
  |  Branch (1499:11): [True: 0, False: 0]
  ------------------
 1500|      0|        continue;  // read whole
 1501|      0|      }
 1502|      0|      int64_t nneeded = slice_chunk_maskout(&slice_chunk, nblocks, has_delta, row);
 1503|      0|      if (mapped || slice_chunk_compact(array, nneeded, has_delta)) {
  ------------------
  |  Branch (1503:11): [True: 0, False: 0]
  |  Branch (1503:21): [True: 0, False: 0]
  ------------------
 1504|      0|        maskouts[c] = row;
 1505|      0|        row += nblocks;
 1506|      0|      }
 1507|      0|    }
 1508|      0|  }
 1509|      0|  prefetch_batch *batch = prefetch_batch_new(frame, nchunks, n, maskouts, nblocks);
 1510|      0|  free(maskouts);
 1511|      0|  free(nchunks);
 1512|      0|  return batch;
 1513|    138|}
b2nd.c:chunks_special:
 1520|    138|static int chunks_special(blosc2_schunk *sc, const int64_t *nchunks, int64_t n, uint8_t *special) {
 1521|    138|  if (sc->frame != NULL) {
  ------------------
  |  Branch (1521:7): [True: 138, False: 0]
  ------------------
 1522|    138|    return frame_get_chunks_special((blosc2_frame_s *) sc->frame, nchunks, n, special);
 1523|    138|  }
 1524|      0|  for (int64_t k = 0; k < n; ++k) {
  ------------------
  |  Branch (1524:23): [True: 0, False: 0]
  ------------------
 1525|      0|    if (nchunks[k] < 0 || nchunks[k] >= sc->nchunks || sc->data[nchunks[k]] == NULL) {
  ------------------
  |  Branch (1525:9): [True: 0, False: 0]
  |  Branch (1525:27): [True: 0, False: 0]
  |  Branch (1525:56): [True: 0, False: 0]
  ------------------
 1526|      0|      return BLOSC2_ERROR_INVALID_PARAM;
 1527|      0|    }
 1528|      0|    const uint8_t *chunk = sc->data[nchunks[k]];
 1529|      0|    special[k] = (uint8_t) chunk_special_in_offset(chunk, sw32_(chunk + BLOSC2_CHUNK_CBYTES));
 1530|      0|  }
 1531|      0|  return BLOSC2_ERROR_SUCCESS;
 1532|      0|}
b2nd.c:chunk_box:
 1436|     64|                      int64_t *chunk_start, int64_t *chunk_stop) {
 1437|     64|  int64_t chunks_in_array[B2ND_MAX_DIM];
 1438|     64|  int64_t nchunk_ndim[B2ND_MAX_DIM];
 1439|    320|  for (int i = 0; i < array->ndim; ++i) {
  ------------------
  |  Branch (1439:19): [True: 256, False: 64]
  ------------------
 1440|    256|    chunks_in_array[i] = array->extshape[i] / array->chunkshape[i];
 1441|    256|  }
 1442|     64|  blosc2_unidim_to_multidim(array->ndim, chunks_in_array, nchunk, nchunk_ndim);
 1443|     64|  bool partial = false;
 1444|    320|  for (int i = 0; i < array->ndim; ++i) {
  ------------------
  |  Branch (1444:19): [True: 256, False: 64]
  ------------------
 1445|    256|    chunk_start[i] = nchunk_ndim[i] * array->chunkshape[i];
 1446|    256|    chunk_stop[i] = chunk_start[i] + array->chunkshape[i] < array->shape[i] ?
  ------------------
  |  Branch (1446:21): [True: 132, False: 124]
  ------------------
 1447|    132|                    chunk_start[i] + array->chunkshape[i] : array->shape[i];
 1448|    256|    partial |= start[i] > chunk_start[i] || stop[i] < chunk_stop[i];
  ------------------
  |  Branch (1448:16): [True: 0, False: 256]
  |  Branch (1448:45): [True: 0, False: 256]
  ------------------
 1449|    256|  }
 1450|     64|  return partial;
 1451|     64|}
b2nd.c:chunk_slice_box:
 1194|  1.68k|                               int64_t *box_stop) {
 1195|  1.68k|  int64_t nitems = 1;
 1196|  8.23k|  for (int i = 0; i < ndim; ++i) {
  ------------------
  |  Branch (1196:19): [True: 6.55k, False: 1.68k]
  ------------------
 1197|  6.55k|    box_start[i] = (chunk_start[i] > start[i] ? chunk_start[i] : start[i]) - start[i];
  ------------------
  |  Branch (1197:21): [True: 3.10k, False: 3.45k]
  ------------------
 1198|  6.55k|    box_stop[i] = (chunk_stop[i] < stop[i] ? chunk_stop[i] : stop[i]) - start[i];
  ------------------
  |  Branch (1198:20): [True: 3.10k, False: 3.45k]
  ------------------
 1199|  6.55k|    nitems *= box_stop[i] - box_start[i];
 1200|  6.55k|  }
 1201|  1.68k|  return nitems;
 1202|  1.68k|}
b2nd.c:chunk_contiguous_in_buffer:
 1100|    411|                                       const int64_t *shape, int64_t *offset) {
 1101|       |  // Leading dims where the chunk is one item wide can sit anywhere; past the
 1102|       |  // first wider dim the chunk has to span the buffer.
 1103|    411|  bool must_span = false;
 1104|    411|  int64_t off = 0;
 1105|    824|  for (int i = 0; i < array->ndim; ++i) {
  ------------------
  |  Branch (1105:19): [True: 781, False: 43]
  ------------------
 1106|    781|    int64_t extent = array->chunkshape[i];
 1107|    781|    if (chunk_start[i] < start[i] || chunk_start[i] + extent > stop[i] ||
  ------------------
  |  Branch (1107:9): [True: 0, False: 781]
  |  Branch (1107:38): [True: 121, False: 660]
  ------------------
 1108|    660|        chunk_start[i] + extent > array->shape[i]) {
  ------------------
  |  Branch (1108:9): [True: 0, False: 660]
  ------------------
 1109|    121|      return false;
 1110|    121|    }
 1111|    660|    if (must_span && extent != shape[i]) {
  ------------------
  |  Branch (1111:9): [True: 321, False: 339]
  |  Branch (1111:22): [True: 247, False: 74]
  ------------------
 1112|    247|      return false;
 1113|    247|    }
 1114|    413|    if (extent > 1) {
  ------------------
  |  Branch (1114:9): [True: 407, False: 6]
  ------------------
 1115|    407|      must_span = true;
 1116|    407|    }
 1117|    413|    off = off * shape[i] + (chunk_start[i] - start[i]);
 1118|    413|  }
 1119|     43|  *offset = off * array->sc->typesize;
 1120|       |  return true;
 1121|    411|}
b2nd.c:compress_update_chunk:
 1359|    611|                                 int32_t nbytes, slice_chunk_t *gather) {
 1360|    611|  int32_t chunk_nbytes = nbytes + BLOSC2_MAX_OVERHEAD;
 1361|    611|  size_t chunk_capacity;
 1362|    611|  uint8_t *chunk = scratch_malloc(array, chunk_nbytes, &chunk_capacity);
 1363|    611|  BLOSC_ERROR_NULL(chunk, BLOSC2_ERROR_MEMORY_ALLOC);
  ------------------
  |  |  104|    611|    do {                                            \
  |  |  105|    611|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 611]
  |  |  ------------------
  |  |  106|      0|            BLOSC_TRACE_ERROR("Pointer is null");   \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  107|      0|            return (rc);                            \
  |  |  108|      0|        }                                           \
  |  |  109|    611|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 611]
  |  |  ------------------
  ------------------
 1364|       |  // Update current_chunk in case a prefilter is applied
 1365|    611|  array->sc->current_nchunk = nchunk;
 1366|    611|  blosc2_context *cctx = array->sc->cctx;
 1367|    611|  blosc2_prefilter_params params;
 1368|    611|  blosc2_prefilter_params *saved_preparams = cctx->preparams;
 1369|    611|  bool saved_full_write = cctx->prefilter_full_write;
 1370|    611|  if (gather != NULL) {
  ------------------
  |  Branch (1370:7): [True: 538, False: 73]
  ------------------
 1371|    538|    memset(&params, 0, sizeof(params));
 1372|    538|    params.user_data = gather;
 1373|    538|    cctx->prefilter = slice_gather_prefilter;
 1374|    538|    cctx->preparams = &params;
 1375|       |    /* The gather callback copies old contents or clears partial/padding blocks;
 1376|       |     * a whole-block slice copy needs no preliminary memset. */
 1377|    538|    cctx->prefilter_full_write = true;
 1378|    538|  }
 1379|    611|  int brc = blosc2_compress_ctx(cctx, src, nbytes, chunk, chunk_nbytes);
 1380|    611|  if (gather != NULL) {
  ------------------
  |  Branch (1380:7): [True: 538, False: 73]
  ------------------
 1381|    538|    cctx->prefilter = NULL;
 1382|    538|    cctx->preparams = saved_preparams;
 1383|    538|    cctx->prefilter_full_write = saved_full_write;
 1384|    538|  }
 1385|    611|  if (brc < 0) {
  ------------------
  |  Branch (1385:7): [True: 1, False: 610]
  ------------------
 1386|      1|    blosc2_tmp_free(chunk, chunk_capacity);
 1387|      1|    BLOSC_TRACE_ERROR("Blosc can not compress the data");
  ------------------
  |  |   93|      1|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      1|    do {                                            \
  |  |  |  |   98|      1|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      1|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 1, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      1|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1388|      1|    return BLOSC2_ERROR_FAILURE;
 1389|      1|  }
 1390|       |  // A frame stores its own copy of the chunk, so it is lent a reused buffer; an
 1391|       |  // in-memory super-chunk keeps the buffer itself
 1392|    611|  bool in_frame = array->sc->frame != NULL;
 1393|    610|  int64_t brc_ = in_frame ? schunk_update_chunk_lent(array->sc, nchunk, chunk)
  ------------------
  |  Branch (1393:18): [True: 610, False: 0]
  ------------------
 1394|    610|                          : blosc2_schunk_update_chunk(array->sc, nchunk, chunk, false);
 1395|    610|  if (in_frame || brc_ < 0) {
  ------------------
  |  Branch (1395:7): [True: 610, False: 0]
  |  Branch (1395:19): [True: 0, False: 0]
  ------------------
 1396|       |    // A failed update leaves the chunk to us
 1397|    610|    blosc2_tmp_free(chunk, chunk_capacity);
 1398|    610|  }
 1399|    610|  if (brc_ < 0) {
  ------------------
  |  Branch (1399:7): [True: 0, False: 610]
  ------------------
 1400|      0|    BLOSC_TRACE_ERROR("Blosc can not update the chunk");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1401|      0|    return BLOSC2_ERROR_FAILURE;
 1402|      0|  }
 1403|    610|  return BLOSC2_ERROR_SUCCESS;
 1404|    610|}
b2nd.c:slice_gather_prefilter:
 1322|  8.18k|static int slice_gather_prefilter(blosc2_prefilter_params *params) {
 1323|  8.18k|  const slice_chunk_t *c = params->user_data;
 1324|  8.18k|  const b2nd_array_t *array = c->array;
 1325|  8.18k|  int8_t ndim = array->ndim;
 1326|  8.18k|  int32_t typesize = array->sc->typesize;
 1327|  8.18k|  if (params->output_size != array->blocknitems * typesize) {
  ------------------
  |  Branch (1327:7): [True: 0, False: 8.18k]
  ------------------
 1328|      0|    BLOSC_TRACE_ERROR("Unexpected block size in b2nd chunk");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1329|      0|    return BLOSC2_ERROR_FAILURE;
 1330|      0|  }
 1331|  8.18k|  block_overlap_t overlap;
 1332|  8.18k|  bool overlaps = block_slice_overlap(c, params->nblock, &overlap);
 1333|  8.18k|  if (!(overlaps && overlap.whole_block)) {
  ------------------
  |  Branch (1333:9): [True: 7.61k, False: 575]
  |  Branch (1333:21): [True: 5.97k, False: 1.64k]
  ------------------
 1334|  2.21k|    if (c->keep_old) {
  ------------------
  |  Branch (1334:9): [True: 0, False: 2.21k]
  ------------------
 1335|      0|      memcpy(params->output, params->input, (size_t) params->output_size);
 1336|  2.21k|    } else {
 1337|  2.21k|      memset(params->output, 0, (size_t) params->output_size);
 1338|  2.21k|    }
 1339|  2.21k|  }
 1340|  8.18k|  if (!overlaps) {
  ------------------
  |  Branch (1340:7): [True: 575, False: 7.61k]
  ------------------
 1341|    575|    return 0;
 1342|    575|  }
 1343|  7.61k|  return b2nd_copy_buffer2(ndim, typesize, c->buffer, c->buffershape, overlap.dst_start,
 1344|  7.61k|                           overlap.dst_stop, params->output, c->blockshape, overlap.src_start);
 1345|  8.18k|}
b2nd.c:decoded_nothing:
 1314|    142|static bool decoded_nothing(const blosc2_context *dctx, int rc) {
 1315|    142|  return rc == 0 || (dctx->special_type == BLOSC2_SPECIAL_UNINIT && dctx->postfilter == NULL);
  ------------------
  |  Branch (1315:10): [True: 0, False: 142]
  |  Branch (1315:22): [True: 0, False: 142]
  |  Branch (1315:69): [True: 0, False: 0]
  ------------------
 1316|    142|}
b2nd.c:scratch_malloc:
 1350|    784|static uint8_t *scratch_malloc(const b2nd_array_t *array, int32_t nbytes, size_t *capacity) {
 1351|    784|  return schunk_scratch_malloc(array->sc, nbytes, capacity);
 1352|    784|}
b2nd.c:block_slice_overlap:
 1159|  36.4k|static bool block_slice_overlap(const slice_chunk_t *c, int64_t nblock, block_overlap_t *overlap) {
 1160|  36.4k|  int8_t ndim = c->array->ndim;
 1161|  36.4k|  int64_t nblock_ndim[B2ND_MAX_DIM] = {0};
 1162|  36.4k|  blosc2_unidim_to_multidim(ndim, (int64_t *) c->blocks_in_chunk, nblock, nblock_ndim);
 1163|  36.4k|  bool whole_block = true;
 1164|   175k|  for (int i = 0; i < ndim; ++i) {
  ------------------
  |  Branch (1164:19): [True: 141k, False: 34.3k]
  ------------------
 1165|   141k|    int64_t block_start = c->chunk_start[i] + nblock_ndim[i] * c->blockshape[i];
 1166|   141k|    int64_t block_stop = block_start + c->blockshape[i];
 1167|   141k|    if (block_stop > c->chunk_stop[i]) {
  ------------------
  |  Branch (1167:9): [True: 12.1k, False: 129k]
  ------------------
 1168|  12.1k|      block_stop = c->chunk_stop[i];
 1169|  12.1k|    }
 1170|   141k|    int64_t lo = block_start > c->start[i] ? block_start : c->start[i];
  ------------------
  |  Branch (1170:18): [True: 103k, False: 38.2k]
  ------------------
 1171|   141k|    int64_t hi = block_stop < c->stop[i] ? block_stop : c->stop[i];
  ------------------
  |  Branch (1171:18): [True: 101k, False: 40.0k]
  ------------------
 1172|   141k|    if (lo >= hi) {
  ------------------
  |  Branch (1172:9): [True: 2.10k, False: 139k]
  ------------------
 1173|  2.10k|      return false;
 1174|  2.10k|    }
 1175|   139k|    whole_block &= lo == block_start && hi == block_start + c->blockshape[i];
  ------------------
  |  Branch (1175:20): [True: 139k, False: 0]
  |  Branch (1175:41): [True: 129k, False: 10.0k]
  ------------------
 1176|   139k|    if (overlap != NULL) {
  ------------------
  |  Branch (1176:9): [True: 86.4k, False: 53.1k]
  ------------------
 1177|  86.4k|      overlap->src_start[i] = lo - block_start;
 1178|  86.4k|      overlap->src_stop[i] = hi - block_start;
 1179|  86.4k|      overlap->dst_start[i] = lo - c->start[i];
 1180|  86.4k|      overlap->dst_stop[i] = hi - c->start[i];
 1181|  86.4k|    }
 1182|   139k|  }
 1183|  34.3k|  if (overlap != NULL) {
  ------------------
  |  Branch (1183:7): [True: 21.3k, False: 12.9k]
  ------------------
 1184|  21.3k|    overlap->whole_block = whole_block;
 1185|  21.3k|  }
 1186|       |  return true;
 1187|  36.4k|}
b2nd.c:slice_chunk_maskout:
 1409|  1.12k|static int64_t slice_chunk_maskout(const slice_chunk_t *c, int64_t nblocks, bool has_delta, bool *maskout) {
 1410|  1.12k|  int64_t nneeded = 0;
 1411|  15.2k|  for (int64_t nblock = 0; nblock < nblocks; ++nblock) {
  ------------------
  |  Branch (1411:28): [True: 14.1k, False: 1.12k]
  ------------------
 1412|  14.1k|    maskout[nblock] = !block_slice_overlap(c, nblock, NULL);
 1413|  14.1k|    nneeded += !maskout[nblock];
 1414|  14.1k|  }
 1415|  1.12k|  if (has_delta && nneeded > 0) {
  ------------------
  |  Branch (1415:7): [True: 112, False: 1.01k]
  |  Branch (1415:20): [True: 112, False: 0]
  ------------------
 1416|       |    maskout[0] = false;
 1417|    112|  }
 1418|  1.12k|  return nneeded;
 1419|  1.12k|}
b2nd.c:slice_chunk_compact:
 1424|  1.12k|static bool slice_chunk_compact(const b2nd_array_t *array, int64_t nblocks_needed, bool has_delta) {
 1425|  1.12k|  bool on_disk = array->sc->storage != NULL && array->sc->storage->urlpath != NULL;
  ------------------
  |  Branch (1425:18): [True: 1.12k, False: 0]
  |  Branch (1425:48): [True: 0, False: 1.12k]
  ------------------
 1426|  1.12k|  int64_t frac = on_disk ? 4 : 16;
  ------------------
  |  Branch (1426:18): [True: 0, False: 1.12k]
  ------------------
 1427|  1.12k|  int64_t block_nbytes = (int64_t) array->blocknitems * array->sc->typesize;
 1428|  1.12k|  int64_t data_nbytes = array->extchunknitems * array->sc->typesize;
 1429|  1.12k|  return !has_delta && nblocks_needed * block_nbytes * frac <= data_nbytes;
  ------------------
  |  Branch (1429:10): [True: 1.01k, False: 112]
  |  Branch (1429:24): [True: 2, False: 1.01k]
  ------------------
 1430|  1.12k|}
b2nd.c:slice_scatter_postfilter:
 1279|  11.5k|static int slice_scatter_postfilter(blosc2_postfilter_params *params) {
 1280|  11.5k|  const slice_chunk_t *c = params->user_data;
 1281|  11.5k|  const b2nd_array_t *array = c->array;
 1282|  11.5k|  int8_t ndim = array->ndim;
 1283|  11.5k|  int32_t typesize = array->sc->typesize;
 1284|  11.5k|  if (params->size != array->blocknitems * typesize) {
  ------------------
  |  Branch (1284:7): [True: 0, False: 11.5k]
  ------------------
 1285|      0|    BLOSC_TRACE_ERROR("Unexpected block size in b2nd chunk");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1286|      0|    return BLOSC2_ERROR_FAILURE;
 1287|      0|  }
 1288|  11.5k|  block_overlap_t overlap;
 1289|  11.5k|  if (!block_slice_overlap(c, params->nblock, &overlap)) {
  ------------------
  |  Branch (1289:7): [True: 0, False: 11.5k]
  ------------------
 1290|      0|    return 0;
 1291|      0|  }
 1292|  11.5k|  if (params->ctx->special_type == BLOSC2_SPECIAL_UNINIT) {
  ------------------
  |  Branch (1292:7): [True: 0, False: 11.5k]
  ------------------
 1293|       |    // Nothing was decoded into the input; hand out zeros rather than stale memory
 1294|      0|    b2nd_zero_box(ndim, typesize, c->buffer, c->buffershape, overlap.dst_start, overlap.dst_stop);
 1295|      0|    return 0;
 1296|      0|  }
 1297|  11.5k|  return b2nd_copy_buffer2(ndim, typesize, params->input, c->blockshape, overlap.src_start,
 1298|  11.5k|                           overlap.src_stop, c->buffer, c->buffershape, overlap.dst_start);
 1299|  11.5k|}
b2nd.c:scatter_unsupported:
 1305|  1.01k|static bool scatter_unsupported(const blosc2_context *dctx) {
 1306|  1.01k|  return (dctx->blosc2_flags & BLOSC2_INSTR_CODEC) || filters_contain(dctx->filters, BLOSC_DELTA);
  ------------------
  |  Branch (1306:10): [True: 0, False: 1.01k]
  |  Branch (1306:55): [True: 0, False: 1.01k]
  ------------------
 1307|  1.01k|}
b2nd.c:locked_get_set_slice:
 2109|    208|                                bool set_slice, bool slice_only, prefetch_batch *prefetch) {
 2110|    208|  blosc2_frame_s *frame = (blosc2_frame_s *) array->sc->frame;
 2111|    208|  BLOSC_ERROR(set_slice ? frame_begin_updates(frame) : frame_lock(frame, false));
  ------------------
  |  |  111|    208|    do {                                            \
  |  |  112|    416|        int rc_ = (rc);                             \
  |  |  ------------------
  |  |  |  Branch (112:20): [True: 70, False: 138]
  |  |  ------------------
  |  |  113|    208|        if (rc_ < BLOSC2_ERROR_SUCCESS) {           \
  |  |  ------------------
  |  |  |  Branch (113:13): [True: 0, False: 208]
  |  |  ------------------
  |  |  114|      0|            char *error_msg = print_error(rc_);     \
  |  |  115|      0|            BLOSC_TRACE_ERROR("%s", error_msg);     \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  116|      0|            return rc_;                             \
  |  |  117|      0|        }                                           \
  |  |  118|    208|    } while (0)
  |  |  ------------------
  |  |  |  Branch (118:14): [Folded, False: 208]
  |  |  ------------------
  ------------------
 2112|    208|  int rc = refresh_if_stale(array);
 2113|    208|  if (rc >= 0) {
  ------------------
  |  Branch (2113:7): [True: 208, False: 0]
  ------------------
 2114|    208|    rc = get_set_slice(buffer, buffersize, start, stop, shape, array, set_slice, slice_only, prefetch);
 2115|    208|  }
 2116|    208|  if (set_slice) {
  ------------------
  |  Branch (2116:7): [True: 70, False: 138]
  ------------------
 2117|     70|    int end_rc = frame_end_updates(frame, array->sc);
 2118|     70|    rc = (rc < 0) ? rc : end_rc;
  ------------------
  |  Branch (2118:10): [True: 1, False: 69]
  ------------------
 2119|     70|  }
 2120|    138|  else {
 2121|    138|    frame_unlock(frame);
 2122|    138|  }
 2123|    208|  BLOSC_ERROR(rc);
  ------------------
  |  |  111|    208|    do {                                            \
  |  |  112|    208|        int rc_ = (rc);                             \
  |  |  113|    208|        if (rc_ < BLOSC2_ERROR_SUCCESS) {           \
  |  |  ------------------
  |  |  |  Branch (113:13): [True: 1, False: 207]
  |  |  ------------------
  |  |  114|      1|            char *error_msg = print_error(rc_);     \
  |  |  115|      1|            BLOSC_TRACE_ERROR("%s", error_msg);     \
  |  |  ------------------
  |  |  |  |   93|      1|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      1|    do {                                            \
  |  |  |  |  |  |   98|      1|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      1|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 1, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      1|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  116|      1|            return rc_;                             \
  |  |  117|      1|        }                                           \
  |  |  118|    208|    } while (0)
  |  |  ------------------
  |  |  |  Branch (118:14): [Folded, False: 207]
  |  |  ------------------
  ------------------
 2124|       |
 2125|    207|  return BLOSC2_ERROR_SUCCESS;
 2126|    208|}
b2nd.c:validate_shape_chunkshape_blockshape:
  124|    279|                                                const int32_t *chunkshape, const int32_t *blockshape) {
  125|  1.28k|  for (int i = 0; i < ndim; ++i) {
  ------------------
  |  Branch (125:19): [True: 1.00k, False: 279]
  ------------------
  126|  1.00k|    if (shape[i] < 0) {
  ------------------
  |  Branch (126:9): [True: 0, False: 1.00k]
  ------------------
  127|      0|      BLOSC_TRACE_ERROR("shape[%d] cannot be negative", i);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  128|      0|      return BLOSC2_ERROR_INVALID_PARAM;
  129|      0|    }
  130|  1.00k|    if (chunkshape[i] < 0 || blockshape[i] < 0) {
  ------------------
  |  Branch (130:9): [True: 0, False: 1.00k]
  |  Branch (130:30): [True: 0, False: 1.00k]
  ------------------
  131|      0|      BLOSC_TRACE_ERROR("chunkshape[%d] and blockshape[%d] cannot be negative", i, i);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  132|      0|      return BLOSC2_ERROR_INVALID_PARAM;
  133|      0|    }
  134|       |
  135|  1.00k|    bool chunkshape_is_zero = (chunkshape[i] == 0);
  136|  1.00k|    bool blockshape_is_zero = (blockshape[i] == 0);
  137|       |
  138|       |    // Keep compatibility with contexts that use chunkshape=0 (e.g. empty slices).
  139|       |    // Reject only invalid tuples that can produce divide-by-zero when chunkshape is non-zero.
  140|  1.00k|    if (blockshape_is_zero && !chunkshape_is_zero) {
  ------------------
  |  Branch (140:9): [True: 0, False: 1.00k]
  |  Branch (140:31): [True: 0, False: 0]
  ------------------
  141|      0|      BLOSC_TRACE_ERROR("blockshape[%d] cannot be zero when chunkshape[%d] is non-zero", i, i);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  142|      0|      return BLOSC2_ERROR_INVALID_PARAM;
  143|      0|    }
  144|  1.00k|  }
  145|       |
  146|    279|  return BLOSC2_ERROR_SUCCESS;
  147|    279|}

b2nd_copy_buffer2:
  192|  21.3k|                      const int64_t *dst_start) {
  193|  21.3k|  int64_t copy_shape[B2ND_MAX_DIM];
  194|   106k|  for (int i = 0; i < ndim; ++i) {
  ------------------
  |  Branch (194:19): [True: 85.2k, False: 21.3k]
  ------------------
  195|  85.2k|    copy_shape[i] = src_stop[i] - src_start[i];
  196|  85.2k|    if (copy_shape[i] == 0) {
  ------------------
  |  Branch (196:9): [True: 0, False: 85.2k]
  ------------------
  197|      0|      return BLOSC2_ERROR_SUCCESS;
  198|      0|    }
  199|  85.2k|  }
  200|  21.3k|  copy_or_zero_box(ndim, itemsize, copy_shape, src, src_pad_shape, src_start, dst, dst_pad_shape, dst_start);
  201|       |
  202|  21.3k|  return BLOSC2_ERROR_SUCCESS;
  203|  21.3k|}
b2nd_zero_box:
  208|     12|                   const int64_t *box_start, const int64_t *box_stop) {
  209|     12|  int64_t box_shape[B2ND_MAX_DIM];
  210|     60|  for (int i = 0; i < ndim; ++i) {
  ------------------
  |  Branch (210:19): [True: 48, False: 12]
  ------------------
  211|     48|    box_shape[i] = box_stop[i] - box_start[i];
  212|     48|    if (box_shape[i] <= 0) {
  ------------------
  |  Branch (212:9): [True: 0, False: 48]
  ------------------
  213|      0|      return;
  214|      0|    }
  215|     48|  }
  216|     12|  copy_or_zero_box(ndim, itemsize, box_shape, NULL, dst_pad_shape, box_start, dst, dst_pad_shape, box_start);
  217|     12|}
b2nd_utils.c:copy_or_zero_box:
  156|  21.3k|                             uint8_t *dst, const int64_t *dst_pad_shape, const int64_t *dst_start) {
  157|  21.3k|  int64_t src_strides[B2ND_MAX_DIM];
  158|  21.3k|  int64_t dst_strides[B2ND_MAX_DIM];
  159|  21.3k|  byte_strides(ndim, itemsize, src_pad_shape, src_strides);
  160|  21.3k|  byte_strides(ndim, itemsize, dst_pad_shape, dst_strides);
  161|  21.3k|  int64_t src_offset = 0;
  162|  21.3k|  int64_t dst_offset = 0;
  163|   106k|  for (int i = 0; i < ndim; ++i) {
  ------------------
  |  Branch (163:19): [True: 85.2k, False: 21.3k]
  ------------------
  164|  85.2k|    src_offset += src_start[i] * src_strides[i];
  165|  85.2k|    dst_offset += dst_start[i] * dst_strides[i];
  166|  85.2k|  }
  167|  21.3k|  dst += dst_offset;
  168|  21.3k|  if (src != NULL) {
  ------------------
  |  Branch (168:7): [True: 21.3k, False: 12]
  ------------------
  169|  21.3k|    src += src_offset;
  170|  21.3k|  }
  171|       |
  172|  21.3k|  int64_t shape[B2ND_MAX_DIM];
  173|  21.3k|  int64_t src_bstrides[B2ND_MAX_DIM];
  174|  21.3k|  int64_t dst_bstrides[B2ND_MAX_DIM];
  175|  21.3k|  int ndim_bytes = simplify_box(ndim, itemsize, box_shape, src_strides, dst_strides, shape, src_bstrides,
  176|  21.3k|                                dst_bstrides);
  177|  21.3k|  if (ndim_bytes > 1) {
  ------------------
  |  Branch (177:7): [True: 21.3k, False: 55]
  ------------------
  178|  21.3k|    copy_box(ndim_bytes, shape, src, src_bstrides, dst, dst_bstrides);
  179|  21.3k|  } else if (src == NULL) {
  ------------------
  |  Branch (179:14): [True: 6, False: 49]
  ------------------
  180|      6|    memset(dst, 0, (size_t) shape[0]);
  181|     49|  } else {
  182|     49|    memcpy(dst, src, (size_t) shape[0]);
  183|     49|  }
  184|  21.3k|}
b2nd_utils.c:byte_strides:
  143|  42.7k|static void byte_strides(int8_t ndim, int32_t itemsize, const int64_t *pad_shape, int64_t *strides) {
  144|  42.7k|  int64_t stride = itemsize;
  145|   213k|  for (int i = ndim - 1; i >= 0; --i) {
  ------------------
  |  Branch (145:26): [True: 170k, False: 42.7k]
  ------------------
  146|   170k|    strides[i] = stride;
  147|   170k|    stride *= pad_shape[i];
  148|   170k|  }
  149|  42.7k|}
b2nd_utils.c:simplify_box:
  114|  21.3k|                        int64_t *shape, int64_t *src_bstrides, int64_t *dst_bstrides) {
  115|  21.3k|  int n = 0;
  116|  21.3k|  int64_t extent = itemsize;
  117|  21.3k|  int64_t src_stride = 1;
  118|  21.3k|  int64_t dst_stride = 1;
  119|   106k|  for (int i = ndim - 1; i >= 0; --i) {
  ------------------
  |  Branch (119:26): [True: 85.2k, False: 21.3k]
  ------------------
  120|  85.2k|    if (box_shape[i] == 1) {
  ------------------
  |  Branch (120:9): [True: 5.84k, False: 79.4k]
  ------------------
  121|  5.84k|      continue;
  122|  5.84k|    }
  123|  79.4k|    if (src_strides[i] == src_stride * extent && dst_strides[i] == dst_stride * extent) {
  ------------------
  |  Branch (123:9): [True: 53.7k, False: 25.6k]
  |  Branch (123:50): [True: 20.2k, False: 33.4k]
  ------------------
  124|  20.2k|      extent *= box_shape[i];
  125|  20.2k|      continue;
  126|  20.2k|    }
  127|  59.1k|    shape[n] = extent;
  128|  59.1k|    src_bstrides[n] = src_stride;
  129|  59.1k|    dst_bstrides[n] = dst_stride;
  130|  59.1k|    ++n;
  131|  59.1k|    extent = box_shape[i];
  132|  59.1k|    src_stride = src_strides[i];
  133|  59.1k|    dst_stride = dst_strides[i];
  134|  59.1k|  }
  135|  21.3k|  shape[n] = extent;
  136|  21.3k|  src_bstrides[n] = src_stride;
  137|  21.3k|  dst_bstrides[n] = dst_stride;
  138|  21.3k|  return n + 1;
  139|  21.3k|}
b2nd_utils.c:copy_box:
   69|  21.3k|                     uint8_t *dst, const int64_t *dst_strides) {
   70|  21.3k|  const int64_t row_nbytes = shape[0];
   71|  21.3k|  const int64_t nrows = shape[1];
   72|  21.3k|  const int64_t src_row_stride = src_strides[1];
   73|  21.3k|  const int64_t dst_row_stride = dst_strides[1];
   74|  21.3k|  int64_t index[B2ND_MAX_DIM];
   75|  59.1k|  for (int i = 2; i < ndim; ++i) {
  ------------------
  |  Branch (75:19): [True: 37.8k, False: 21.3k]
  ------------------
   76|  37.8k|    index[i] = 0;
   77|  37.8k|  }
   78|  78.8k|  for (;;) {
   79|  78.8k|    int64_t src_offset = 0;
   80|  78.8k|    int64_t dst_offset = 0;
   81|   227k|    for (int i = 2; i < ndim; ++i) {
  ------------------
  |  Branch (81:21): [True: 148k, False: 78.8k]
  ------------------
   82|   148k|      src_offset += index[i] * src_strides[i];
   83|   148k|      dst_offset += index[i] * dst_strides[i];
   84|   148k|    }
   85|  78.8k|    if (src == NULL) {
  ------------------
  |  Branch (85:9): [True: 42, False: 78.7k]
  ------------------
   86|     42|      uint8_t *row = dst + dst_offset;
   87|    210|      for (int64_t r = 0; r < nrows; ++r) {
  ------------------
  |  Branch (87:27): [True: 168, False: 42]
  ------------------
   88|    168|        memset(row, 0, (size_t) row_nbytes);
   89|    168|        row += dst_row_stride;
   90|    168|      }
   91|  78.7k|    } else {
   92|  78.7k|      copy_rows(dst + dst_offset, dst_row_stride, src + src_offset, src_row_stride, nrows, row_nbytes);
   93|  78.7k|    }
   94|  78.8k|    int i = 2;
   95|   134k|    while (i < ndim && ++index[i] == shape[i]) {
  ------------------
  |  Branch (95:12): [True: 112k, False: 21.3k]
  |  Branch (95:24): [True: 55.3k, False: 57.5k]
  ------------------
   96|  55.3k|      index[i] = 0;
   97|  55.3k|      ++i;
   98|  55.3k|    }
   99|  78.8k|    if (i == ndim) {
  ------------------
  |  Branch (99:9): [True: 21.3k, False: 57.5k]
  ------------------
  100|  21.3k|      break;
  101|  21.3k|    }
  102|  78.8k|  }
  103|  21.3k|}
b2nd_utils.c:copy_rows:
   23|  78.7k|                             int64_t nrows, int64_t row_nbytes) {
   24|  78.7k|#define COPY_ROWS(stmt)                     \
   25|  78.7k|  for (int64_t r = nrows; r > 0; --r) {     \
   26|  78.7k|    stmt;                                   \
   27|  78.7k|    dst += dst_stride;                      \
   28|  78.7k|    src += src_stride;                      \
   29|  78.7k|  }
   30|  78.7k|#define MOVE_2X(n)                                                     \
   31|  78.7k|  memcpy(dst, src, n);                                                 \
   32|  78.7k|  memcpy(dst + row_nbytes - (n), src + row_nbytes - (n), n)
   33|       |
   34|  78.7k|  if (row_nbytes > 64) {
  ------------------
  |  Branch (34:7): [True: 12, False: 78.7k]
  ------------------
   35|     12|    COPY_ROWS(memcpy(dst, src, (size_t) row_nbytes))
  ------------------
  |  |   25|     60|  for (int64_t r = nrows; r > 0; --r) {     \
  |  |  ------------------
  |  |  |  Branch (25:27): [True: 48, False: 12]
  |  |  ------------------
  |  |   26|     48|    stmt;                                   \
  |  |   27|     48|    dst += dst_stride;                      \
  |  |   28|     48|    src += src_stride;                      \
  |  |   29|     48|  }
  ------------------
   36|  78.7k|  } else if (row_nbytes > 32) {
  ------------------
  |  Branch (36:14): [True: 22, False: 78.7k]
  ------------------
   37|     22|    COPY_ROWS(MOVE_2X(32))
  ------------------
  |  |   25|    107|  for (int64_t r = nrows; r > 0; --r) {     \
  |  |  ------------------
  |  |  |  Branch (25:27): [True: 85, False: 22]
  |  |  ------------------
  |  |   26|     85|    stmt;                                   \
  |  |   27|     85|    dst += dst_stride;                      \
  |  |   28|     85|    src += src_stride;                      \
  |  |   29|     85|  }
  ------------------
   38|  78.7k|  } else if (row_nbytes == 32) {
  ------------------
  |  Branch (38:14): [True: 774, False: 77.9k]
  ------------------
   39|    774|    COPY_ROWS(memcpy(dst, src, 32))
  ------------------
  |  |   25|  3.69k|  for (int64_t r = nrows; r > 0; --r) {     \
  |  |  ------------------
  |  |  |  Branch (25:27): [True: 2.91k, False: 774]
  |  |  ------------------
  |  |   26|  2.91k|    stmt;                                   \
  |  |   27|  2.91k|    dst += dst_stride;                      \
  |  |   28|  2.91k|    src += src_stride;                      \
  |  |   29|  2.91k|  }
  ------------------
   40|  77.9k|  } else if (row_nbytes > 16) {
  ------------------
  |  Branch (40:14): [True: 42, False: 77.9k]
  ------------------
   41|     42|    COPY_ROWS(MOVE_2X(16))
  ------------------
  |  |   25|    189|  for (int64_t r = nrows; r > 0; --r) {     \
  |  |  ------------------
  |  |  |  Branch (25:27): [True: 147, False: 42]
  |  |  ------------------
  |  |   26|    147|    stmt;                                   \
  |  |   27|    147|    dst += dst_stride;                      \
  |  |   28|    147|    src += src_stride;                      \
  |  |   29|    147|  }
  ------------------
   42|  77.9k|  } else if (row_nbytes == 16) {
  ------------------
  |  Branch (42:14): [True: 64.5k, False: 13.4k]
  ------------------
   43|  64.5k|    COPY_ROWS(memcpy(dst, src, 16))
  ------------------
  |  |   25|   197k|  for (int64_t r = nrows; r > 0; --r) {     \
  |  |  ------------------
  |  |  |  Branch (25:27): [True: 133k, False: 64.5k]
  |  |  ------------------
  |  |   26|   133k|    stmt;                                   \
  |  |   27|   133k|    dst += dst_stride;                      \
  |  |   28|   133k|    src += src_stride;                      \
  |  |   29|   133k|  }
  ------------------
   44|  64.5k|  } else if (row_nbytes > 8) {
  ------------------
  |  Branch (44:14): [True: 42, False: 13.3k]
  ------------------
   45|     42|    COPY_ROWS(MOVE_2X(8))
  ------------------
  |  |   25|    189|  for (int64_t r = nrows; r > 0; --r) {     \
  |  |  ------------------
  |  |  |  Branch (25:27): [True: 147, False: 42]
  |  |  ------------------
  |  |   26|    147|    stmt;                                   \
  |  |   27|    147|    dst += dst_stride;                      \
  |  |   28|    147|    src += src_stride;                      \
  |  |   29|    147|  }
  ------------------
   46|  13.3k|  } else if (row_nbytes == 8) {
  ------------------
  |  Branch (46:14): [True: 9.95k, False: 3.42k]
  ------------------
   47|  9.95k|    COPY_ROWS(memcpy(dst, src, 8))
  ------------------
  |  |   25|  29.9k|  for (int64_t r = nrows; r > 0; --r) {     \
  |  |  ------------------
  |  |  |  Branch (25:27): [True: 19.9k, False: 9.95k]
  |  |  ------------------
  |  |   26|  19.9k|    stmt;                                   \
  |  |   27|  19.9k|    dst += dst_stride;                      \
  |  |   28|  19.9k|    src += src_stride;                      \
  |  |   29|  19.9k|  }
  ------------------
   48|  9.95k|  } else if (row_nbytes > 4) {
  ------------------
  |  Branch (48:14): [True: 0, False: 3.42k]
  ------------------
   49|      0|    COPY_ROWS(MOVE_2X(4))
  ------------------
  |  |   25|      0|  for (int64_t r = nrows; r > 0; --r) {     \
  |  |  ------------------
  |  |  |  Branch (25:27): [True: 0, False: 0]
  |  |  ------------------
  |  |   26|      0|    stmt;                                   \
  |  |   27|      0|    dst += dst_stride;                      \
  |  |   28|      0|    src += src_stride;                      \
  |  |   29|      0|  }
  ------------------
   50|  3.42k|  } else if (row_nbytes == 4) {
  ------------------
  |  Branch (50:14): [True: 1.09k, False: 2.33k]
  ------------------
   51|  1.09k|    COPY_ROWS(memcpy(dst, src, 4))
  ------------------
  |  |   25|  4.04k|  for (int64_t r = nrows; r > 0; --r) {     \
  |  |  ------------------
  |  |  |  Branch (25:27): [True: 2.95k, False: 1.09k]
  |  |  ------------------
  |  |   26|  2.95k|    stmt;                                   \
  |  |   27|  2.95k|    dst += dst_stride;                      \
  |  |   28|  2.95k|    src += src_stride;                      \
  |  |   29|  2.95k|  }
  ------------------
   52|  2.33k|  } else if (row_nbytes > 2) {
  ------------------
  |  Branch (52:14): [True: 0, False: 2.33k]
  ------------------
   53|      0|    COPY_ROWS(MOVE_2X(2))
  ------------------
  |  |   25|      0|  for (int64_t r = nrows; r > 0; --r) {     \
  |  |  ------------------
  |  |  |  Branch (25:27): [True: 0, False: 0]
  |  |  ------------------
  |  |   26|      0|    stmt;                                   \
  |  |   27|      0|    dst += dst_stride;                      \
  |  |   28|      0|    src += src_stride;                      \
  |  |   29|      0|  }
  ------------------
   54|  2.33k|  } else if (row_nbytes == 2) {
  ------------------
  |  Branch (54:14): [True: 1.98k, False: 353]
  ------------------
   55|  1.98k|    COPY_ROWS(memcpy(dst, src, 2))
  ------------------
  |  |   25|  5.94k|  for (int64_t r = nrows; r > 0; --r) {     \
  |  |  ------------------
  |  |  |  Branch (25:27): [True: 3.96k, False: 1.98k]
  |  |  ------------------
  |  |   26|  3.96k|    stmt;                                   \
  |  |   27|  3.96k|    dst += dst_stride;                      \
  |  |   28|  3.96k|    src += src_stride;                      \
  |  |   29|  3.96k|  }
  ------------------
   56|  1.98k|  } else {
   57|    353|    COPY_ROWS(*dst = *src)
  ------------------
  |  |   25|  1.05k|  for (int64_t r = nrows; r > 0; --r) {     \
  |  |  ------------------
  |  |  |  Branch (25:27): [True: 706, False: 353]
  |  |  ------------------
  |  |   26|    706|    stmt;                                   \
  |  |   27|    706|    dst += dst_stride;                      \
  |  |   28|    706|    src += src_stride;                      \
  |  |   29|    706|  }
  ------------------
   58|    353|  }
   59|  78.7k|#undef MOVE_2X
   60|  78.7k|#undef COPY_ROWS
   61|  78.7k|}

bshuf_trans_bit_byte_AVX:
   66|  27.6k|                                 const size_t elem_size) {
   67|       |
   68|  27.6k|  size_t ii, kk;
   69|  27.6k|  const char* in_b = (const char*) in;
   70|  27.6k|  char* out_b = (char*) out;
   71|       |
   72|  27.6k|  size_t nbyte = elem_size * size;
   73|       |
   74|  27.6k|  int64_t count;
   75|       |
   76|  27.6k|  __m256i ymm;
   77|  27.6k|  int32_t bt;
   78|       |
   79|  27.6k|  ii = bshuf_emit_constant_prefix(in, out, nbyte);
   80|  27.6k|  if (ii == nbyte) return nbyte;
  ------------------
  |  Branch (80:7): [True: 0, False: 27.6k]
  ------------------
   81|  27.6k|  for (; ii + 31 < nbyte; ii += 32) {
  ------------------
  |  Branch (81:10): [True: 32, False: 27.6k]
  ------------------
   82|     32|    ymm = _mm256_loadu_si256((__m256i *) &in_b[ii]);
   83|    288|    for (kk = 0; kk < 8; kk++) {
  ------------------
  |  Branch (83:18): [True: 256, False: 32]
  ------------------
   84|    256|      bt = _mm256_movemask_epi8(ymm);
   85|    256|      ymm = _mm256_slli_epi16(ymm, 1);
   86|    256|      memcpy(out_b + ((7 - kk) * nbyte + ii) / 8, &bt, sizeof(bt));
   87|    256|    }
   88|     32|  }
   89|  27.6k|  count = bshuf_trans_bit_byte_remainder(in, out, size, elem_size,
   90|  27.6k|                                         nbyte - nbyte % 32);
   91|  27.6k|  return count;
   92|  27.6k|}
bshuf_trans_bit_elem_AVX:
   97|  3.46k|                                 const size_t elem_size, void* tmp_buf) {
   98|       |
   99|  3.46k|  int64_t count;
  100|       |
  101|  3.46k|  CHECK_MULT_EIGHT(size);
  ------------------
  |  |   35|  3.46k|#define CHECK_MULT_EIGHT(n) if (n % 8) return -80;
  |  |  ------------------
  |  |  |  Branch (35:33): [True: 0, False: 3.46k]
  |  |  ------------------
  ------------------
  102|       |
  103|  3.46k|  if ((elem_size == 1 || elem_size == 2 || elem_size == 4 || elem_size == 8 || elem_size == 16)
  ------------------
  |  Branch (103:8): [True: 3, False: 3.46k]
  |  Branch (103:26): [True: 0, False: 3.46k]
  |  Branch (103:44): [True: 4, False: 3.45k]
  |  Branch (103:62): [True: 3.45k, False: 0]
  |  Branch (103:80): [True: 0, False: 0]
  ------------------
  104|  3.46k|      && size <= INT32_MAX / elem_size) {
  ------------------
  |  Branch (104:10): [True: 3.46k, False: 0]
  ------------------
  105|  3.46k|    const uint8_t* bytes = (const uint8_t*)in;
  106|  3.46k|    if (elem_size != 1) {
  ------------------
  |  Branch (106:9): [True: 3.46k, False: 3]
  ------------------
  107|       |      /* Keep the existing 128-bit byte-transpose stage; the bit stage below
  108|       |       * uses AVX2 and writes directly to the final rows. */
  109|  3.46k|      shuffle_sse2((int32_t)elem_size, (int32_t)(size * elem_size), in, tmp_buf);
  110|  3.46k|      bytes = (const uint8_t*)tmp_buf;
  111|  3.46k|    }
  112|  31.1k|    for (size_t j = 0; j < elem_size; ++j) {
  ------------------
  |  Branch (112:24): [True: 27.6k, False: 3.46k]
  ------------------
  113|  27.6k|      count = bshuf_trans_bit_byte_AVX(bytes + j * size, (uint8_t*)out + j * size, size, 1);
  114|  27.6k|      CHECK_ERR(count);
  ------------------
  |  |   40|  27.6k|        do {                              \
  |  |   41|  27.6k|          if ((count) < 0)                \
  |  |  ------------------
  |  |  |  Branch (41:15): [True: 0, False: 27.6k]
  |  |  ------------------
  |  |   42|  27.6k|            return count;                 \
  |  |   43|  27.6k|         } while (0)
  |  |  ------------------
  |  |  |  Branch (43:19): [Folded, False: 27.6k]
  |  |  ------------------
  ------------------
  115|  27.6k|    }
  116|  3.46k|    return size * elem_size;
  117|  3.46k|  }
  118|      0|  count = bshuf_trans_byte_elem_SSE(in, out, size, elem_size, tmp_buf);
  119|      0|  CHECK_ERR(count);
  ------------------
  |  |   40|      0|        do {                              \
  |  |   41|      0|          if ((count) < 0)                \
  |  |  ------------------
  |  |  |  Branch (41:15): [True: 0, False: 0]
  |  |  ------------------
  |  |   42|      0|            return count;                 \
  |  |   43|      0|         } while (0)
  |  |  ------------------
  |  |  |  Branch (43:19): [Folded, False: 0]
  |  |  ------------------
  ------------------
  120|      0|  count = bshuf_trans_bit_byte_AVX(out, tmp_buf, size, elem_size);
  121|      0|  CHECK_ERR(count);
  ------------------
  |  |   40|      0|        do {                              \
  |  |   41|      0|          if ((count) < 0)                \
  |  |  ------------------
  |  |  |  Branch (41:15): [True: 0, False: 0]
  |  |  ------------------
  |  |   42|      0|            return count;                 \
  |  |   43|      0|         } while (0)
  |  |  ------------------
  |  |  |  Branch (43:19): [Folded, False: 0]
  |  |  ------------------
  ------------------
  122|      0|  count = bshuf_trans_bitrow_eight(tmp_buf, out, size, elem_size);
  123|       |
  124|      0|  return count;
  125|      0|}
bshuf_trans_byte_bitrow_AVX:
  131|    144|                                    const size_t elem_size) {
  132|       |
  133|    144|  size_t hh, ii, jj, kk, mm;
  134|    144|  const char* in_b = (const char*) in;
  135|    144|  char* out_b = (char*) out;
  136|       |
  137|    144|  CHECK_MULT_EIGHT(size);
  ------------------
  |  |   35|    144|#define CHECK_MULT_EIGHT(n) if (n % 8) return -80;
  |  |  ------------------
  |  |  |  Branch (35:33): [True: 0, False: 144]
  |  |  ------------------
  ------------------
  138|       |
  139|    144|  size_t nrows = 8 * elem_size;
  140|    144|  size_t nbyte_row = size / 8;
  141|       |
  142|    144|  if (elem_size % 4) return bshuf_trans_byte_bitrow_SSE(in, out, size,
  ------------------
  |  Branch (142:7): [True: 84, False: 60]
  ------------------
  143|     84|                                                        elem_size);
  144|       |
  145|     60|  __m256i ymm_0[8];
  146|     60|  __m256i ymm_1[8];
  147|     60|  __m256i ymm_storeage[8][4];
  148|       |
  149|   125k|  for (jj = 0; jj + 31 < nbyte_row; jj += 32) {
  ------------------
  |  Branch (149:16): [True: 125k, False: 60]
  ------------------
  150|  1.85M|    for (ii = 0; ii + 3 < elem_size; ii += 4) {
  ------------------
  |  Branch (150:18): [True: 1.72M, False: 125k]
  ------------------
  151|  8.62M|      for (hh = 0; hh < 4; hh ++) {
  ------------------
  |  Branch (151:20): [True: 6.89M, False: 1.72M]
  ------------------
  152|       |
  153|  62.0M|        for (kk = 0; kk < 8; kk ++){
  ------------------
  |  Branch (153:22): [True: 55.1M, False: 6.89M]
  ------------------
  154|  55.1M|          ymm_0[kk] = _mm256_loadu_si256((__m256i *) &in_b[
  155|  55.1M|              (ii * 8 + hh * 8 + kk) * nbyte_row + jj]);
  156|  55.1M|        }
  157|       |
  158|  34.4M|        for (kk = 0; kk < 4; kk ++){
  ------------------
  |  Branch (158:22): [True: 27.5M, False: 6.89M]
  ------------------
  159|  27.5M|          ymm_1[kk] = _mm256_unpacklo_epi8(ymm_0[kk * 2],
  160|  27.5M|                                           ymm_0[kk * 2 + 1]);
  161|  27.5M|          ymm_1[kk + 4] = _mm256_unpackhi_epi8(ymm_0[kk * 2],
  162|  27.5M|                                               ymm_0[kk * 2 + 1]);
  163|  27.5M|        }
  164|       |
  165|  20.6M|        for (kk = 0; kk < 2; kk ++){
  ------------------
  |  Branch (165:22): [True: 13.7M, False: 6.89M]
  ------------------
  166|  41.3M|          for (mm = 0; mm < 2; mm ++){
  ------------------
  |  Branch (166:24): [True: 27.5M, False: 13.7M]
  ------------------
  167|  27.5M|            ymm_0[kk * 4 + mm] = _mm256_unpacklo_epi16(
  168|  27.5M|                ymm_1[kk * 4 + mm * 2],
  169|  27.5M|                ymm_1[kk * 4 + mm * 2 + 1]);
  170|  27.5M|            ymm_0[kk * 4 + mm + 2] = _mm256_unpackhi_epi16(
  171|  27.5M|                ymm_1[kk * 4 + mm * 2],
  172|  27.5M|                ymm_1[kk * 4 + mm * 2 + 1]);
  173|  27.5M|          }
  174|  13.7M|        }
  175|       |
  176|  34.4M|        for (kk = 0; kk < 4; kk ++){
  ------------------
  |  Branch (176:22): [True: 27.5M, False: 6.89M]
  ------------------
  177|  27.5M|          ymm_1[kk * 2] = _mm256_unpacklo_epi32(ymm_0[kk * 2],
  178|  27.5M|                                                ymm_0[kk * 2 + 1]);
  179|  27.5M|          ymm_1[kk * 2 + 1] = _mm256_unpackhi_epi32(ymm_0[kk * 2],
  180|  27.5M|                                                    ymm_0[kk * 2 + 1]);
  181|  27.5M|        }
  182|       |
  183|  62.0M|        for (kk = 0; kk < 8; kk ++){
  ------------------
  |  Branch (183:22): [True: 55.1M, False: 6.89M]
  ------------------
  184|  55.1M|          ymm_storeage[kk][hh] = ymm_1[kk];
  185|  55.1M|        }
  186|  6.89M|      }
  187|       |
  188|  15.5M|      for (mm = 0; mm < 8; mm ++) {
  ------------------
  |  Branch (188:20): [True: 13.7M, False: 1.72M]
  ------------------
  189|       |
  190|  68.9M|        for (kk = 0; kk < 4; kk ++){
  ------------------
  |  Branch (190:22): [True: 55.1M, False: 13.7M]
  ------------------
  191|  55.1M|          ymm_0[kk] = ymm_storeage[mm][kk];
  192|  55.1M|        }
  193|       |
  194|  13.7M|        ymm_1[0] = _mm256_unpacklo_epi64(ymm_0[0], ymm_0[1]);
  195|  13.7M|        ymm_1[1] = _mm256_unpacklo_epi64(ymm_0[2], ymm_0[3]);
  196|  13.7M|        ymm_1[2] = _mm256_unpackhi_epi64(ymm_0[0], ymm_0[1]);
  197|  13.7M|        ymm_1[3] = _mm256_unpackhi_epi64(ymm_0[2], ymm_0[3]);
  198|       |
  199|  13.7M|        ymm_0[0] = _mm256_permute2x128_si256(ymm_1[0], ymm_1[1], 32);
  200|  13.7M|        ymm_0[1] = _mm256_permute2x128_si256(ymm_1[2], ymm_1[3], 32);
  201|  13.7M|        ymm_0[2] = _mm256_permute2x128_si256(ymm_1[0], ymm_1[1], 49);
  202|  13.7M|        ymm_0[3] = _mm256_permute2x128_si256(ymm_1[2], ymm_1[3], 49);
  203|       |
  204|  13.7M|        _mm256_storeu_si256((__m256i *) &out_b[
  205|  13.7M|            (jj + mm * 2 + 0 * 16) * nrows + ii * 8], ymm_0[0]);
  206|  13.7M|        _mm256_storeu_si256((__m256i *) &out_b[
  207|  13.7M|            (jj + mm * 2 + 0 * 16 + 1) * nrows + ii * 8], ymm_0[1]);
  208|  13.7M|        _mm256_storeu_si256((__m256i *) &out_b[
  209|  13.7M|            (jj + mm * 2 + 1 * 16) * nrows + ii * 8], ymm_0[2]);
  210|  13.7M|        _mm256_storeu_si256((__m256i *) &out_b[
  211|  13.7M|            (jj + mm * 2 + 1 * 16 + 1) * nrows + ii * 8], ymm_0[3]);
  212|  13.7M|      }
  213|  1.72M|    }
  214|   125k|  }
  215|  42.2k|  for (ii = 0; ii < nrows; ii ++ ) {
  ------------------
  |  Branch (215:16): [True: 42.1k, False: 60]
  ------------------
  216|   412k|    for (jj = nbyte_row - nbyte_row % 32; jj < nbyte_row; jj ++) {
  ------------------
  |  Branch (216:43): [True: 370k, False: 42.1k]
  ------------------
  217|   370k|      out_b[jj * nrows + ii] = in_b[ii * nbyte_row + jj];
  218|   370k|    }
  219|  42.1k|  }
  220|     60|  return size * elem_size;
  221|    144|}
bshuf_shuffle_bit_eightelem_AVX:
  242|    144|                                        const size_t elem_size) {
  243|       |
  244|    144|  CHECK_MULT_EIGHT(size);
  ------------------
  |  |   35|    144|#define CHECK_MULT_EIGHT(n) if (n % 8) return -80;
  |  |  ------------------
  |  |  |  Branch (35:33): [True: 0, False: 144]
  |  |  ------------------
  ------------------
  245|       |
  246|       |  // With a bit of care, this could be written such that such that it is
  247|       |  // in_buf = out_buf safe.
  248|    144|  const char* in_b = (const char*) in;
  249|    144|  char* out_b = (char*) out;
  250|       |
  251|    144|  size_t ii, jj, kk;
  252|    144|  size_t nbyte = elem_size * size;
  253|       |
  254|    144|  __m256i ymm;
  255|    144|  int32_t bt;
  256|       |
  257|    144|  if (elem_size <= 2) {
  ------------------
  |  Branch (257:7): [True: 0, False: 144]
  ------------------
  258|       |    // Each 8-byte word holds the 8 bit rows of 8 one-byte elements, or of
  259|       |    // the low or the high bytes of 8 two-byte elements: transposing its
  260|       |    // bits gives those bytes.
  261|      0|    for (ii = 0; ii + 31 < nbyte; ii += 32) {
  ------------------
  |  Branch (261:18): [True: 0, False: 0]
  ------------------
  262|      0|      ymm = trans_bit_8x8_AVX(_mm256_loadu_si256((__m256i *) &in_b[ii]));
  263|      0|      if (elem_size == 2) {
  ------------------
  |  Branch (263:11): [True: 0, False: 0]
  ------------------
  264|       |        // Each 128-bit lane is [low bytes, high bytes] for ONE group of
  265|       |        // eight elements, not [low0, low1, high0, high1] across the vector.
  266|       |        // Lane-local unpacks therefore pair the corresponding bytes.
  267|      0|        ymm = _mm256_unpacklo_epi8(ymm, _mm256_unpackhi_epi64(ymm, ymm));
  268|      0|      }
  269|      0|      _mm256_storeu_si256((__m256i *) &out_b[ii], ymm);
  270|      0|    }
  271|      0|    if (ii < nbyte) {
  ------------------
  |  Branch (271:9): [True: 0, False: 0]
  ------------------
  272|      0|      bshuf_shuffle_bit_eightelem_SSE(&in_b[ii], &out_b[ii],
  273|      0|                                      (nbyte - ii) / elem_size, elem_size);
  274|      0|    }
  275|    144|  } else if (elem_size % 4) {
  ------------------
  |  Branch (275:14): [True: 84, False: 60]
  ------------------
  276|     84|    return bshuf_shuffle_bit_eightelem_SSE(in, out, size, elem_size);
  277|     84|  } else {
  278|  1.37k|    for (jj = 0; jj + 31 < 8 * elem_size; jj += 32) {
  ------------------
  |  Branch (278:18): [True: 1.31k, False: 60]
  ------------------
  279|  55.2M|      for (ii = 0; ii + 8 * elem_size - 1 < nbyte;
  ------------------
  |  Branch (279:20): [True: 55.2M, False: 1.31k]
  ------------------
  280|  55.2M|           ii += 8 * elem_size) {
  281|  55.2M|        ymm = _mm256_loadu_si256((__m256i *) &in_b[ii + jj]);
  282|   496M|        for (kk = 0; kk < 8; kk++) {
  ------------------
  |  Branch (282:22): [True: 441M, False: 55.2M]
  ------------------
  283|   441M|          bt = _mm256_movemask_epi8(ymm);
  284|   441M|          ymm = _mm256_slli_epi16(ymm, 1);
  285|   441M|          size_t ind = (ii + jj / 8 + (7 - kk) * elem_size);
  286|   441M|          * (int32_t *) &out_b[ind] = bt;
  287|   441M|        }
  288|  55.2M|      }
  289|  1.31k|    }
  290|     60|  }
  291|     60|  return size * elem_size;
  292|    144|}
bshuf_untrans_bit_elem_AVX:
  297|  3.79k|                                   const size_t elem_size, void* tmp_buf) {
  298|       |
  299|  3.79k|  int64_t count;
  300|       |
  301|  3.79k|  CHECK_MULT_EIGHT(size);
  ------------------
  |  |   35|  3.79k|#define CHECK_MULT_EIGHT(n) if (n % 8) return -80;
  |  |  ------------------
  |  |  |  Branch (35:33): [True: 0, False: 3.79k]
  |  |  ------------------
  ------------------
  302|       |
  303|  3.79k|  if (elem_size == 1) return bshuf_untrans_bit_byte_SSE(in, out, size);
  ------------------
  |  Branch (303:7): [True: 66, False: 3.73k]
  ------------------
  304|  3.73k|  if ((elem_size == 2 || elem_size == 4 || elem_size == 8 || elem_size == 16)
  ------------------
  |  Branch (304:8): [True: 12, False: 3.72k]
  |  Branch (304:26): [True: 35, False: 3.68k]
  |  Branch (304:44): [True: 3.52k, False: 156]
  |  Branch (304:62): [True: 12, False: 144]
  ------------------
  305|  3.58k|      && size <= INT32_MAX / elem_size) {
  ------------------
  |  Branch (305:10): [True: 3.58k, False: 0]
  ------------------
  306|  32.1k|    for (size_t j = 0; j < elem_size; ++j) {
  ------------------
  |  Branch (306:24): [True: 28.5k, False: 3.58k]
  ------------------
  307|  28.5k|      bshuf_untrans_bit_byte_SSE((const uint8_t*)in + j * size, (uint8_t*)tmp_buf + j * size, size);
  308|  28.5k|    }
  309|  3.58k|    unshuffle_avx2((int32_t)elem_size, (int32_t)(size * elem_size), tmp_buf, out);
  310|  3.58k|    return size * elem_size;
  311|  3.58k|  }
  312|    144|  count = bshuf_trans_byte_bitrow_AVX(in, tmp_buf, size, elem_size);
  313|    144|  CHECK_ERR(count);
  ------------------
  |  |   40|    144|        do {                              \
  |  |   41|    144|          if ((count) < 0)                \
  |  |  ------------------
  |  |  |  Branch (41:15): [True: 0, False: 144]
  |  |  ------------------
  |  |   42|    144|            return count;                 \
  |  |   43|    144|         } while (0)
  |  |  ------------------
  |  |  |  Branch (43:19): [Folded, False: 144]
  |  |  ------------------
  ------------------
  314|    144|  count =  bshuf_shuffle_bit_eightelem_AVX(tmp_buf, out, size, elem_size);
  315|       |
  316|    144|  return count;
  317|    144|}

bitshuffle-avx2.c:bshuf_emit_constant_prefix:
   79|  27.6k|static inline size_t bshuf_emit_constant_prefix(const void* in, void* out, size_t nbyte) {
   80|  27.6k|  const uint8_t* input = (const uint8_t*)in;
   81|  27.6k|  size_t prefix = bshuf_constant_prefix(input, nbyte);
   82|  27.6k|  if (prefix != 0) {
  ------------------
  |  Branch (82:7): [True: 0, False: 27.6k]
  ------------------
   83|      0|    for (size_t bit = 0; bit < 8; ++bit) {
  ------------------
  |  Branch (83:26): [True: 0, False: 0]
  ------------------
   84|      0|      memset((uint8_t*)out + bit * (nbyte / 8), (input[0] >> bit) & 1 ? 0xff : 0, prefix / 8);
  ------------------
  |  Branch (84:49): [True: 0, False: 0]
  ------------------
   85|      0|    }
   86|      0|  }
   87|  27.6k|  return prefix;
   88|  27.6k|}
bitshuffle-avx2.c:bshuf_constant_prefix:
   24|  27.6k|static inline size_t bshuf_constant_prefix(const uint8_t* input, size_t nbyte) {
   25|       |  /* Eight row fills do not amortize their setup on tiny byte planes. */
   26|  27.6k|  if (nbyte < 1024) return 0;
  ------------------
  |  Branch (26:7): [True: 27.6k, False: 0]
  ------------------
   27|      0|  const uint8_t value = input[0];
   28|      0|#if defined(__AVX2__)
   29|      0|  const __m256i v = _mm256_set1_epi8((char)value);
   30|      0|  __m256i diff = _mm256_or_si256(
   31|      0|      _mm256_xor_si256(_mm256_loadu_si256((const __m256i*)input), v),
   32|      0|      _mm256_xor_si256(_mm256_loadu_si256((const __m256i*)(input + nbyte - 32)), v));
   33|      0|  if (!_mm256_testz_si256(diff, diff)) return 0;
  ------------------
  |  Branch (33:7): [True: 0, False: 0]
  ------------------
   34|       |#elif defined(__SSE2__)
   35|       |  const __m128i v = _mm_set1_epi8((char)value);
   36|       |  __m128i diff = _mm_or_si128(
   37|       |      _mm_xor_si128(_mm_loadu_si128((const __m128i*)input), v),
   38|       |      _mm_xor_si128(_mm_loadu_si128((const __m128i*)(input + nbyte - 16)), v));
   39|       |  if (_mm_movemask_epi8(_mm_cmpeq_epi8(diff, _mm_setzero_si128())) != 0xffff) return 0;
   40|       |#elif defined(__aarch64__) || defined(_M_ARM64)
   41|       |  const uint8x16_t v = vdupq_n_u8(value);
   42|       |  uint8x16_t diff = vorrq_u8(veorq_u8(vld1q_u8(input), v),
   43|       |                            veorq_u8(vld1q_u8(input + nbyte - 16), v));
   44|       |  if (vmaxvq_u8(diff) != 0) return 0;
   45|       |#else
   46|       |  return 0;
   47|       |#endif
   48|      0|  size_t j = 0;
   49|       |  /* Stop at the first nonconstant tile. Its predecessors can still be emitted
   50|       |   * directly, so an unsuccessful scan never requires retransposing that prefix. */
   51|      0|  for (; j + 127 < nbyte; j += 128) {
  ------------------
  |  Branch (51:10): [True: 0, False: 0]
  ------------------
   52|      0|#if defined(__AVX2__)
   53|      0|    __m256i a = _mm256_or_si256(_mm256_xor_si256(_mm256_loadu_si256((const __m256i*)(input+j)), v),
   54|      0|                               _mm256_xor_si256(_mm256_loadu_si256((const __m256i*)(input+j+32)), v));
   55|      0|    __m256i b = _mm256_or_si256(_mm256_xor_si256(_mm256_loadu_si256((const __m256i*)(input+j+64)), v),
   56|      0|                               _mm256_xor_si256(_mm256_loadu_si256((const __m256i*)(input+j+96)), v));
   57|      0|    diff = _mm256_or_si256(a, b);
   58|      0|    if (!_mm256_testz_si256(diff, diff)) return j;
  ------------------
  |  Branch (58:9): [True: 0, False: 0]
  ------------------
   59|       |#elif defined(__SSE2__)
   60|       |    diff = _mm_setzero_si128();
   61|       |    for (size_t k = 0; k < 128; k += 16) {
   62|       |      diff = _mm_or_si128(diff, _mm_xor_si128(_mm_loadu_si128((const __m128i*)(input+j+k)), v));
   63|       |    }
   64|       |    if (_mm_movemask_epi8(_mm_cmpeq_epi8(diff, _mm_setzero_si128())) != 0xffff) return j;
   65|       |#elif defined(__aarch64__) || defined(_M_ARM64)
   66|       |    diff = vdupq_n_u8(0);
   67|       |    for (size_t k = 0; k < 128; k += 16) {
   68|       |      diff = vorrq_u8(diff, veorq_u8(vld1q_u8(input+j+k), v));
   69|       |    }
   70|       |    if (vmaxvq_u8(diff) != 0) return j;
   71|       |#endif
   72|      0|  }
   73|      0|  for (size_t k = j; k < nbyte; ++k) {
  ------------------
  |  Branch (73:22): [True: 0, False: 0]
  ------------------
   74|      0|    if (input[k] != value) return j;
  ------------------
  |  Branch (74:9): [True: 0, False: 0]
  ------------------
   75|      0|  }
   76|      0|  return nbyte;
   77|      0|}

bshuf_trans_bit_byte_remainder:
   74|  27.6k|                                       const size_t elem_size, const size_t start_byte) {
   75|       |
   76|  27.6k|  const uint64_t* in_b = (const uint64_t*) in;
   77|  27.6k|  uint8_t* out_b = (uint8_t*) out;
   78|       |
   79|  27.6k|  uint64_t x, t;
   80|       |
   81|  27.6k|  size_t ii, kk;
   82|  27.6k|  size_t nbyte = elem_size * size;
   83|  27.6k|  size_t nbyte_bitrow = nbyte / 8;
   84|       |
   85|  27.6k|  uint64_t e=1;
   86|  27.6k|  const int little_endian = *(uint8_t *) &e == 1;
   87|  27.6k|  const size_t bit_row_skip = little_endian ? nbyte_bitrow : -nbyte_bitrow;
  ------------------
  |  Branch (87:31): [True: 27.6k, False: 0]
  ------------------
   88|  27.6k|  const int64_t bit_row_offset = little_endian ? 0 : 7 * nbyte_bitrow;
  ------------------
  |  Branch (88:34): [True: 27.6k, False: 0]
  ------------------
   89|       |
   90|  27.6k|  CHECK_MULT_EIGHT(nbyte);
  ------------------
  |  |   35|  27.6k|#define CHECK_MULT_EIGHT(n) if (n % 8) return -80;
  |  |  ------------------
  |  |  |  Branch (35:33): [True: 0, False: 27.6k]
  |  |  ------------------
  ------------------
   91|  27.6k|  CHECK_MULT_EIGHT(start_byte);
  ------------------
  |  |   35|  27.6k|#define CHECK_MULT_EIGHT(n) if (n % 8) return -80;
  |  |  ------------------
  |  |  |  Branch (35:33): [True: 0, False: 27.6k]
  |  |  ------------------
  ------------------
   92|       |
   93|  82.9k|  for (ii = start_byte / 8; ii < nbyte_bitrow; ii ++) {
  ------------------
  |  Branch (93:29): [True: 55.2k, False: 27.6k]
  ------------------
   94|  55.2k|    x = in_b[ii];
   95|  55.2k|    if (little_endian) {
  ------------------
  |  Branch (95:9): [True: 55.2k, False: 0]
  ------------------
   96|  55.2k|      TRANS_BIT_8X8(x, t);
  ------------------
  |  |   54|  55.2k|#define TRANS_BIT_8X8(x, t) {                                               \
  |  |   55|  55.2k|        t = (x ^ (x >> 7)) & 0x00AA00AA00AA00AALL;                          \
  |  |   56|  55.2k|        x = x ^ t ^ (t << 7);                                               \
  |  |   57|  55.2k|        t = (x ^ (x >> 14)) & 0x0000CCCC0000CCCCLL;                         \
  |  |   58|  55.2k|        x = x ^ t ^ (t << 14);                                              \
  |  |   59|  55.2k|        t = (x ^ (x >> 28)) & 0x00000000F0F0F0F0LL;                         \
  |  |   60|  55.2k|        x = x ^ t ^ (t << 28);                                              \
  |  |   61|  55.2k|    }
  ------------------
   97|  55.2k|    } else {
   98|      0|      TRANS_BIT_8X8_BE(x, t);
  ------------------
  |  |   65|      0|#define TRANS_BIT_8X8_BE(x, t) {                                            \
  |  |   66|      0|        t = (x ^ (x >> 9)) & 0x0055005500550055LL;                          \
  |  |   67|      0|        x = x ^ t ^ (t << 9);                                               \
  |  |   68|      0|        t = (x ^ (x >> 18)) & 0x0000333300003333LL;                         \
  |  |   69|      0|        x = x ^ t ^ (t << 18);                                              \
  |  |   70|      0|        t = (x ^ (x >> 36)) & 0x000000000F0F0F0FLL;                         \
  |  |   71|      0|        x = x ^ t ^ (t << 36);                                              \
  |  |   72|      0|    }
  ------------------
   99|      0|    }
  100|   497k|    for (kk = 0; kk < 8; kk ++) {
  ------------------
  |  Branch (100:18): [True: 442k, False: 55.2k]
  ------------------
  101|   442k|      out_b[bit_row_offset + kk * bit_row_skip + ii] = x;
  102|   442k|      x = x >> 8;
  103|   442k|    }
  104|  55.2k|  }
  105|  27.6k|  return size * elem_size;
  106|  27.6k|}
bshuf_shuffle_bit_eightelem_scal:
  194|     47|        const size_t size, const size_t elem_size) {
  195|       |
  196|     47|  const char *in_b;
  197|     47|  char *out_b;
  198|     47|  uint64_t x, t;
  199|     47|  size_t ii, jj, kk;
  200|     47|  size_t nbyte, out_index;
  201|       |
  202|     47|  uint64_t e=1;
  203|     47|  const int little_endian = *(uint8_t *) &e == 1;
  204|     47|  const size_t elem_skip = little_endian ? elem_size : -elem_size;
  ------------------
  |  Branch (204:28): [True: 47, False: 0]
  ------------------
  205|     47|  const uint64_t elem_offset = little_endian ? 0 : 7 * elem_size;
  ------------------
  |  Branch (205:32): [True: 47, False: 0]
  ------------------
  206|       |
  207|     47|  CHECK_MULT_EIGHT(size);
  ------------------
  |  |   35|     47|#define CHECK_MULT_EIGHT(n) if (n % 8) return -80;
  |  |  ------------------
  |  |  |  Branch (35:33): [True: 0, False: 47]
  |  |  ------------------
  ------------------
  208|       |
  209|     47|  in_b = (const char*) in;
  210|     47|  out_b = (char*) out;
  211|       |
  212|     47|  nbyte = elem_size * size;
  213|       |
  214|  2.45k|  for (jj = 0; jj < 8 * elem_size; jj += 8) {
  ------------------
  |  Branch (214:16): [True: 2.41k, False: 47]
  ------------------
  215|   153M|    for (ii = 0; ii + 8 * elem_size - 1 < nbyte; ii += 8 * elem_size) {
  ------------------
  |  Branch (215:18): [True: 153M, False: 2.41k]
  ------------------
  216|   153M|      x = *((uint64_t*) &in_b[ii + jj]);
  217|   153M|      if (little_endian) {
  ------------------
  |  Branch (217:11): [True: 153M, False: 0]
  ------------------
  218|   153M|        TRANS_BIT_8X8(x, t);
  ------------------
  |  |   54|   153M|#define TRANS_BIT_8X8(x, t) {                                               \
  |  |   55|   153M|        t = (x ^ (x >> 7)) & 0x00AA00AA00AA00AALL;                          \
  |  |   56|   153M|        x = x ^ t ^ (t << 7);                                               \
  |  |   57|   153M|        t = (x ^ (x >> 14)) & 0x0000CCCC0000CCCCLL;                         \
  |  |   58|   153M|        x = x ^ t ^ (t << 14);                                              \
  |  |   59|   153M|        t = (x ^ (x >> 28)) & 0x00000000F0F0F0F0LL;                         \
  |  |   60|   153M|        x = x ^ t ^ (t << 28);                                              \
  |  |   61|   153M|    }
  ------------------
  219|   153M|      } else {
  220|      0|        TRANS_BIT_8X8_BE(x, t);
  ------------------
  |  |   65|      0|#define TRANS_BIT_8X8_BE(x, t) {                                            \
  |  |   66|      0|        t = (x ^ (x >> 9)) & 0x0055005500550055LL;                          \
  |  |   67|      0|        x = x ^ t ^ (t << 9);                                               \
  |  |   68|      0|        t = (x ^ (x >> 18)) & 0x0000333300003333LL;                         \
  |  |   69|      0|        x = x ^ t ^ (t << 18);                                              \
  |  |   70|      0|        t = (x ^ (x >> 36)) & 0x000000000F0F0F0FLL;                         \
  |  |   71|      0|        x = x ^ t ^ (t << 36);                                              \
  |  |   72|      0|    }
  ------------------
  221|      0|      }
  222|  1.38G|      for (kk = 0; kk < 8; kk++) {
  ------------------
  |  Branch (222:20): [True: 1.22G, False: 153M]
  ------------------
  223|  1.22G|        out_index = ii + jj / 8 + elem_offset + kk * elem_skip;
  224|  1.22G|        *((uint8_t*) &out_b[out_index]) = x;
  225|  1.22G|        x = x >> 8;
  226|  1.22G|      }
  227|   153M|    }
  228|  2.41k|  }
  229|     47|  return size * elem_size;
  230|     47|}

bshuf_trans_byte_bitrow_SSE:
  456|     84|                                  const size_t elem_size) {
  457|       |  return trans_byte_bitrow_SSE(in, out, size, elem_size, false);
  458|     84|}
bshuf_untrans_bit_byte_SSE:
  461|  28.6k|int64_t bshuf_untrans_bit_byte_SSE(const void* in, void* out, const size_t size) {
  462|       |  return trans_byte_bitrow_SSE(in, out, size, 1, true);
  463|  28.6k|}
bshuf_shuffle_bit_eightelem_SSE:
  483|     84|                                        const size_t elem_size) {
  484|       |
  485|     84|  CHECK_MULT_EIGHT(size);
  ------------------
  |  |   35|     84|#define CHECK_MULT_EIGHT(n) if (n % 8) return -80;
  |  |  ------------------
  |  |  |  Branch (35:33): [True: 0, False: 84]
  |  |  ------------------
  ------------------
  486|       |
  487|       |  // With a bit of care, this could be written such that such that it is
  488|       |  // in_buf = out_buf safe.
  489|     84|  const char* in_b = (const char*) in;
  490|     84|  char* out_b = (char*) out;
  491|     84|  uint16_t* out_ui16 = (uint16_t*) out;
  492|       |
  493|     84|  size_t ii, jj, kk;
  494|     84|  size_t nbyte = elem_size * size;
  495|       |
  496|     84|  __m128i xmm;
  497|     84|  int32_t bt;
  498|       |
  499|     84|  if (elem_size <= 2) {
  ------------------
  |  Branch (499:7): [True: 0, False: 84]
  ------------------
  500|       |    // Each 8-byte word holds the 8 bit rows of 8 one-byte elements, or of
  501|       |    // the low or the high bytes of 8 two-byte elements: transposing its
  502|       |    // bits gives those bytes.
  503|      0|    for (ii = 0; ii + 15 < nbyte; ii += 16) {
  ------------------
  |  Branch (503:18): [True: 0, False: 0]
  ------------------
  504|      0|      xmm = trans_bit_8x8_SSE(_mm_loadu_si128((__m128i *) &in_b[ii]));
  505|      0|      if (elem_size == 2) {
  ------------------
  |  Branch (505:11): [True: 0, False: 0]
  ------------------
  506|       |        // interleave the low bytes (first word) and high bytes (second word)
  507|      0|        xmm = _mm_unpacklo_epi8(xmm, _mm_unpackhi_epi64(xmm, xmm));
  508|      0|      }
  509|      0|      _mm_storeu_si128((__m128i *) &out_b[ii], xmm);
  510|      0|    }
  511|      0|    if (ii < nbyte) {
  ------------------
  |  Branch (511:9): [True: 0, False: 0]
  ------------------
  512|      0|      bshuf_shuffle_bit_eightelem_scal(&in_b[ii], &out_b[ii],
  513|      0|                                       (nbyte - ii) / elem_size, elem_size);
  514|      0|    }
  515|     84|  } else if (elem_size % 2) {
  ------------------
  |  Branch (515:14): [True: 47, False: 37]
  ------------------
  516|     47|    bshuf_shuffle_bit_eightelem_scal(in, out, size, elem_size);
  517|     47|  } else {
  518|  9.00M|    for (ii = 0; ii + 8 * elem_size - 1 < nbyte;
  ------------------
  |  Branch (518:18): [True: 9.00M, False: 37]
  ------------------
  519|  9.00M|         ii += 8 * elem_size) {
  520|   149M|      for (jj = 0; jj + 15 < 8 * elem_size; jj += 16) {
  ------------------
  |  Branch (520:20): [True: 140M, False: 9.00M]
  ------------------
  521|   140M|        xmm = _mm_loadu_si128((__m128i *) &in_b[ii + jj]);
  522|  1.26G|        for (kk = 0; kk < 8; kk++) {
  ------------------
  |  Branch (522:22): [True: 1.12G, False: 140M]
  ------------------
  523|  1.12G|          bt = _mm_movemask_epi8(xmm);
  524|  1.12G|          xmm = _mm_slli_epi16(xmm, 1);
  525|  1.12G|          size_t ind = (ii + jj / 8 + (7 - kk) * elem_size);
  526|  1.12G|          out_ui16[ind / 2] = bt;
  527|  1.12G|        }
  528|   140M|      }
  529|  9.00M|    }
  530|     37|  }
  531|     84|  return size * elem_size;
  532|     84|}
bitshuffle-sse2.c:trans_byte_bitrow_SSE:
  337|  28.7k|                                     const size_t elem_size, const bool transpose_bits) {
  338|       |
  339|  28.7k|  size_t ii, jj;
  340|  28.7k|  const char* in_b = (const char*) in;
  341|  28.7k|  char* out_b = (char*) out;
  342|       |
  343|  28.7k|  CHECK_MULT_EIGHT(size);
  ------------------
  |  |   35|  28.7k|#define CHECK_MULT_EIGHT(n) if (n % 8) return -80;
  |  |  ------------------
  |  |  |  Branch (35:33): [True: 0, False: 28.7k]
  |  |  ------------------
  ------------------
  344|       |
  345|  28.7k|  size_t nrows = 8 * elem_size;
  346|  28.7k|  size_t nbyte_row = size / 8;
  347|       |
  348|  28.7k|  __m128i a0, b0, c0, d0, e0, f0, g0, h0;
  349|  28.7k|  __m128i a1, b1, c1, d1, e1, f1, g1, h1;
  350|  28.7k|  __m128 *as, *bs, *cs, *ds, *es, *fs, *gs, *hs;
  351|       |
  352|  62.5k|  for (ii = 0; ii + 7 < nrows; ii += 8) {
  ------------------
  |  Branch (352:16): [True: 33.8k, False: 28.7k]
  ------------------
  353|  67.2M|    for (jj = 0; jj + 15 < nbyte_row; jj += 16) {
  ------------------
  |  Branch (353:18): [True: 67.2M, False: 33.8k]
  ------------------
  354|  67.2M|      a0 = _mm_loadu_si128((__m128i *) &in_b[(ii + 0)*nbyte_row + jj]);
  355|  67.2M|      b0 = _mm_loadu_si128((__m128i *) &in_b[(ii + 1)*nbyte_row + jj]);
  356|  67.2M|      c0 = _mm_loadu_si128((__m128i *) &in_b[(ii + 2)*nbyte_row + jj]);
  357|  67.2M|      d0 = _mm_loadu_si128((__m128i *) &in_b[(ii + 3)*nbyte_row + jj]);
  358|  67.2M|      e0 = _mm_loadu_si128((__m128i *) &in_b[(ii + 4)*nbyte_row + jj]);
  359|  67.2M|      f0 = _mm_loadu_si128((__m128i *) &in_b[(ii + 5)*nbyte_row + jj]);
  360|  67.2M|      g0 = _mm_loadu_si128((__m128i *) &in_b[(ii + 6)*nbyte_row + jj]);
  361|  67.2M|      h0 = _mm_loadu_si128((__m128i *) &in_b[(ii + 7)*nbyte_row + jj]);
  362|       |
  363|       |
  364|  67.2M|      a1 = _mm_unpacklo_epi8(a0, b0);
  365|  67.2M|      b1 = _mm_unpacklo_epi8(c0, d0);
  366|  67.2M|      c1 = _mm_unpacklo_epi8(e0, f0);
  367|  67.2M|      d1 = _mm_unpacklo_epi8(g0, h0);
  368|  67.2M|      e1 = _mm_unpackhi_epi8(a0, b0);
  369|  67.2M|      f1 = _mm_unpackhi_epi8(c0, d0);
  370|  67.2M|      g1 = _mm_unpackhi_epi8(e0, f0);
  371|  67.2M|      h1 = _mm_unpackhi_epi8(g0, h0);
  372|       |
  373|       |
  374|  67.2M|      a0 = _mm_unpacklo_epi16(a1, b1);
  375|  67.2M|      b0 = _mm_unpacklo_epi16(c1, d1);
  376|  67.2M|      c0 = _mm_unpackhi_epi16(a1, b1);
  377|  67.2M|      d0 = _mm_unpackhi_epi16(c1, d1);
  378|       |
  379|  67.2M|      e0 = _mm_unpacklo_epi16(e1, f1);
  380|  67.2M|      f0 = _mm_unpacklo_epi16(g1, h1);
  381|  67.2M|      g0 = _mm_unpackhi_epi16(e1, f1);
  382|  67.2M|      h0 = _mm_unpackhi_epi16(g1, h1);
  383|       |
  384|       |
  385|  67.2M|      a1 = _mm_unpacklo_epi32(a0, b0);
  386|  67.2M|      b1 = _mm_unpackhi_epi32(a0, b0);
  387|       |
  388|  67.2M|      c1 = _mm_unpacklo_epi32(c0, d0);
  389|  67.2M|      d1 = _mm_unpackhi_epi32(c0, d0);
  390|       |
  391|  67.2M|      e1 = _mm_unpacklo_epi32(e0, f0);
  392|  67.2M|      f1 = _mm_unpackhi_epi32(e0, f0);
  393|       |
  394|  67.2M|      g1 = _mm_unpacklo_epi32(g0, h0);
  395|  67.2M|      h1 = _mm_unpackhi_epi32(g0, h0);
  396|       |
  397|  67.2M|      if (transpose_bits) {
  ------------------
  |  Branch (397:11): [True: 40.0M, False: 27.1M]
  ------------------
  398|  40.0M|#define STORE_BYTES(v, k) _mm_storeu_si128((__m128i*)(out_b + (jj + (k)) * 8), trans_bit_8x8_SSE(v))
  399|  40.0M|        STORE_BYTES(a1, 0); STORE_BYTES(b1, 2);
  ------------------
  |  |  398|  40.0M|#define STORE_BYTES(v, k) _mm_storeu_si128((__m128i*)(out_b + (jj + (k)) * 8), trans_bit_8x8_SSE(v))
  ------------------
                      STORE_BYTES(a1, 0); STORE_BYTES(b1, 2);
  ------------------
  |  |  398|  40.0M|#define STORE_BYTES(v, k) _mm_storeu_si128((__m128i*)(out_b + (jj + (k)) * 8), trans_bit_8x8_SSE(v))
  ------------------
  400|  40.0M|        STORE_BYTES(c1, 4); STORE_BYTES(d1, 6);
  ------------------
  |  |  398|  40.0M|#define STORE_BYTES(v, k) _mm_storeu_si128((__m128i*)(out_b + (jj + (k)) * 8), trans_bit_8x8_SSE(v))
  ------------------
                      STORE_BYTES(c1, 4); STORE_BYTES(d1, 6);
  ------------------
  |  |  398|  40.0M|#define STORE_BYTES(v, k) _mm_storeu_si128((__m128i*)(out_b + (jj + (k)) * 8), trans_bit_8x8_SSE(v))
  ------------------
  401|  40.0M|        STORE_BYTES(e1, 8); STORE_BYTES(f1, 10);
  ------------------
  |  |  398|  40.0M|#define STORE_BYTES(v, k) _mm_storeu_si128((__m128i*)(out_b + (jj + (k)) * 8), trans_bit_8x8_SSE(v))
  ------------------
                      STORE_BYTES(e1, 8); STORE_BYTES(f1, 10);
  ------------------
  |  |  398|  40.0M|#define STORE_BYTES(v, k) _mm_storeu_si128((__m128i*)(out_b + (jj + (k)) * 8), trans_bit_8x8_SSE(v))
  ------------------
  402|  40.0M|        STORE_BYTES(g1, 12); STORE_BYTES(h1, 14);
  ------------------
  |  |  398|  40.0M|#define STORE_BYTES(v, k) _mm_storeu_si128((__m128i*)(out_b + (jj + (k)) * 8), trans_bit_8x8_SSE(v))
  ------------------
                      STORE_BYTES(g1, 12); STORE_BYTES(h1, 14);
  ------------------
  |  |  398|  40.0M|#define STORE_BYTES(v, k) _mm_storeu_si128((__m128i*)(out_b + (jj + (k)) * 8), trans_bit_8x8_SSE(v))
  ------------------
  403|  40.0M|#undef STORE_BYTES
  404|  40.0M|        continue;
  405|  40.0M|      }
  406|       |      // We don't have a storeh instruction for integers, so interpret
  407|       |      // as a float. Have a storel (_mm_storel_epi64).
  408|  27.1M|      as = (__m128 *) &a1;
  409|  27.1M|      bs = (__m128 *) &b1;
  410|  27.1M|      cs = (__m128 *) &c1;
  411|  27.1M|      ds = (__m128 *) &d1;
  412|  27.1M|      es = (__m128 *) &e1;
  413|  27.1M|      fs = (__m128 *) &f1;
  414|  27.1M|      gs = (__m128 *) &g1;
  415|  27.1M|      hs = (__m128 *) &h1;
  416|       |
  417|  27.1M|      _mm_storel_pi((__m64 *) &out_b[(jj + 0) * nrows + ii], *as);
  418|  27.1M|      _mm_storel_pi((__m64 *) &out_b[(jj + 2) * nrows + ii], *bs);
  419|  27.1M|      _mm_storel_pi((__m64 *) &out_b[(jj + 4) * nrows + ii], *cs);
  420|  27.1M|      _mm_storel_pi((__m64 *) &out_b[(jj + 6) * nrows + ii], *ds);
  421|  27.1M|      _mm_storel_pi((__m64 *) &out_b[(jj + 8) * nrows + ii], *es);
  422|  27.1M|      _mm_storel_pi((__m64 *) &out_b[(jj + 10) * nrows + ii], *fs);
  423|  27.1M|      _mm_storel_pi((__m64 *) &out_b[(jj + 12) * nrows + ii], *gs);
  424|  27.1M|      _mm_storel_pi((__m64 *) &out_b[(jj + 14) * nrows + ii], *hs);
  425|       |
  426|  27.1M|      _mm_storeh_pi((__m64 *) &out_b[(jj + 1) * nrows + ii], *as);
  427|  27.1M|      _mm_storeh_pi((__m64 *) &out_b[(jj + 3) * nrows + ii], *bs);
  428|  27.1M|      _mm_storeh_pi((__m64 *) &out_b[(jj + 5) * nrows + ii], *cs);
  429|  27.1M|      _mm_storeh_pi((__m64 *) &out_b[(jj + 7) * nrows + ii], *ds);
  430|  27.1M|      _mm_storeh_pi((__m64 *) &out_b[(jj + 9) * nrows + ii], *es);
  431|  27.1M|      _mm_storeh_pi((__m64 *) &out_b[(jj + 11) * nrows + ii], *fs);
  432|  27.1M|      _mm_storeh_pi((__m64 *) &out_b[(jj + 13) * nrows + ii], *gs);
  433|  27.1M|      _mm_storeh_pi((__m64 *) &out_b[(jj + 15) * nrows + ii], *hs);
  434|  27.1M|    }
  435|   119k|    for (jj = nbyte_row - nbyte_row % 16; jj < nbyte_row; jj ++) {
  ------------------
  |  Branch (435:43): [True: 85.4k, False: 33.8k]
  ------------------
  436|  85.4k|      out_b[jj * nrows + ii + 0] = in_b[(ii + 0)*nbyte_row + jj];
  437|  85.4k|      out_b[jj * nrows + ii + 1] = in_b[(ii + 1)*nbyte_row + jj];
  438|  85.4k|      out_b[jj * nrows + ii + 2] = in_b[(ii + 2)*nbyte_row + jj];
  439|  85.4k|      out_b[jj * nrows + ii + 3] = in_b[(ii + 3)*nbyte_row + jj];
  440|  85.4k|      out_b[jj * nrows + ii + 4] = in_b[(ii + 4)*nbyte_row + jj];
  441|  85.4k|      out_b[jj * nrows + ii + 5] = in_b[(ii + 5)*nbyte_row + jj];
  442|  85.4k|      out_b[jj * nrows + ii + 6] = in_b[(ii + 6)*nbyte_row + jj];
  443|  85.4k|      out_b[jj * nrows + ii + 7] = in_b[(ii + 7)*nbyte_row + jj];
  444|  85.4k|      if (transpose_bits) {
  ------------------
  |  Branch (444:11): [True: 57.9k, False: 27.4k]
  ------------------
  445|  57.9k|        uint64_t x, t;
  446|  57.9k|        memcpy(&x, out_b + jj * 8, 8);
  447|  57.9k|        TRANS_BIT_8X8(x, t);
  ------------------
  |  |   54|  57.9k|#define TRANS_BIT_8X8(x, t) {                                               \
  |  |   55|  57.9k|        t = (x ^ (x >> 7)) & 0x00AA00AA00AA00AALL;                          \
  |  |   56|  57.9k|        x = x ^ t ^ (t << 7);                                               \
  |  |   57|  57.9k|        t = (x ^ (x >> 14)) & 0x0000CCCC0000CCCCLL;                         \
  |  |   58|  57.9k|        x = x ^ t ^ (t << 14);                                              \
  |  |   59|  57.9k|        t = (x ^ (x >> 28)) & 0x00000000F0F0F0F0LL;                         \
  |  |   60|  57.9k|        x = x ^ t ^ (t << 28);                                              \
  |  |   61|  57.9k|    }
  ------------------
  448|  57.9k|        memcpy(out_b + jj * 8, &x, 8);
  449|  57.9k|      }
  450|  85.4k|    }
  451|  33.8k|  }
  452|  28.7k|  return size * elem_size;
  453|  28.7k|}
bitshuffle-sse2.c:trans_bit_8x8_SSE:
  466|   320M|static inline __m128i trans_bit_8x8_SSE(__m128i x) {
  467|   320M|  __m128i t;
  468|   320M|  t = _mm_and_si128(_mm_xor_si128(x, _mm_srli_epi64(x, 7)),
  469|   320M|                    _mm_set1_epi64x(0x00AA00AA00AA00AALL));
  470|   320M|  x = _mm_xor_si128(x, _mm_xor_si128(t, _mm_slli_epi64(t, 7)));
  471|   320M|  t = _mm_and_si128(_mm_xor_si128(x, _mm_srli_epi64(x, 14)),
  472|   320M|                    _mm_set1_epi64x(0x0000CCCC0000CCCCLL));
  473|   320M|  x = _mm_xor_si128(x, _mm_xor_si128(t, _mm_slli_epi64(t, 14)));
  474|   320M|  t = _mm_and_si128(_mm_xor_si128(x, _mm_srli_epi64(x, 28)),
  475|   320M|                    _mm_set1_epi64x(0x00000000F0F0F0F0LL));
  476|   320M|  x = _mm_xor_si128(x, _mm_xor_si128(t, _mm_slli_epi64(t, 28)));
  477|   320M|  return x;
  478|   320M|}

blosc2.c:blosc2_checked_mul_size:
   41|  2.75k|static inline bool blosc2_checked_mul_size(size_t a, size_t b, size_t *out) {
   42|  2.75k|  if (a != 0 && b > SIZE_MAX / a) {
  ------------------
  |  Branch (42:7): [True: 2.75k, False: 0]
  |  Branch (42:17): [True: 0, False: 2.75k]
  ------------------
   43|      0|    return false;
   44|      0|  }
   45|  2.75k|  if (out != NULL) {
  ------------------
  |  Branch (45:7): [True: 2.75k, False: 0]
  ------------------
   46|  2.75k|    *out = a * b;
   47|  2.75k|  }
   48|       |  return true;
   49|  2.75k|}
blosc2.c:blosc2_checked_add_size:
   31|  2.75k|static inline bool blosc2_checked_add_size(size_t a, size_t b, size_t *out) {
   32|  2.75k|  if (a > SIZE_MAX - b) {
  ------------------
  |  Branch (32:7): [True: 0, False: 2.75k]
  ------------------
   33|      0|    return false;
   34|      0|  }
   35|  2.75k|  if (out != NULL) {
  ------------------
  |  Branch (35:7): [True: 2.75k, False: 0]
  ------------------
   36|  2.75k|    *out = a + b;
   37|  2.75k|  }
   38|       |  return true;
   39|  2.75k|}
schunk.c:blosc2_checked_mul_i64_nonneg:
   71|     70|static inline bool blosc2_checked_mul_i64_nonneg(int64_t a, int64_t b, int64_t *out) {
   72|     70|  if (a < 0 || b < 0 || (a != 0 && b > INT64_MAX / a)) {
  ------------------
  |  Branch (72:7): [True: 0, False: 70]
  |  Branch (72:16): [True: 0, False: 70]
  |  Branch (72:26): [True: 70, False: 0]
  |  Branch (72:36): [True: 0, False: 70]
  ------------------
   73|      0|    return false;
   74|      0|  }
   75|     70|  if (out != NULL) {
  ------------------
  |  Branch (75:7): [True: 0, False: 70]
  ------------------
   76|      0|    *out = a * b;
   77|      0|  }
   78|       |  return true;
   79|     70|}
frame.c:blosc2_checked_add_i64_nonneg:
   61|    511|static inline bool blosc2_checked_add_i64_nonneg(int64_t a, int64_t b, int64_t *out) {
   62|    511|  if (a < 0 || b < 0 || a > INT64_MAX - b) {
  ------------------
  |  Branch (62:7): [True: 0, False: 511]
  |  Branch (62:16): [True: 0, False: 511]
  |  Branch (62:25): [True: 0, False: 511]
  ------------------
   63|      0|    return false;
   64|      0|  }
   65|    511|  if (out != NULL) {
  ------------------
  |  Branch (65:7): [True: 511, False: 0]
  ------------------
   66|    511|    *out = a + b;
   67|    511|  }
   68|       |  return true;
   69|    511|}
b2nd.c:blosc2_checked_mul_size:
   41|     70|static inline bool blosc2_checked_mul_size(size_t a, size_t b, size_t *out) {
   42|     70|  if (a != 0 && b > SIZE_MAX / a) {
  ------------------
  |  Branch (42:7): [True: 70, False: 0]
  |  Branch (42:17): [True: 0, False: 70]
  ------------------
   43|      0|    return false;
   44|      0|  }
   45|     70|  if (out != NULL) {
  ------------------
  |  Branch (45:7): [True: 70, False: 0]
  ------------------
   46|     70|    *out = a * b;
   47|     70|  }
   48|       |  return true;
   49|     70|}
b2nd.c:blosc2_checked_mul_i64_nonneg:
   71|  14.1k|static inline bool blosc2_checked_mul_i64_nonneg(int64_t a, int64_t b, int64_t *out) {
   72|  14.1k|  if (a < 0 || b < 0 || (a != 0 && b > INT64_MAX / a)) {
  ------------------
  |  Branch (72:7): [True: 0, False: 14.1k]
  |  Branch (72:16): [True: 0, False: 14.1k]
  |  Branch (72:26): [True: 14.1k, False: 0]
  |  Branch (72:36): [True: 0, False: 14.1k]
  ------------------
   73|      0|    return false;
   74|      0|  }
   75|  14.1k|  if (out != NULL) {
  ------------------
  |  Branch (75:7): [True: 14.1k, False: 0]
  ------------------
   76|  14.1k|    *out = a * b;
   77|  14.1k|  }
   78|       |  return true;
   79|  14.1k|}
b2nd.c:blosc2_checked_mul_i32_nonneg:
   81|  7.01k|static inline bool blosc2_checked_mul_i32_nonneg(int32_t a, int32_t b, int32_t *out) {
   82|  7.01k|  if (a < 0 || b < 0 || (a != 0 && b > INT32_MAX / a)) {
  ------------------
  |  Branch (82:7): [True: 0, False: 7.01k]
  |  Branch (82:16): [True: 0, False: 7.01k]
  |  Branch (82:26): [True: 7.01k, False: 0]
  |  Branch (82:36): [True: 0, False: 7.01k]
  ------------------
   83|      0|    return false;
   84|      0|  }
   85|  7.01k|  if (out != NULL) {
  ------------------
  |  Branch (85:7): [True: 7.01k, False: 0]
  ------------------
   86|  7.01k|    *out = a * b;
   87|  7.01k|  }
   88|       |  return true;
   89|  7.01k|}

blosc2.c:is_little_endian:
   42|  35.4M|static bool is_little_endian(void) {
   43|  35.4M|  static const int i = 1;
   44|  35.4M|  char* p = (char*)&i;
   45|       |
   46|  35.4M|  if (p[0] == 1) {
  ------------------
  |  Branch (46:7): [True: 35.4M, False: 0]
  ------------------
   47|  35.4M|    return true;
   48|  35.4M|  }
   49|      0|  else {
   50|       |    return false;
   51|      0|  }
   52|  35.4M|}
blosc2.c:load_lib:
  439|      4|static inline void* load_lib(char *plugin_name, char *libpath) {
  440|      4|  if (!blosc2_valid_plugin_name(plugin_name)) {
  ------------------
  |  Branch (440:7): [True: 0, False: 4]
  ------------------
  441|      0|    BLOSC_TRACE_ERROR("Invalid plugin name");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  442|      0|    return NULL;
  443|      0|  }
  444|       |    // Attempt to directly load the library by name
  445|       |#if defined(_WIN32)
  446|       |    // Windows dynamic library (DLL) format
  447|       |    snprintf(libpath, PATH_MAX, "blosc2_%s.dll", plugin_name);
  448|       |#else
  449|       |    // Unix/Linux/Mac OS dynamic library (.so) format
  450|      4|    snprintf(libpath, PATH_MAX, "libblosc2_%s.so", plugin_name);
  451|      4|#endif
  452|      4|    void* loaded_lib = dlopen(libpath, RTLD_LAZY);
  453|      4|    if (loaded_lib != NULL) {
  ------------------
  |  Branch (453:9): [True: 0, False: 4]
  ------------------
  454|      0|        BLOSC_TRACE_INFO("Successfully loaded %s directly\n", libpath);
  ------------------
  |  |   95|      0|#define BLOSC_TRACE_INFO(msg, ...) BLOSC_TRACE(info, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  455|      0|        return loaded_lib;
  456|      4|    } else {
  457|       |#if defined(_WIN32)
  458|       |        BLOSC_TRACE_INFO("Failed to load %s directly, error: %lu\n", libpath, GetLastError());
  459|       |#else
  460|      4|        BLOSC_TRACE_INFO("Failed to load %s directly, error: %s\n", libpath, dlerror());
  ------------------
  |  |   95|      4|#define BLOSC_TRACE_INFO(msg, ...) BLOSC_TRACE(info, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      4|    do {                                            \
  |  |  |  |   98|      4|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      4|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 4, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      4|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  461|      4|#endif
  462|      4|    }
  463|       |    // If direct loading fails, fallback to using Python to find the library path
  464|      4|    if (get_libpath(plugin_name, libpath, "") < 0 && get_libpath(plugin_name, libpath, "3") < 0) {
  ------------------
  |  Branch (464:9): [True: 4, False: 0]
  |  Branch (464:54): [True: 4, False: 0]
  ------------------
  465|      4|        BLOSC_TRACE_ERROR("Problems when running python or python3 for getting plugin path");
  ------------------
  |  |   93|      4|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      4|    do {                                            \
  |  |  |  |   98|      4|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      4|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 4, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      4|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  466|      4|        return NULL;
  467|      4|    }
  468|       |
  469|      0|    if (strlen(libpath) == 0) {
  ------------------
  |  Branch (469:9): [True: 0, False: 0]
  ------------------
  470|      0|        BLOSC_TRACE_ERROR("Could not find plugin libpath");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  471|      0|        return NULL;
  472|      0|    }
  473|       |
  474|       |    // Try to load the library again with the path from Python
  475|      0|    loaded_lib = dlopen(libpath, RTLD_LAZY);
  476|      0|    if (loaded_lib == NULL) {
  ------------------
  |  Branch (476:9): [True: 0, False: 0]
  ------------------
  477|      0|        BLOSC_TRACE_ERROR("Attempt to load plugin in path '%s' failed with error: %s", libpath, dlerror());
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  478|      0|    } else {
  479|      0|        BLOSC_TRACE_INFO("Successfully loaded library with Python path: %s\n", libpath);
  ------------------
  |  |   95|      0|#define BLOSC_TRACE_INFO(msg, ...) BLOSC_TRACE(info, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  480|      0|    }
  481|       |
  482|      0|    return loaded_lib;
  483|      0|}
blosc2.c:blosc2_valid_plugin_name:
  397|     12|static inline bool blosc2_valid_plugin_name(const char *plugin_name) {
  398|     12|  if (plugin_name == NULL || plugin_name[0] == '\0') {
  ------------------
  |  Branch (398:7): [True: 0, False: 12]
  |  Branch (398:30): [True: 0, False: 12]
  ------------------
  399|      0|    return false;
  400|      0|  }
  401|     75|  for (const unsigned char *p = (const unsigned char *)plugin_name; *p != '\0'; ++p) {
  ------------------
  |  Branch (401:69): [True: 63, False: 12]
  ------------------
  402|     63|    if (!isalnum(*p) && *p != '_') {
  ------------------
  |  Branch (402:9): [True: 0, False: 63]
  |  Branch (402:25): [True: 0, False: 0]
  ------------------
  403|      0|      return false;
  404|      0|    }
  405|     63|  }
  406|     12|  return true;
  407|     12|}
blosc2.c:get_libpath:
  410|      8|static inline int get_libpath(char *plugin_name, char *libpath, char *python_version) {
  411|      8|  BLOSC_TRACE_INFO("Trying to get plugin path with python%s\n", python_version);
  ------------------
  |  |   95|      8|#define BLOSC_TRACE_INFO(msg, ...) BLOSC_TRACE(info, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      8|    do {                                            \
  |  |  |  |   98|      8|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      8|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 8, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      8|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  412|      8|  char python_cmd[PATH_MAX] = {0};
  413|      8|  if (!blosc2_valid_plugin_name(plugin_name)) {
  ------------------
  |  Branch (413:7): [True: 0, False: 8]
  ------------------
  414|      0|    BLOSC_TRACE_ERROR("Invalid plugin name");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  415|      0|    return BLOSC2_ERROR_INVALID_PARAM;
  416|      0|  }
  417|      8|  int written = snprintf(python_cmd, sizeof(python_cmd),
  418|      8|                         "python%s -c \"import blosc2_%s; blosc2_%s.print_libpath()\"",
  419|      8|                         python_version, plugin_name, plugin_name);
  420|      8|  if (written < 0 || (size_t)written >= sizeof(python_cmd)) {
  ------------------
  |  Branch (420:7): [True: 0, False: 8]
  |  Branch (420:22): [True: 0, False: 8]
  ------------------
  421|      0|    BLOSC_TRACE_ERROR("Python command is too long");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  422|      0|    return BLOSC2_ERROR_FAILURE;
  423|      0|  }
  424|      8|  FILE *fp = popen(python_cmd, "r");
  425|      8|  if (fp == NULL) {
  ------------------
  |  Branch (425:7): [True: 0, False: 8]
  ------------------
  426|      0|    BLOSC_TRACE_ERROR("Could not run python");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  427|      0|    return BLOSC2_ERROR_FAILURE;
  428|      0|  }
  429|      8|  if (fgets(libpath, PATH_MAX, fp) == NULL) {
  ------------------
  |  Branch (429:7): [True: 8, False: 0]
  ------------------
  430|      8|    BLOSC_TRACE_ERROR("Could not read python output");
  ------------------
  |  |   93|      8|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      8|    do {                                            \
  |  |  |  |   98|      8|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      8|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 8, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      8|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  431|      8|    pclose(fp);
  432|      8|    return BLOSC2_ERROR_FAILURE;
  433|      8|  }
  434|      0|  pclose(fp);
  435|       |
  436|      0|  return BLOSC2_ERROR_SUCCESS;
  437|      8|}
blosc2.c:_sw32:
  241|  16.8k|static inline void _sw32(void* dest, int32_t a) {
  242|  16.8k|  uint8_t* dest_ = (uint8_t*)dest;
  243|  16.8k|  uint8_t* pa = (uint8_t*)&a;
  244|       |
  245|  16.8k|  bool little_endian = is_little_endian();
  246|  16.8k|  if (little_endian) {
  ------------------
  |  Branch (246:7): [True: 16.8k, False: 0]
  ------------------
  247|  16.8k|    memcpy(dest_, &a, sizeof(a));;
  248|  16.8k|  }
  249|      0|  else {
  250|      0|#if defined (__GNUC__)
  251|      0|    *(int32_t *)dest_ = __builtin_bswap32(*(unsigned int *)pa);
  252|       |#elif defined (_MSC_VER) /* Visual Studio */
  253|       |    *(int32_t *)dest_ = _byteswap_ulong(*(unsigned int *)pa);
  254|       |#else
  255|       |    dest_[0] = pa[3];
  256|       |    dest_[1] = pa[2];
  257|       |    dest_[2] = pa[1];
  258|       |    dest_[3] = pa[0];
  259|       |#endif
  260|      0|  }
  261|  16.8k|}
blosc2.c:sw32_:
  216|  27.0k|static inline int32_t sw32_(const void* pa) {
  217|  27.0k|  int32_t idest;
  218|       |
  219|  27.0k|  bool little_endian = is_little_endian();
  220|  27.0k|  if (little_endian) {
  ------------------
  |  Branch (220:7): [True: 27.0k, False: 0]
  ------------------
  221|  27.0k|    memcpy(&idest, pa, sizeof(idest));
  222|  27.0k|  }
  223|      0|  else {
  224|      0|#if defined (__GNUC__)
  225|      0|    return __builtin_bswap32(*(unsigned int *)pa);
  226|       |#elif defined (_MSC_VER) /* Visual Studio */
  227|       |    return _byteswap_ulong(*(unsigned int *)pa);
  228|       |#else
  229|       |    const uint8_t *pa_ = (const uint8_t *)pa;
  230|       |    uint8_t *dest = (uint8_t *)&idest;
  231|       |    dest[0] = pa_[3];
  232|       |    dest[1] = pa_[2];
  233|       |    dest[2] = pa_[1];
  234|       |    dest[3] = pa_[0];
  235|       |#endif
  236|      0|  }
  237|  27.0k|  return idest;
  238|  27.0k|}
blosc2.c:filters_contain:
  131|  2.98k|static inline bool filters_contain(const uint8_t *filters, uint8_t id) {
  132|  20.7k|  for (int i = 0; i < BLOSC2_MAX_FILTERS; i++) {
  ------------------
  |  Branch (132:19): [True: 17.9k, False: 2.87k]
  ------------------
  133|  17.9k|    if (filters[i] == id) {
  ------------------
  |  Branch (133:9): [True: 116, False: 17.8k]
  ------------------
  134|    116|      return true;
  135|    116|    }
  136|  17.9k|  }
  137|  2.87k|  return false;
  138|  2.98k|}
schunk.c:blosc2_nchunks_to_offsets_nbytes:
  103|     70|static inline bool blosc2_nchunks_to_offsets_nbytes(int64_t nchunks, int32_t *off_nbytes) {
  104|     70|  const int64_t max_nchunks = INT32_MAX / (int64_t)sizeof(int64_t);
  105|     70|  if (nchunks < 0 || nchunks > max_nchunks) {
  ------------------
  |  Branch (105:7): [True: 0, False: 70]
  |  Branch (105:22): [True: 0, False: 70]
  ------------------
  106|      0|    return false;
  107|      0|  }
  108|     70|  if (off_nbytes != NULL) {
  ------------------
  |  Branch (108:7): [True: 0, False: 70]
  ------------------
  109|      0|    *off_nbytes = (int32_t)(nchunks * (int64_t)sizeof(int64_t));
  110|      0|  }
  111|       |  return true;
  112|     70|}
schunk.c:get_chunk_flags2:
  121|  1.20k|static inline uint8_t get_chunk_flags2(const uint8_t *chunk, int32_t chunk_cbytes) {
  122|  1.20k|  uint8_t flags = chunk[BLOSC2_CHUNK_FLAGS];
  123|  1.20k|  bool extended_header = (flags & BLOSC_DOSHUFFLE) && (flags & BLOSC_DOBITSHUFFLE);
  ------------------
  |  Branch (123:26): [True: 1.20k, False: 0]
  |  Branch (123:55): [True: 1.20k, False: 0]
  ------------------
  124|  1.20k|  if (!extended_header || chunk_cbytes < BLOSC_EXTENDED_HEADER_LENGTH) {
  ------------------
  |  Branch (124:7): [True: 0, False: 1.20k]
  |  Branch (124:27): [True: 0, False: 1.20k]
  ------------------
  125|      0|    return 0;
  126|      0|  }
  127|  1.20k|  return chunk[BLOSC2_CHUNK_BLOSC2_FLAGS2];
  128|  1.20k|}
schunk.c:chunk_special_in_offset:
  143|    610|static inline int chunk_special_in_offset(const uint8_t *chunk, int32_t cbytes) {
  144|    610|  if (cbytes < BLOSC_EXTENDED_HEADER_LENGTH) {
  ------------------
  |  Branch (144:7): [True: 0, False: 610]
  ------------------
  145|      0|    return 0;
  146|      0|  }
  147|    610|  int special_value = (chunk[BLOSC2_CHUNK_BLOSC2_FLAGS] >> 4) & BLOSC2_SPECIAL_MASK;
  148|    610|  switch (special_value) {
  149|     32|    case BLOSC2_SPECIAL_ZERO:
  ------------------
  |  Branch (149:5): [True: 32, False: 578]
  ------------------
  150|     32|    case BLOSC2_SPECIAL_NAN:
  ------------------
  |  Branch (150:5): [True: 0, False: 610]
  ------------------
  151|     32|    case BLOSC2_SPECIAL_UNINIT:
  ------------------
  |  Branch (151:5): [True: 0, False: 610]
  ------------------
  152|     32|      return special_value;
  153|    578|    default:
  ------------------
  |  Branch (153:5): [True: 578, False: 32]
  ------------------
  154|    578|      return 0;
  155|    610|  }
  156|    610|}
frame.c:endian_handler:
   56|  66.9k|{
   57|  66.9k|  bool little_endian = is_little_endian();
   58|  66.9k|  if (little_endian == little) {
  ------------------
  |  Branch (58:7): [True: 32, False: 66.9k]
  ------------------
   59|     32|    memcpy(dest, pa, size);
   60|     32|  }
   61|  66.9k|  else {
   62|  66.9k|    uint8_t* pa_ = (uint8_t*)pa;
   63|  66.9k|    uint8_t pa2_[8];
   64|  66.9k|    switch (size) {
   65|  24.6k|      case 8:
  ------------------
  |  Branch (65:7): [True: 24.6k, False: 42.2k]
  ------------------
   66|  24.6k|        pa2_[0] = pa_[7];
   67|  24.6k|        pa2_[1] = pa_[6];
   68|  24.6k|        pa2_[2] = pa_[5];
   69|  24.6k|        pa2_[3] = pa_[4];
   70|  24.6k|        pa2_[4] = pa_[3];
   71|  24.6k|        pa2_[5] = pa_[2];
   72|  24.6k|        pa2_[6] = pa_[1];
   73|  24.6k|        pa2_[7] = pa_[0];
   74|  24.6k|        break;
   75|  33.1k|      case 4:
  ------------------
  |  Branch (75:7): [True: 33.1k, False: 33.7k]
  ------------------
   76|  33.1k|        pa2_[0] = pa_[3];
   77|  33.1k|        pa2_[1] = pa_[2];
   78|  33.1k|        pa2_[2] = pa_[1];
   79|  33.1k|        pa2_[3] = pa_[0];
   80|  33.1k|        break;
   81|  7.04k|      case 2:
  ------------------
  |  Branch (81:7): [True: 7.04k, False: 59.8k]
  ------------------
   82|  7.04k|        pa2_[0] = pa_[1];
   83|  7.04k|        pa2_[1] = pa_[0];
   84|  7.04k|        break;
   85|  2.00k|      case 1:
  ------------------
  |  Branch (85:7): [True: 2.00k, False: 64.9k]
  ------------------
   86|  2.00k|        pa2_[0] = pa_[0];
   87|  2.00k|        break;
   88|      0|      default:
  ------------------
  |  Branch (88:7): [True: 0, False: 66.9k]
  ------------------
   89|      0|        BLOSC_TRACE_ERROR("Unhandled size: %d.", size);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
   90|  66.9k|    }
   91|  66.9k|    memcpy(dest, pa2_, size);
   92|  66.9k|  }
   93|  66.9k|}
frame.c:is_little_endian:
   42|  66.9k|static bool is_little_endian(void) {
   43|  66.9k|  static const int i = 1;
   44|  66.9k|  char* p = (char*)&i;
   45|       |
   46|  66.9k|  if (p[0] == 1) {
  ------------------
  |  Branch (46:7): [True: 66.9k, False: 0]
  ------------------
   47|  66.9k|    return true;
   48|  66.9k|  }
   49|      0|  else {
   50|       |    return false;
   51|      0|  }
   52|  66.9k|}
frame.c:blosc2_nchunks_to_offsets_nbytes:
  103|  13.3k|static inline bool blosc2_nchunks_to_offsets_nbytes(int64_t nchunks, int32_t *off_nbytes) {
  104|  13.3k|  const int64_t max_nchunks = INT32_MAX / (int64_t)sizeof(int64_t);
  105|  13.3k|  if (nchunks < 0 || nchunks > max_nchunks) {
  ------------------
  |  Branch (105:7): [True: 0, False: 13.3k]
  |  Branch (105:22): [True: 10, False: 13.3k]
  ------------------
  106|     10|    return false;
  107|     10|  }
  108|  13.3k|  if (off_nbytes != NULL) {
  ------------------
  |  Branch (108:7): [True: 13.3k, False: 0]
  ------------------
  109|  13.3k|    *off_nbytes = (int32_t)(nchunks * (int64_t)sizeof(int64_t));
  110|  13.3k|  }
  111|       |  return true;
  112|  13.3k|}
frame.c:chunk_special_in_offset:
  143|    610|static inline int chunk_special_in_offset(const uint8_t *chunk, int32_t cbytes) {
  144|    610|  if (cbytes < BLOSC_EXTENDED_HEADER_LENGTH) {
  ------------------
  |  Branch (144:7): [True: 0, False: 610]
  ------------------
  145|      0|    return 0;
  146|      0|  }
  147|    610|  int special_value = (chunk[BLOSC2_CHUNK_BLOSC2_FLAGS] >> 4) & BLOSC2_SPECIAL_MASK;
  148|    610|  switch (special_value) {
  149|     32|    case BLOSC2_SPECIAL_ZERO:
  ------------------
  |  Branch (149:5): [True: 32, False: 578]
  ------------------
  150|     32|    case BLOSC2_SPECIAL_NAN:
  ------------------
  |  Branch (150:5): [True: 0, False: 610]
  ------------------
  151|     32|    case BLOSC2_SPECIAL_UNINIT:
  ------------------
  |  Branch (151:5): [True: 0, False: 610]
  ------------------
  152|     32|      return special_value;
  153|    578|    default:
  ------------------
  |  Branch (153:5): [True: 578, False: 32]
  ------------------
  154|    578|      return 0;
  155|    610|  }
  156|    610|}
b2nd.c:filters_contain:
  131|  1.43k|static inline bool filters_contain(const uint8_t *filters, uint8_t id) {
  132|  9.96k|  for (int i = 0; i < BLOSC2_MAX_FILTERS; i++) {
  ------------------
  |  Branch (132:19): [True: 8.58k, False: 1.38k]
  ------------------
  133|  8.58k|    if (filters[i] == id) {
  ------------------
  |  Branch (133:9): [True: 48, False: 8.53k]
  ------------------
  134|     48|      return true;
  135|     48|    }
  136|  8.58k|  }
  137|  1.38k|  return false;
  138|  1.43k|}

blosc2_stdio_destroy:
  272|  1.92k|int blosc2_stdio_destroy(void* params) {
  273|  1.92k|  BLOSC_UNUSED_PARAM(params);
  ------------------
  |  |   28|  1.92k|#define BLOSC_UNUSED_PARAM(x) ((void)(x))
  ------------------
  274|  1.92k|  return 0;
  275|  1.92k|}

do_nothing:
  815|   227k|int do_nothing(const blosc2_context* context, int i, char cmode) {
  816|   227k|  uint8_t filter = context->filters[i];
  817|   227k|  if (filter == BLOSC_SHUFFLE) {
  ------------------
  |  Branch (817:7): [True: 23.6k, False: 203k]
  ------------------
  818|       |    // Shuffling single bytes is the identity, so skip it instead of copying the block
  819|  23.6k|    return shuffle_size(context, i) == 1;
  820|  23.6k|  }
  821|   203k|  if (cmode == 'c') {
  ------------------
  |  Branch (821:7): [True: 101k, False: 102k]
  ------------------
  822|   101k|    return (filter == BLOSC_NOFILTER);
  823|   102k|  } else {
  824|       |    // TRUNC_PREC do not have to be applied during decompression
  825|   102k|    return ((filter == BLOSC_NOFILTER) || (filter == BLOSC_TRUNC_PREC));
  ------------------
  |  Branch (825:13): [True: 69.4k, False: 33.1k]
  |  Branch (825:43): [True: 1.72k, False: 31.4k]
  ------------------
  826|   102k|  }
  827|   203k|}
next_filter:
  830|  25.2k|int next_filter(const blosc2_context* context, int current_filter, char cmode) {
  831|  29.5k|  for (int i = current_filter - 1; i >= 0; i--) {
  ------------------
  |  Branch (831:36): [True: 28.9k, False: 530]
  ------------------
  832|  28.9k|    if (!do_nothing(context, i, cmode)) {
  ------------------
  |  Branch (832:9): [True: 24.6k, False: 4.31k]
  ------------------
  833|  24.6k|      return context->filters[i];
  834|  24.6k|    }
  835|  28.9k|  }
  836|    530|  return BLOSC_NOFILTER;
  837|  25.2k|}
last_filter:
  840|  22.4k|int last_filter(const blosc2_context* context, char cmode) {
  841|  22.4k|  int last_index = -1;
  842|   157k|  for (int i = BLOSC2_MAX_FILTERS - 1; i >= 0; i--) {
  ------------------
  |  Branch (842:40): [True: 134k, False: 22.4k]
  ------------------
  843|   134k|    if (!do_nothing(context, i, cmode))  {
  ------------------
  |  Branch (843:9): [True: 23.1k, False: 111k]
  ------------------
  844|  23.1k|      last_index = i;
  845|  23.1k|    }
  846|   134k|  }
  847|  22.4k|  return last_index;
  848|  22.4k|}
read_chunk_header:
  927|  35.4M|{
  928|  35.4M|  memset(header, 0, sizeof(blosc_header));
  929|       |
  930|  35.4M|  if (srcsize < BLOSC_MIN_HEADER_LENGTH) {
  ------------------
  |  Branch (930:7): [True: 0, False: 35.4M]
  ------------------
  931|      0|    BLOSC_TRACE_ERROR("Not enough space to read Blosc header.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  932|      0|    return BLOSC2_ERROR_READ_BUFFER;
  933|      0|  }
  934|       |
  935|  35.4M|  memcpy(header, src, BLOSC_MIN_HEADER_LENGTH);
  936|       |
  937|  35.4M|  bool little_endian = is_little_endian();
  938|       |
  939|  35.4M|  if (!little_endian) {
  ------------------
  |  Branch (939:7): [True: 0, False: 35.4M]
  ------------------
  940|      0|    header->nbytes = bswap32_(header->nbytes);
  941|      0|    header->blocksize = bswap32_(header->blocksize);
  942|      0|    header->cbytes = bswap32_(header->cbytes);
  943|      0|  }
  944|       |
  945|  35.4M|  if (header->cbytes < BLOSC_MIN_HEADER_LENGTH) {
  ------------------
  |  Branch (945:7): [True: 11, False: 35.4M]
  ------------------
  946|     11|    BLOSC_TRACE_ERROR("`cbytes` is too small to read min header.");
  ------------------
  |  |   93|     11|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|     11|    do {                                            \
  |  |  |  |   98|     11|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|     11|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 11, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|     11|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  947|     11|    return BLOSC2_ERROR_INVALID_HEADER;
  948|     11|  }
  949|  35.4M|  if (header->blocksize <= 0) {
  ------------------
  |  Branch (949:7): [True: 16, False: 35.4M]
  ------------------
  950|     16|    BLOSC_TRACE_ERROR("`blocksize` is zero");
  ------------------
  |  |   93|     16|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|     16|    do {                                            \
  |  |  |  |   98|     16|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|     16|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 16, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|     16|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  951|     16|    return BLOSC2_ERROR_INVALID_HEADER;
  952|     16|  }
  953|  35.4M|  if (header->blocksize > BLOSC2_MAXBLOCKSIZE) {
  ------------------
  |  Branch (953:7): [True: 1, False: 35.4M]
  ------------------
  954|      1|    BLOSC_TRACE_ERROR("`blocksize` greater than maximum allowed");
  ------------------
  |  |   93|      1|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      1|    do {                                            \
  |  |  |  |   98|      1|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      1|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 1, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      1|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  955|      1|    return BLOSC2_ERROR_INVALID_HEADER;
  956|      1|  }
  957|  35.4M|  if (header->typesize == 0) {
  ------------------
  |  Branch (957:7): [True: 0, False: 35.4M]
  ------------------
  958|      0|    BLOSC_TRACE_ERROR("`typesize` is zero.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  959|      0|    return BLOSC2_ERROR_INVALID_HEADER;
  960|      0|  }
  961|       |
  962|       |  /* Read extended header if it is wanted */
  963|  35.4M|  if ((extended_header) && (header->flags & BLOSC_DOSHUFFLE) && (header->flags & BLOSC_DOBITSHUFFLE)) {
  ------------------
  |  Branch (963:7): [True: 6.16k, False: 35.4M]
  |  Branch (963:28): [True: 5.14k, False: 1.02k]
  |  Branch (963:65): [True: 5.00k, False: 141]
  ------------------
  964|  5.00k|    if (header->cbytes < BLOSC_EXTENDED_HEADER_LENGTH) {
  ------------------
  |  Branch (964:9): [True: 0, False: 5.00k]
  ------------------
  965|      0|      BLOSC_TRACE_ERROR("`cbytes` is too small to read extended header.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  966|      0|      return BLOSC2_ERROR_INVALID_HEADER;
  967|      0|    }
  968|  5.00k|    if (srcsize < BLOSC_EXTENDED_HEADER_LENGTH) {
  ------------------
  |  Branch (968:9): [True: 0, False: 5.00k]
  ------------------
  969|      0|      BLOSC_TRACE_ERROR("Not enough space to read Blosc extended header.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  970|      0|      return BLOSC2_ERROR_READ_BUFFER;
  971|      0|    }
  972|       |
  973|  5.00k|    memcpy((uint8_t *)header + BLOSC_MIN_HEADER_LENGTH, src + BLOSC_MIN_HEADER_LENGTH,
  974|  5.00k|      BLOSC_EXTENDED_HEADER_LENGTH - BLOSC_MIN_HEADER_LENGTH);
  975|       |
  976|  5.00k|    if ((header->blosc2_flags2 & BLOSC2_VL_BLOCKS) && (header->blosc2_flags != 0)) {
  ------------------
  |  Branch (976:9): [True: 51, False: 4.94k]
  |  Branch (976:55): [True: 18, False: 33]
  ------------------
  977|     18|      int32_t special_type = (header->blosc2_flags >> 4) & BLOSC2_SPECIAL_MASK;
  978|     18|      if (special_type != 0) {
  ------------------
  |  Branch (978:11): [True: 0, False: 18]
  ------------------
  979|      0|        BLOSC_TRACE_ERROR("VL-block chunks cannot use special chunk encodings.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  980|      0|        return BLOSC2_ERROR_INVALID_HEADER;
  981|      0|      }
  982|     18|    }
  983|       |
  984|  5.00k|    int32_t special_type = (header->blosc2_flags >> 4) & BLOSC2_SPECIAL_MASK;
  985|  5.00k|    if (special_type != 0) {
  ------------------
  |  Branch (985:9): [True: 405, False: 4.59k]
  ------------------
  986|    405|      if (special_type == BLOSC2_SPECIAL_VALUE) {
  ------------------
  |  Branch (986:11): [True: 337, False: 68]
  ------------------
  987|       |        // In this case, the actual type size must be derived from the cbytes
  988|    337|        int32_t typesize = header->cbytes - BLOSC_EXTENDED_HEADER_LENGTH;
  989|    337|        if (typesize <= 0) {
  ------------------
  |  Branch (989:13): [True: 1, False: 336]
  ------------------
  990|      1|          BLOSC_TRACE_ERROR("`typesize` is zero or negative");
  ------------------
  |  |   93|      1|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      1|    do {                                            \
  |  |  |  |   98|      1|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      1|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 1, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      1|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  991|      1|          return BLOSC2_ERROR_INVALID_HEADER;
  992|      1|        }
  993|    336|        if (typesize > BLOSC2_MAXTYPESIZE) {
  ------------------
  |  Branch (993:13): [True: 0, False: 336]
  ------------------
  994|      0|          BLOSC_TRACE_ERROR("`typesize` is greater than maximum allowed");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  995|      0|          return BLOSC2_ERROR_INVALID_HEADER;
  996|      0|        }
  997|    336|        if (typesize > header->nbytes) {
  ------------------
  |  Branch (997:13): [True: 0, False: 336]
  ------------------
  998|      0|          BLOSC_TRACE_ERROR("`typesize` is greater than `nbytes`");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  999|      0|          return BLOSC2_ERROR_INVALID_HEADER;
 1000|      0|        }
 1001|    336|        if (header->nbytes % typesize != 0) {
  ------------------
  |  Branch (1001:13): [True: 1, False: 335]
  ------------------
 1002|      1|          BLOSC_TRACE_ERROR("`nbytes` is not a multiple of typesize");
  ------------------
  |  |   93|      1|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      1|    do {                                            \
  |  |  |  |   98|      1|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      1|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 1, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      1|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1003|      1|          return BLOSC2_ERROR_INVALID_HEADER;
 1004|      1|        }
 1005|    336|      }
 1006|     68|      else {
 1007|       |        // All-zero chunks fill with memset, which works regardless of element alignment.
 1008|     68|        if (special_type != BLOSC2_SPECIAL_ZERO
  ------------------
  |  Branch (1008:13): [True: 54, False: 14]
  ------------------
 1009|     54|            && header->nbytes % header->typesize != 0) {
  ------------------
  |  Branch (1009:16): [True: 0, False: 54]
  ------------------
 1010|      0|          BLOSC_TRACE_ERROR("`nbytes` is not a multiple of typesize");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1011|      0|          return BLOSC2_ERROR_INVALID_HEADER;
 1012|      0|        }
 1013|     68|      }
 1014|    405|    }
 1015|       |    // The number of filters depends on the version of the header. Blosc2 alpha series
 1016|       |    // did not initialize filters to zero beyond the max supported.
 1017|  4.99k|    if (header->version == BLOSC2_VERSION_FORMAT_ALPHA) {
  ------------------
  |  Branch (1017:9): [True: 10, False: 4.98k]
  ------------------
 1018|     10|      header->filters[5] = 0;
 1019|     10|      header->filters_meta[5] = 0;
 1020|     10|    }
 1021|  4.99k|  }
 1022|  35.4M|  else {
 1023|  35.4M|    flags_to_filters(header->flags, header->filters);
 1024|  35.4M|  }
 1025|  35.4M|  if (header->version > BLOSC2_VERSION_FORMAT &&
  ------------------
  |  Branch (1025:7): [True: 33.1M, False: 2.31M]
  ------------------
 1026|  33.1M|      (header->blosc2_flags2 & (uint8_t)~BLOSC2_VL_BLOCKS) != 0) {
  ------------------
  |  Branch (1026:7): [True: 0, False: 33.1M]
  ------------------
 1027|       |    /* Version from future with unsupported chunk features. */
 1028|      0|    return BLOSC2_ERROR_VERSION_SUPPORT;
 1029|      0|  }
 1030|  35.4M|  if ((header->blosc2_flags2 & BLOSC2_VL_BLOCKS) != 0 &&
  ------------------
  |  Branch (1030:7): [True: 51, False: 35.4M]
  ------------------
 1031|     51|      (header->flags & (uint8_t)BLOSC_MEMCPYED) != 0) {
  ------------------
  |  Branch (1031:7): [True: 1, False: 50]
  ------------------
 1032|      1|    BLOSC_TRACE_ERROR("VL-block chunks cannot be memcpyed.");
  ------------------
  |  |   93|      1|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      1|    do {                                            \
  |  |  |  |   98|      1|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      1|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 1, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      1|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1033|      1|    return BLOSC2_ERROR_INVALID_HEADER;
 1034|      1|  }
 1035|  35.4M|  if ((header->blosc2_flags2 & BLOSC2_VL_BLOCKS) == 0 &&
  ------------------
  |  Branch (1035:7): [True: 35.4M, False: 50]
  ------------------
 1036|  35.4M|      header->nbytes > 0 && header->blocksize > header->nbytes) {
  ------------------
  |  Branch (1036:7): [True: 35.4M, False: 42]
  |  Branch (1036:29): [True: 4.40k, False: 35.4M]
  ------------------
 1037|  4.40k|    header->blocksize = header->nbytes;
 1038|  4.40k|  }
 1039|  35.4M|  return 0;
 1040|  35.4M|}
fill_codec:
 1196|      4|int fill_codec(blosc2_codec *codec) {
 1197|      4|  int rc = BLOSC2_ERROR_SUCCESS;
 1198|      4|  static_lock(&g_plugin_lock);
  ------------------
  |  |  132|      4|#define static_lock(l) pthread_mutex_lock(l)
  ------------------
 1199|       |  /* Unless another thread loaded it meanwhile */
 1200|      4|  if (codec->encoder == NULL || codec->decoder == NULL) {
  ------------------
  |  Branch (1200:7): [True: 4, False: 0]
  |  Branch (1200:33): [True: 0, False: 0]
  ------------------
 1201|      4|    rc = load_codec_locked(codec);
 1202|      4|  }
 1203|      4|  static_unlock(&g_plugin_lock);
  ------------------
  |  |  133|      4|#define static_unlock(l) pthread_mutex_unlock(l)
  ------------------
 1204|      4|  return rc;
 1205|      4|}
pipeline_forward:
 1336|  9.62k|                          uint8_t* dest, uint8_t* tmp) {
 1337|  9.62k|  blosc2_context* context = thread_context->parent_context;
 1338|  9.62k|  uint8_t* _src = (uint8_t*)src + offset;
 1339|  9.62k|  uint8_t* _tmp = tmp;
 1340|  9.62k|  uint8_t* _dest = dest;
 1341|  9.62k|  int32_t typesize = context->typesize;
 1342|  9.62k|  uint8_t* filters = context->filters;
 1343|  9.62k|  uint8_t* filters_meta = context->filters_meta;
 1344|  9.62k|  bool memcpyed = context->header_flags & (uint8_t)BLOSC_MEMCPYED;
 1345|  9.62k|  bool output_is_disposable = (context->preparams != NULL) ? context->preparams->output_is_disposable : false;
  ------------------
  |  Branch (1345:31): [True: 8.18k, False: 1.43k]
  ------------------
 1346|       |
 1347|       |  /* Prefilter function */
 1348|  9.62k|  if (context->prefilter != NULL) {
  ------------------
  |  Branch (1348:7): [True: 8.18k, False: 1.43k]
  ------------------
 1349|       |    // Create new prefilter parameters for this block (must be private for each thread)
 1350|  8.18k|    blosc2_prefilter_params preparams;
 1351|  8.18k|    memcpy(&preparams, context->preparams, sizeof(preparams));
 1352|       |    // Calculate output_size based on number of elements and output typesize
 1353|  8.18k|    int32_t nelems = bsize / typesize;  // number of elements in the input block
 1354|       |    // If output_typesize is not set (0), default to input typesize (no type conversion)
 1355|  8.18k|    int32_t output_typesize_actual = (preparams.output_typesize > 0) ? preparams.output_typesize : typesize;
  ------------------
  |  Branch (1355:38): [True: 0, False: 8.18k]
  ------------------
 1356|  8.18k|    int32_t output_size = nelems * output_typesize_actual;  // output size in bytes
 1357|  8.18k|    preparams.output_typesize = output_typesize_actual;  // ensure it's set
 1358|       |    /* Legacy callbacks may leave bytes unwritten or accumulate into the output.
 1359|       |     * Only audited full-write callbacks may bypass this initialization. */
 1360|  8.18k|    if (!output_is_disposable && !context->prefilter_full_write) {
  ------------------
  |  Branch (1360:9): [True: 8.18k, False: 0]
  |  Branch (1360:34): [True: 0, False: 8.18k]
  ------------------
 1361|      0|      memset(_dest, 0, output_size);
 1362|      0|    }
 1363|  8.18k|    preparams.input = _src;
 1364|  8.18k|    preparams.output = _dest;
 1365|  8.18k|    preparams.output_size = output_size;
 1366|  8.18k|    preparams.output_offset = offset;
 1367|  8.18k|    preparams.nblock = offset / context->blocksize;
 1368|  8.18k|    preparams.nchunk = context->schunk != NULL ? context->schunk->current_nchunk : -1;
  ------------------
  |  Branch (1368:24): [True: 8.18k, False: 0]
  ------------------
 1369|  8.18k|    preparams.tid = thread_context->tid;
 1370|  8.18k|    preparams.ttmp = thread_context->tmp;
 1371|  8.18k|    preparams.ttmp_nbytes = thread_context->tmp_nbytes;
 1372|  8.18k|    preparams.ctx = context;
 1373|  8.18k|    preparams.output_is_disposable = output_is_disposable;
 1374|       |
 1375|  8.18k|    if (context->prefilter(&preparams) != 0) {
  ------------------
  |  Branch (1375:9): [True: 0, False: 8.18k]
  ------------------
 1376|      0|      if (output_is_disposable) {
  ------------------
  |  Branch (1376:11): [True: 0, False: 0]
  ------------------
 1377|       |        // Output is going to be discarded; no more filters are required
 1378|      0|        return _dest;
 1379|      0|      }
 1380|      0|      BLOSC_TRACE_ERROR("Execution of prefilter function failed");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1381|      0|      return NULL;
 1382|      0|    }
 1383|       |
 1384|  8.18k|    if (memcpyed) {
  ------------------
  |  Branch (1384:9): [True: 1.66k, False: 6.52k]
  ------------------
 1385|       |      // No more filters are required
 1386|  1.66k|      return _dest;
 1387|  1.66k|    }
 1388|  6.52k|    _cycle_buffers_forward(&_src, &_dest, &_tmp, src + offset);
 1389|  6.52k|  }
 1390|       |
 1391|       |  /* Process the filter pipeline */
 1392|  55.7k|  for (int i = 0; i < BLOSC2_MAX_FILTERS; i++) {
  ------------------
  |  Branch (1392:19): [True: 47.7k, False: 7.95k]
  ------------------
 1393|  47.7k|    int rc = BLOSC2_ERROR_SUCCESS;
 1394|  47.7k|    if (do_nothing(context, i, 'c')) {
  ------------------
  |  Branch (1394:9): [True: 39.8k, False: 7.96k]
  ------------------
 1395|  39.8k|      continue;
 1396|  39.8k|    }
 1397|  7.96k|#ifdef BLOSC_USE_FUSED_SHUFFLE_BYTEDELTA
 1398|  7.96k|    int fused_size = fused_shuffle_bytedelta_size(context, i);
 1399|  7.96k|    if (fused_size && shuffle_bytedelta_forward(_src, _dest, bsize, fused_size)) {
  ------------------
  |  Branch (1399:9): [True: 0, False: 7.96k]
  |  Branch (1399:23): [True: 0, False: 0]
  ------------------
 1400|      0|      i++;
 1401|      0|      _cycle_buffers_forward(&_src, &_dest, &_tmp, src + offset);
 1402|      0|      continue;
 1403|      0|    }
 1404|  7.96k|#endif
 1405|  7.96k|    if (filters[i] <= BLOSC2_DEFINED_FILTERS_STOP) {
  ------------------
  |  Branch (1405:9): [True: 6.52k, False: 1.43k]
  ------------------
 1406|  6.52k|      switch (filters[i]) {
 1407|  1.95k|        case BLOSC_SHUFFLE:
  ------------------
  |  Branch (1407:9): [True: 1.95k, False: 4.57k]
  ------------------
 1408|  1.95k|          blosc2_shuffle(shuffle_size(context, i), bsize, _src, _dest);
 1409|  1.95k|          break;
 1410|  3.46k|        case BLOSC_BITSHUFFLE:
  ------------------
  |  Branch (1410:9): [True: 3.46k, False: 3.06k]
  ------------------
 1411|  3.46k|          if (context->blosc1_format && ((bsize / typesize) % 8) != 0) {
  ------------------
  |  Branch (1411:15): [True: 0, False: 3.46k]
  |  Branch (1411:41): [True: 0, False: 0]
  ------------------
 1412|       |            // Format version 2 (Blosc1) only bit-shuffles blocks whose number of
 1413|       |            // elements is a multiple of 8; other blocks are stored unshuffled.
 1414|      0|            memcpy(_dest, _src, (size_t)bsize);
 1415|      0|          }
 1416|  3.46k|          else if (bitshuffle(typesize, bsize, _src, _dest, bitshuffle_scratch(thread_context, bsize)) < 0) {
  ------------------
  |  Branch (1416:20): [True: 0, False: 3.46k]
  ------------------
 1417|      0|            return NULL;
 1418|      0|          }
 1419|  3.46k|          break;
 1420|  3.46k|        case BLOSC_DELTA:
  ------------------
  |  Branch (1420:9): [True: 839, False: 5.68k]
  ------------------
 1421|    839|          delta_encoder(offset == 0 ? _src : src, offset, bsize, typesize, _src, _dest);
  ------------------
  |  Branch (1421:25): [True: 58, False: 781]
  ------------------
 1422|    839|          break;
 1423|    269|        case BLOSC_TRUNC_PREC:
  ------------------
  |  Branch (1423:9): [True: 269, False: 6.25k]
  ------------------
 1424|    269|          if (truncate_precision(filters_meta[i], typesize, bsize, _src, _dest) < 0) {
  ------------------
  |  Branch (1424:15): [True: 1, False: 268]
  ------------------
 1425|      1|            return NULL;
 1426|      1|          }
 1427|    268|          break;
 1428|    268|        default:
  ------------------
  |  Branch (1428:9): [True: 0, False: 6.52k]
  ------------------
 1429|      0|          BLOSC_TRACE_ERROR("Filter %d not handled during compression\n", filters[i]);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1430|      0|          return NULL;
 1431|  6.52k|      }
 1432|  6.52k|    }
 1433|  1.43k|    else {
 1434|       |      // Look for the filters_meta in user filters and run it
 1435|  5.64k|      for (uint64_t j = 0; j < g_nfilters; ++j) {
  ------------------
  |  Branch (1435:28): [True: 5.64k, False: 0]
  ------------------
 1436|  5.64k|        if (g_filters[j].id == filters[i]) {
  ------------------
  |  Branch (1436:13): [True: 1.43k, False: 4.20k]
  ------------------
 1437|  1.43k|          if (load_acquire_ptr(&g_filters[j].backward) == NULL) {
  ------------------
  |  |  144|  1.43k|#define load_acquire_ptr(p) __atomic_load_n((p), __ATOMIC_ACQUIRE)
  ------------------
  |  Branch (1437:15): [True: 0, False: 1.43k]
  ------------------
 1438|       |            // Dynamically load library
 1439|      0|            if (fill_filter(&g_filters[j]) < 0) {
  ------------------
  |  Branch (1439:17): [True: 0, False: 0]
  ------------------
 1440|      0|              BLOSC_TRACE_ERROR("Could not load filter %d\n", g_filters[j].id);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1441|      0|              return NULL;
 1442|      0|            }
 1443|      0|          }
 1444|  1.43k|          if (g_filters[j].forward != NULL) {
  ------------------
  |  Branch (1444:15): [True: 1.43k, False: 0]
  ------------------
 1445|  1.43k|            blosc2_cparams cparams;
 1446|  1.43k|            blosc2_ctx_get_cparams(context, &cparams);
 1447|  1.43k|            rc = g_filters[j].forward(_src, _dest, bsize, filters_meta[i], &cparams, g_filters[j].id);
 1448|  1.43k|          } else {
 1449|      0|            BLOSC_TRACE_ERROR("Forward function is NULL");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1450|      0|            return NULL;
 1451|      0|          }
 1452|  1.43k|          if (rc != BLOSC2_ERROR_SUCCESS) {
  ------------------
  |  Branch (1452:15): [True: 0, False: 1.43k]
  ------------------
 1453|      0|            BLOSC_TRACE_ERROR("User-defined filter %d failed during compression\n", filters[i]);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1454|      0|            return NULL;
 1455|      0|          }
 1456|  1.43k|          goto urfiltersuccess;
 1457|  1.43k|        }
 1458|  5.64k|      }
 1459|      0|      BLOSC_TRACE_ERROR("User-defined filter %d not found during compression\n", filters[i]);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1460|      0|      return NULL;
 1461|       |
 1462|  1.43k|      urfiltersuccess:;
 1463|       |
 1464|  1.43k|    }
 1465|       |
 1466|       |    // do_nothing() skipped the filters that leave the block as it is
 1467|  7.95k|    _cycle_buffers_forward(&_src, &_dest, &_tmp, src + offset);
 1468|  7.95k|  }
 1469|  7.95k|  return _src;
 1470|  7.96k|}
pipeline_backward:
 1884|  12.1k|                      uint8_t* tmp2, int last_filter_index, int32_t nblock) {
 1885|  12.1k|  (void)tmp2;
 1886|  12.1k|  blosc2_context* context = thread_context->parent_context;
 1887|  12.1k|  int32_t typesize = context->typesize;
 1888|  12.1k|  uint8_t* filters = context->filters;
 1889|  12.1k|  uint8_t* filters_meta = context->filters_meta;
 1890|  12.1k|  uint8_t* _src = (next_filter(context, BLOSC2_MAX_FILTERS, 'd') == BLOSC_DELTA &&
  ------------------
  |  Branch (1890:20): [True: 1.10k, False: 11.0k]
  ------------------
 1891|  11.0k|                   context->postfilter == NULL) ? (dest + offset) : src;
  ------------------
  |  Branch (1891:20): [True: 1.10k, False: 0]
  ------------------
 1892|  12.1k|  uint8_t* _dest = tmp;
 1893|  12.1k|  int errcode = 0;
 1894|       |
 1895|  16.6k|  for (int i = BLOSC2_MAX_FILTERS - 1; i >= 0; i--) {
  ------------------
  |  Branch (1895:40): [True: 16.1k, False: 530]
  ------------------
 1896|  16.1k|    if (do_nothing(context, i, 'd')) {
  ------------------
  |  Branch (1896:9): [True: 3.61k, False: 12.5k]
  ------------------
 1897|  3.61k|      continue;
 1898|  3.61k|    }
 1899|  12.5k|    int first_index = i;
 1900|  12.5k|#ifdef BLOSC_USE_FUSED_SHUFFLE_BYTEDELTA
 1901|  12.5k|    int fused_size = fused_shuffle_bytedelta_size(context, i - 1);
 1902|  12.5k|    if (fused_size) {
  ------------------
  |  Branch (1902:9): [True: 80, False: 12.4k]
  ------------------
 1903|     80|      first_index = i - 1;
 1904|     80|    }
 1905|  12.5k|#endif
 1906|       |    // Delta filter requires the whole chunk ready. A fused inverse ends at
 1907|       |    // SHUFFLE's position, so select its sink using the pair's first index.
 1908|  12.5k|    int last_copy_filter = (last_filter_index == first_index) || (filters[i] == BLOSC_DELTA) ||
  ------------------
  |  Branch (1908:28): [True: 11.5k, False: 997]
  |  Branch (1908:66): [True: 121, False: 876]
  ------------------
 1909|    876|                           (next_filter(context, first_index, 'd') == BLOSC_DELTA);
  ------------------
  |  Branch (1909:28): [True: 272, False: 604]
  ------------------
 1910|  12.5k|    if (last_copy_filter && context->postfilter == NULL &&
  ------------------
  |  Branch (1910:9): [True: 11.9k, False: 604]
  |  Branch (1910:29): [True: 4.28k, False: 7.65k]
  ------------------
 1911|  4.28k|        (filters[i] == BLOSC_DELTA || _src != dest + offset)) {
  ------------------
  |  Branch (1911:10): [True: 1.40k, False: 2.87k]
  |  Branch (1911:39): [True: 2.82k, False: 46]
  ------------------
 1912|  4.23k|      _dest = dest + offset;
 1913|  8.30k|    } else {
 1914|  8.30k|      _dest = (_src == src) ? tmp : src;
  ------------------
  |  Branch (1914:15): [True: 8.01k, False: 298]
  ------------------
 1915|  8.30k|    }
 1916|  12.5k|    int rc = BLOSC2_ERROR_SUCCESS;
 1917|  12.5k|#ifdef BLOSC_USE_FUSED_SHUFFLE_BYTEDELTA
 1918|  12.5k|    if (fused_size && shuffle_bytedelta_backward(_src, _dest, bsize, fused_size)) {
  ------------------
  |  Branch (1918:9): [True: 80, False: 12.4k]
  |  Branch (1918:23): [True: 80, False: 0]
  ------------------
 1919|     80|      i--;
 1920|     80|      _src = _dest;
 1921|     80|      if (last_filter_index == i) {
  ------------------
  |  Branch (1921:11): [True: 33, False: 47]
  ------------------
 1922|     33|        break;
 1923|     33|      }
 1924|     47|      continue;
 1925|     80|    }
 1926|  12.4k|#endif
 1927|  12.4k|    if (filters[i] <= BLOSC2_DEFINED_FILTERS_STOP) {
  ------------------
  |  Branch (1927:9): [True: 10.1k, False: 2.32k]
  ------------------
 1928|  10.1k|      switch (filters[i]) {
 1929|  4.83k|        case BLOSC_SHUFFLE:
  ------------------
  |  Branch (1929:9): [True: 4.83k, False: 5.30k]
  ------------------
 1930|  4.83k|          blosc2_unshuffle(shuffle_size(context, i), bsize, _src, _dest);
 1931|  4.83k|          break;
 1932|  3.85k|        case BLOSC_BITSHUFFLE:
  ------------------
  |  Branch (1932:9): [True: 3.85k, False: 6.29k]
  ------------------
 1933|  3.85k|          if (bitunshuffle(typesize, bsize, _src, _dest, bitshuffle_scratch(thread_context, bsize),
  ------------------
  |  Branch (1933:15): [True: 0, False: 3.85k]
  ------------------
 1934|  3.85k|                           context->src[BLOSC2_CHUNK_VERSION]) < 0) {
 1935|      0|            return BLOSC2_ERROR_FILTER_PIPELINE;
 1936|      0|          }
 1937|  3.85k|          break;
 1938|  3.85k|        case BLOSC_DELTA:
  ------------------
  |  Branch (1938:9): [True: 1.40k, False: 8.73k]
  ------------------
 1939|  1.40k|          if (_src != _dest) {
  ------------------
  |  Branch (1939:15): [True: 22, False: 1.38k]
  ------------------
 1940|     22|            memcpy(_dest, _src, (size_t)bsize);
 1941|     22|          }
 1942|  1.40k|          if (offset != 0 && !thread_context->serial) {
  ------------------
  |  Branch (1942:15): [True: 986, False: 423]
  |  Branch (1942:30): [True: 0, False: 986]
  ------------------
 1943|      0|            delta_wait_dref(context);
 1944|      0|          }
 1945|  1.40k|          delta_decoder(offset == 0 ? _dest : dest, offset, bsize, typesize, _dest);
  ------------------
  |  Branch (1945:25): [True: 423, False: 986]
  ------------------
 1946|  1.40k|          break;
 1947|     46|        default:
  ------------------
  |  Branch (1947:9): [True: 46, False: 10.0k]
  ------------------
 1948|     46|          BLOSC_TRACE_ERROR("Filter %d not handled during decompression.", filters[i]);
  ------------------
  |  |   93|     46|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|     46|    do {                                            \
  |  |  |  |   98|     46|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|     46|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 46, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|     46|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1949|     46|          errcode = -1;
 1950|  10.1k|      }
 1951|  10.1k|    } else {
 1952|       |        // Look for the filters_meta in user filters and run it
 1953|  8.64k|        for (uint64_t j = 0; j < g_nfilters; ++j) {
  ------------------
  |  Branch (1953:30): [True: 8.61k, False: 34]
  ------------------
 1954|  8.61k|          if (g_filters[j].id == filters[i]) {
  ------------------
  |  Branch (1954:15): [True: 2.29k, False: 6.32k]
  ------------------
 1955|  2.29k|            if (load_acquire_ptr(&g_filters[j].backward) == NULL) {
  ------------------
  |  |  144|  2.29k|#define load_acquire_ptr(p) __atomic_load_n((p), __ATOMIC_ACQUIRE)
  ------------------
  |  Branch (1955:17): [True: 0, False: 2.29k]
  ------------------
 1956|       |              // Dynamically load filter
 1957|      0|              if (fill_filter(&g_filters[j]) < 0) {
  ------------------
  |  Branch (1957:19): [True: 0, False: 0]
  ------------------
 1958|      0|                BLOSC_TRACE_ERROR("Could not load filter %d.", g_filters[j].id);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1959|      0|                return BLOSC2_ERROR_FILTER_PIPELINE;
 1960|      0|              }
 1961|      0|            }
 1962|  2.29k|            if (g_filters[j].backward != NULL) {
  ------------------
  |  Branch (1962:17): [True: 2.29k, False: 0]
  ------------------
 1963|  2.29k|              blosc2_dparams dparams;
 1964|  2.29k|              blosc2_ctx_get_dparams(context, &dparams);
 1965|  2.29k|              rc = g_filters[j].backward(_src, _dest, bsize, filters_meta[i], &dparams, g_filters[j].id);
 1966|  2.29k|            } else {
 1967|      0|              BLOSC_TRACE_ERROR("Backward function is NULL");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1968|      0|              return BLOSC2_ERROR_FILTER_PIPELINE;
 1969|      0|            }
 1970|  2.29k|            if (rc != BLOSC2_ERROR_SUCCESS) {
  ------------------
  |  Branch (1970:17): [True: 15, False: 2.27k]
  ------------------
 1971|     15|              BLOSC_TRACE_ERROR("User-defined filter %d failed during decompression.", filters[i]);
  ------------------
  |  |   93|     15|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|     15|    do {                                            \
  |  |  |  |   98|     15|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|     15|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 15, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|     15|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1972|     15|              return rc;
 1973|     15|            }
 1974|  2.27k|            goto urfiltersuccess;
 1975|  2.29k|          }
 1976|  8.61k|        }
 1977|     34|      BLOSC_TRACE_ERROR("User-defined filter %d not found during decompression.", filters[i]);
  ------------------
  |  |   93|     34|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|     34|    do {                                            \
  |  |  |  |   98|     34|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|     34|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 34, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|     34|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1978|     34|      return BLOSC2_ERROR_FILTER_PIPELINE;
 1979|  2.27k|      urfiltersuccess:;
 1980|  2.27k|    }
 1981|       |
 1982|       |    // do_nothing() skipped the filters that leave the block as it is (TRUNC_PREC is not undone);
 1983|       |    // the output of this filter is the input of the next one
 1984|  12.4k|    _src = _dest;
 1985|  12.4k|    if (last_filter_index == i) {
  ------------------
  |  Branch (1985:9): [True: 11.4k, False: 918]
  ------------------
 1986|  11.4k|      break;
 1987|  11.4k|    }
 1988|  12.4k|  }
 1989|       |
 1990|  12.0k|  if (context->postfilter == NULL && _src != dest + offset) {
  ------------------
  |  Branch (1990:7): [True: 3.87k, False: 8.18k]
  |  Branch (1990:38): [True: 24, False: 3.85k]
  ------------------
 1991|     24|    memcpy(dest + offset, _src, (unsigned int)bsize);
 1992|     24|  }
 1993|       |
 1994|       |  /* Postfilter function */
 1995|  12.0k|  if (context->postfilter != NULL) {
  ------------------
  |  Branch (1995:7): [True: 8.18k, False: 3.87k]
  ------------------
 1996|       |    // Create new postfilter parameters for this block (must be private for each thread)
 1997|  8.18k|    blosc2_postfilter_params postparams;
 1998|  8.18k|    memcpy(&postparams, context->postparams, sizeof(postparams));
 1999|  8.18k|    postparams.input = _src;
 2000|  8.18k|    postparams.output = dest + offset;
 2001|  8.18k|    postparams.size = bsize;
 2002|  8.18k|    postparams.typesize = typesize;
 2003|  8.18k|    postparams.offset = nblock * context->blocksize;
 2004|  8.18k|    postparams.nchunk = context->schunk != NULL ? context->schunk->current_nchunk : -1;
  ------------------
  |  Branch (2004:25): [True: 8.18k, False: 0]
  ------------------
 2005|  8.18k|    postparams.nblock = nblock;
 2006|  8.18k|    postparams.tid = thread_context->tid;
 2007|  8.18k|    postparams.ttmp = thread_context->tmp;
 2008|  8.18k|    postparams.ttmp_nbytes = thread_context->tmp_nbytes;
 2009|  8.18k|    postparams.ctx = context;
 2010|       |
 2011|  8.18k|    if (context->postfilter(&postparams) != 0) {
  ------------------
  |  Branch (2011:9): [True: 0, False: 8.18k]
  ------------------
 2012|      0|      BLOSC_TRACE_ERROR("Execution of postfilter function failed");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2013|      0|      return BLOSC2_ERROR_POSTFILTER;
 2014|      0|    }
 2015|  8.18k|  }
 2016|       |
 2017|  12.0k|  return errcode;
 2018|  12.0k|}
free_thread_context:
 2708|  1.56k|void free_thread_context(struct thread_context* thread_context) {
 2709|  1.56k|  destroy_thread_context(thread_context);
 2710|  1.56k|  my_free(thread_context);
 2711|  1.56k|}
blosc2_compress_ctx:
 3714|  1.22k|                        void* dest, int32_t destsize) {
 3715|  1.22k|  int error, cbytes;
 3716|       |
 3717|  1.22k|  if (context->do_compress != 1) {
  ------------------
  |  Branch (3717:7): [True: 0, False: 1.22k]
  ------------------
 3718|      0|    BLOSC_TRACE_ERROR("Context is not meant for compression.  Giving up.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3719|      0|    return BLOSC2_ERROR_INVALID_PARAM;
 3720|      0|  }
 3721|       |
 3722|  1.22k|  error = initialize_context_compression(
 3723|  1.22k|          context, src, srcsize, dest, destsize,
 3724|  1.22k|          context->clevel, context->filters, context->filters_meta,
 3725|  1.22k|          context->typesize, context->compcode, context->blocksize,
 3726|  1.22k|          context->new_nthreads, context->nthreads, context->splitmode,
 3727|  1.22k|          context->tuner_id, context->tuner_params, context->schunk);
 3728|  1.22k|  if (error <= 0) {
  ------------------
  |  Branch (3728:7): [True: 0, False: 1.22k]
  ------------------
 3729|      0|    return error;
 3730|      0|  }
 3731|       |
 3732|  1.22k|  error = blosc1_format_check(context);
 3733|  1.22k|  if (error < 0) {
  ------------------
  |  Branch (3733:7): [True: 0, False: 1.22k]
  ------------------
 3734|      0|    return error;
 3735|      0|  }
 3736|       |
 3737|       |  /* Write the extended header, or the Blosc1 header if requested */
 3738|  1.22k|  error = write_compression_header(context, !context->blosc1_format);
 3739|  1.22k|  if (error < 0) {
  ------------------
  |  Branch (3739:7): [True: 0, False: 1.22k]
  ------------------
 3740|      0|    return error;
 3741|      0|  }
 3742|       |
 3743|  1.22k|  cbytes = blosc_compress_context(context);
 3744|  1.22k|  if (cbytes < 0) {
  ------------------
  |  Branch (3744:7): [True: 1, False: 1.22k]
  ------------------
 3745|      1|    return cbytes;
 3746|      1|  }
 3747|       |
 3748|  1.22k|  if (context->use_dict && context->dict_cdict == NULL) {
  ------------------
  |  Branch (3748:7): [True: 0, False: 1.22k]
  |  Branch (3748:28): [True: 0, False: 0]
  ------------------
 3749|       |    /* blosc_compress_context() overwrites context->destsize with the training-pass output
 3750|       |     * size.  Restore it so that the real compression pass has the correct output-buffer size. */
 3751|      0|    context->destsize = destsize;
 3752|       |
 3753|      0|    bool is_lz4 = (context->compcode == BLOSC_LZ4 || context->compcode == BLOSC_LZ4HC);
  ------------------
  |  Branch (3753:20): [True: 0, False: 0]
  |  Branch (3753:54): [True: 0, False: 0]
  ------------------
 3754|      0|    if (!is_lz4 && context->compcode != BLOSC_ZSTD) {
  ------------------
  |  Branch (3754:9): [True: 0, False: 0]
  |  Branch (3754:20): [True: 0, False: 0]
  ------------------
 3755|      0|      const char* compname;
 3756|      0|      compname = clibcode_to_clibname(context->compcode);
 3757|      0|      BLOSC_TRACE_ERROR("Codec %s does not support dicts.  Giving up.",
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3758|      0|                        compname);
 3759|      0|      return BLOSC2_ERROR_CODEC_DICT;
 3760|      0|    }
 3761|       |
 3762|       |    // Build the dictionary out of the filters outcome and compress with it.
 3763|       |    // For LZ4/LZ4HC the raw samples are used directly (no training algorithm).
 3764|       |    // For ZSTD, ZDICT_trainFromBuffer() is used.
 3765|      0|    int32_t dict_maxsize = BLOSC2_MAXDICTSIZE;
 3766|       |    // Do not make the dict more than 5% larger than uncompressed buffer
 3767|      0|    if (dict_maxsize > srcsize / 20) {
  ------------------
  |  Branch (3767:9): [True: 0, False: 0]
  ------------------
 3768|      0|      dict_maxsize = srcsize / 20;
 3769|      0|    }
 3770|      0|    void* samples_buffer = context->dest + context->header_overhead;
 3771|      0|    unsigned nblocks = (unsigned)context->nblocks;
 3772|      0|    int dont_split = (context->header_flags & 0x10) >> 4;
 3773|      0|    if (!dont_split) {
  ------------------
  |  Branch (3773:9): [True: 0, False: 0]
  ------------------
 3774|      0|      nblocks = nblocks * context->typesize;
 3775|      0|    }
 3776|      0|    if (nblocks < 8) {
  ------------------
  |  Branch (3776:9): [True: 0, False: 0]
  ------------------
 3777|      0|      nblocks = 8;
 3778|      0|    }
 3779|       |
 3780|      0|    unsigned sample_fraction = 16;
 3781|      0|    size_t sample_size = context->sourcesize / nblocks / sample_fraction;
 3782|       |
 3783|       |    // When the data is too small to produce useful dict samples,
 3784|       |    // fall back to plain compression without a dict.
 3785|      0|    if (dict_maxsize < BLOSC2_MINUSEFULDICT || sample_size == 0) {
  ------------------
  |  Branch (3785:9): [True: 0, False: 0]
  |  Branch (3785:48): [True: 0, False: 0]
  ------------------
 3786|      0|      BLOSC_TRACE_WARNING("Data too small for dict training (dict_maxsize=%d, sample_size=%zu)."
  ------------------
  |  |   94|      0|#define BLOSC_TRACE_WARNING(msg, ...) BLOSC_TRACE(warning, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3787|      0|                          "  Falling back to plain compression.", dict_maxsize, sample_size);
 3788|      0|      context->bstarts = (int32_t*)(context->dest + context->header_overhead);
 3789|      0|      context->output_bytes = context->header_overhead + (int32_t)sizeof(int32_t) * context->nblocks;
 3790|      0|      cbytes = blosc_compress_context_without_dict(context);
 3791|      0|    }
 3792|      0|    else if (is_lz4) {
  ------------------
  |  Branch (3792:14): [True: 0, False: 0]
  ------------------
 3793|       |      // LZ4/LZ4HC: use raw sample data directly as the dictionary (no training step).
 3794|      0|      int32_t dict_actual_size = (int32_t)(nblocks * sample_size);
 3795|      0|      if (dict_actual_size > dict_maxsize) {
  ------------------
  |  Branch (3795:11): [True: 0, False: 0]
  ------------------
 3796|      0|        dict_actual_size = dict_maxsize;
 3797|      0|      }
 3798|       |
 3799|       |      // Reset bstarts and embed dict in the output buffer.
 3800|      0|      context->bstarts = (int32_t*)(context->dest + context->header_overhead);
 3801|      0|      context->output_bytes = context->header_overhead + (int32_t)sizeof(int32_t) * context->nblocks;
 3802|       |      /* Move dict bytes; samples_buffer overlaps the dict (and its size) in dest,
 3803|       |         so this has to be a memmove, done before writing the size */
 3804|      0|      context->dict_buffer = context->dest + context->output_bytes + sizeof(int32_t);
 3805|      0|      memmove(context->dict_buffer, samples_buffer, (size_t)dict_actual_size);
 3806|       |      /* Write dict size */
 3807|      0|      _sw32(context->dest + context->output_bytes, dict_actual_size);
 3808|      0|      context->output_bytes += (int32_t)sizeof(int32_t);
 3809|       |      /* Build the stream used as cdict (pre-loaded with the dict bytes) */
 3810|      0|      if (context->compcode == BLOSC_LZ4HC) {
  ------------------
  |  Branch (3810:11): [True: 0, False: 0]
  ------------------
 3811|      0|        LZ4_streamHC_t* lz4hc_cdict = LZ4_createStreamHC();
 3812|      0|        LZ4_loadDictHC(lz4hc_cdict, (const char*)context->dict_buffer, dict_actual_size);
 3813|      0|        context->dict_cdict = lz4hc_cdict;
 3814|      0|      } else {
 3815|      0|        LZ4_stream_t* lz4_cdict = LZ4_createStream();
 3816|      0|        LZ4_loadDict(lz4_cdict, (const char*)context->dict_buffer, dict_actual_size);
 3817|      0|        context->dict_cdict = lz4_cdict;
 3818|      0|      }
 3819|      0|      context->output_bytes += dict_actual_size;
 3820|      0|      context->dict_size = dict_actual_size;
 3821|       |
 3822|       |      /* Compress with dict */
 3823|      0|      cbytes = blosc_compress_context(context);
 3824|       |
 3825|       |      // Invalidate the dictionary so the context can be reused for the next chunk
 3826|      0|      context->dict_buffer = NULL;
 3827|      0|      if (context->compcode == BLOSC_LZ4HC) {
  ------------------
  |  Branch (3827:11): [True: 0, False: 0]
  ------------------
 3828|      0|        LZ4_freeStreamHC((LZ4_streamHC_t*)context->dict_cdict);
 3829|      0|      } else {
 3830|      0|        LZ4_freeStream((LZ4_stream_t*)context->dict_cdict);
 3831|      0|      }
 3832|      0|      context->dict_cdict = NULL;
 3833|      0|    }
 3834|      0|#ifdef HAVE_ZSTD
 3835|      0|    else {
 3836|       |    // Populate the samples sizes for training the dictionary
 3837|      0|    size_t* samples_sizes = malloc(nblocks * sizeof(size_t));
 3838|      0|    BLOSC_ERROR_NULL(samples_sizes, BLOSC2_ERROR_MEMORY_ALLOC);
  ------------------
  |  |  104|      0|    do {                                            \
  |  |  105|      0|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 0]
  |  |  ------------------
  |  |  106|      0|            BLOSC_TRACE_ERROR("Pointer is null");   \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  107|      0|            return (rc);                            \
  |  |  108|      0|        }                                           \
  |  |  109|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
 3839|      0|    for (size_t i = 0; i < nblocks; i++) {
  ------------------
  |  Branch (3839:24): [True: 0, False: 0]
  ------------------
 3840|      0|      samples_sizes[i] = sample_size;
 3841|      0|    }
 3842|       |
 3843|       |    // Train from samples
 3844|      0|    void* dict_buffer = malloc(dict_maxsize);
 3845|      0|    if (dict_buffer == NULL) {
  ------------------
  |  Branch (3845:9): [True: 0, False: 0]
  ------------------
 3846|      0|      free(samples_sizes);
 3847|      0|      BLOSC_ERROR_NULL(dict_buffer, BLOSC2_ERROR_MEMORY_ALLOC);
  ------------------
  |  |  104|      0|    do {                                            \
  |  |  105|      0|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 0]
  |  |  ------------------
  |  |  106|      0|            BLOSC_TRACE_ERROR("Pointer is null");   \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  107|      0|            return (rc);                            \
  |  |  108|      0|        }                                           \
  |  |  109|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
 3848|      0|    }
 3849|      0|    int32_t dict_actual_size = (int32_t)ZDICT_trainFromBuffer(
 3850|      0|        dict_buffer, dict_maxsize,
 3851|      0|        samples_buffer, samples_sizes, nblocks);
 3852|       |
 3853|       |    // TODO: experiment with parameters of low-level fast cover algorithm
 3854|       |    // Note that this API is still unstable.  See: https://github.com/facebook/zstd/issues/1599
 3855|       |    // ZDICT_fastCover_params_t fast_cover_params;
 3856|       |    // memset(&fast_cover_params, 0, sizeof(fast_cover_params));
 3857|       |    // fast_cover_params.d = nblocks;
 3858|       |    // fast_cover_params.steps = 4;
 3859|       |    // fast_cover_params.zParams.compressionLevel = context->clevel;
 3860|       |    // size_t dict_actual_size = ZDICT_optimizeTrainFromBuffer_fastCover(
 3861|       |    //   dict_buffer, dict_maxsize, samples_buffer, samples_sizes, nblocks,
 3862|       |    //   &fast_cover_params);
 3863|       |
 3864|      0|    free(samples_sizes);
 3865|      0|    if (ZDICT_isError(dict_actual_size) != ZSTD_error_no_error) {
  ------------------
  |  Branch (3865:9): [True: 0, False: 0]
  ------------------
 3866|      0|      BLOSC_TRACE_WARNING("ZDICT_trainFromBuffer() failed: '%s'."
  ------------------
  |  |   94|      0|#define BLOSC_TRACE_WARNING(msg, ...) BLOSC_TRACE(warning, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3867|      0|                          "  Falling back to plain compression.",
 3868|      0|                          ZDICT_getErrorName(dict_actual_size));
 3869|      0|      free(dict_buffer);
 3870|      0|      context->bstarts = (int32_t*)(context->dest + context->header_overhead);
 3871|      0|      context->output_bytes = context->header_overhead + (int32_t)sizeof(int32_t) * context->nblocks;
 3872|      0|      cbytes = blosc_compress_context_without_dict(context);
 3873|      0|    }
 3874|      0|    else {
 3875|      0|    assert(dict_actual_size > 0);
 3876|       |
 3877|       |    // Update bytes counter and pointers to bstarts for the new compressed buffer
 3878|      0|    context->bstarts = (int32_t*)(context->dest + context->header_overhead);
 3879|      0|    context->output_bytes = context->header_overhead + (int32_t)sizeof(int32_t) * context->nblocks;
 3880|       |    /* Write the size of trained dict at the end of bstarts */
 3881|      0|    _sw32(context->dest + context->output_bytes, (int32_t)dict_actual_size);
 3882|      0|    context->output_bytes += sizeof(int32_t);
 3883|       |    /* Write the trained dict afterwards */
 3884|      0|    context->dict_buffer = context->dest + context->output_bytes;
 3885|      0|    memcpy(context->dict_buffer, dict_buffer, (unsigned int)dict_actual_size);
 3886|      0|    context->dict_cdict = ZSTD_createCDict(dict_buffer, dict_actual_size, 1);  // TODO: use get_accel()
 3887|      0|    free(dict_buffer);      // the dictionary is copied in the header now
 3888|      0|    context->output_bytes += (int32_t)dict_actual_size;
 3889|      0|    context->dict_size = dict_actual_size;
 3890|       |
 3891|       |    /* Compress with dict */
 3892|      0|    cbytes = blosc_compress_context(context);
 3893|       |
 3894|       |    // Invalidate the dictionary for compressing other chunks using the same context
 3895|      0|    context->dict_buffer = NULL;
 3896|      0|    ZSTD_freeCDict(context->dict_cdict);
 3897|      0|    context->dict_cdict = NULL;
 3898|      0|    }  // ZDICT_isError
 3899|      0|    }  // ZSTD else branch
 3900|      0|#endif  // HAVE_ZSTD
 3901|      0|  }
 3902|       |
 3903|  1.22k|  return cbytes;
 3904|  1.22k|}
build_filters:
 4287|  3.36k|                   const int32_t typesize, uint8_t* filters) {
 4288|       |
 4289|       |  /* Fill the end part of the filter pipeline */
 4290|  3.36k|  if ((doshuffle == BLOSC_SHUFFLE) && (typesize > 1))
  ------------------
  |  Branch (4290:7): [True: 0, False: 3.36k]
  |  Branch (4290:39): [True: 0, False: 0]
  ------------------
 4291|      0|    filters[BLOSC2_MAX_FILTERS - 1] = BLOSC_SHUFFLE;
 4292|  3.36k|  if (doshuffle == BLOSC_BITSHUFFLE)
  ------------------
  |  Branch (4292:7): [True: 0, False: 3.36k]
  ------------------
 4293|      0|    filters[BLOSC2_MAX_FILTERS - 1] = BLOSC_BITSHUFFLE;
 4294|  3.36k|  if (doshuffle == BLOSC_NOSHUFFLE)
  ------------------
  |  Branch (4294:7): [True: 0, False: 3.36k]
  ------------------
 4295|      0|    filters[BLOSC2_MAX_FILTERS - 1] = BLOSC_NOSHUFFLE;
 4296|  3.36k|  if (delta)
  ------------------
  |  Branch (4296:7): [True: 0, False: 3.36k]
  ------------------
 4297|      0|    filters[BLOSC2_MAX_FILTERS - 2] = BLOSC_DELTA;
 4298|  3.36k|}
blosc2_decompress_ctx:
 4548|  3.47k|                          void* dest, int32_t destsize) {
 4549|  3.47k|  int result;
 4550|       |
 4551|  3.47k|  if (context->do_compress != 0) {
  ------------------
  |  Branch (4551:7): [True: 0, False: 3.47k]
  ------------------
 4552|      0|    BLOSC_TRACE_ERROR("Context is not meant for decompression.  Giving up.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4553|      0|    return BLOSC2_ERROR_INVALID_PARAM;
 4554|      0|  }
 4555|       |
 4556|  3.47k|  result = blosc_run_decompression_with_context(context, src, srcsize, dest, destsize);
 4557|       |
 4558|       |  // Reset a possible block_maskout
 4559|  3.47k|  ctx_clear_maskout(context);
 4560|       |
 4561|  3.47k|  return result;
 4562|  3.47k|}
_blosc_getitem:
 4935|  2.69k|                   int start, int nitems, void* dest, int32_t destsize) {
 4936|  2.69k|  uint8_t* _src = (uint8_t*)(src);  /* current pos for source buffer */
 4937|  2.69k|  uint8_t* _dest = (uint8_t*)(dest);
 4938|  2.69k|  int32_t ntbytes = 0;              /* the number of uncompressed bytes */
 4939|  2.69k|  int32_t bsize, bsize2, leftoverblock;
 4940|  2.69k|  int32_t startb, stopb;
 4941|  2.69k|  int32_t stop;
 4942|  2.69k|  int32_t nitems_bytes;
 4943|  2.69k|  int64_t start64 = (int64_t)start;
 4944|  2.69k|  int64_t nitems64 = (int64_t)nitems;
 4945|  2.69k|  int64_t typesize64 = (int64_t)header->typesize;
 4946|  2.69k|  int64_t stop64;
 4947|  2.69k|  int64_t nitems_bytes64;
 4948|  2.69k|  int64_t start_bytes64;
 4949|  2.69k|  int64_t stop_bytes64;
 4950|  2.69k|  int j, rc;
 4951|       |
 4952|  2.69k|  if (nitems == 0) {
  ------------------
  |  Branch (4952:7): [True: 0, False: 2.69k]
  ------------------
 4953|       |    // We have nothing to do
 4954|      0|    return 0;
 4955|      0|  }
 4956|  2.69k|  if (nitems < 0) {
  ------------------
  |  Branch (4956:7): [True: 0, False: 2.69k]
  ------------------
 4957|      0|    BLOSC_TRACE_ERROR("`nitems` out of bounds.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4958|      0|    return BLOSC2_ERROR_INVALID_PARAM;
 4959|      0|  }
 4960|       |
 4961|  2.69k|  nitems_bytes64 = nitems64 * typesize64;
 4962|  2.69k|  if (nitems_bytes64 < 0 || nitems_bytes64 > INT32_MAX || nitems_bytes64 > destsize) {
  ------------------
  |  Branch (4962:7): [True: 0, False: 2.69k]
  |  Branch (4962:29): [True: 0, False: 2.69k]
  |  Branch (4962:59): [True: 21, False: 2.67k]
  ------------------
 4963|     21|    BLOSC_TRACE_ERROR("`nitems`*`typesize` out of dest bounds.");
  ------------------
  |  |   93|     21|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|     21|    do {                                            \
  |  |  |  |   98|     21|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|     21|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 21, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|     21|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4964|     21|    return BLOSC2_ERROR_WRITE_BUFFER;
 4965|     21|  }
 4966|  2.67k|  nitems_bytes = (int32_t)nitems_bytes64;
 4967|       |
 4968|  2.67k|  int32_t* bstarts = (int32_t*)(_src + context->header_overhead);
 4969|       |
 4970|       |  /* Check region boundaries */
 4971|  2.67k|  start_bytes64 = start64 * typesize64;
 4972|  2.67k|  if ((start < 0) || (start_bytes64 < 0) || (start_bytes64 > header->nbytes)) {
  ------------------
  |  Branch (4972:7): [True: 0, False: 2.67k]
  |  Branch (4972:22): [True: 0, False: 2.67k]
  |  Branch (4972:45): [True: 0, False: 2.67k]
  ------------------
 4973|      0|    BLOSC_TRACE_ERROR("`start` out of bounds.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4974|      0|    return BLOSC2_ERROR_INVALID_PARAM;
 4975|      0|  }
 4976|       |
 4977|  2.67k|  stop64 = start64 + nitems64;
 4978|  2.67k|  if ((stop64 < 0) || (stop64 > INT32_MAX)) {
  ------------------
  |  Branch (4978:7): [True: 0, False: 2.67k]
  |  Branch (4978:23): [True: 0, False: 2.67k]
  ------------------
 4979|      0|    BLOSC_TRACE_ERROR("`start`+`nitems` out of bounds.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4980|      0|    return BLOSC2_ERROR_INVALID_PARAM;
 4981|      0|  }
 4982|  2.67k|  stop = (int32_t)stop64;
 4983|       |
 4984|  2.67k|  stop_bytes64 = stop64 * typesize64;
 4985|  2.67k|  if ((stop_bytes64 < 0) || (stop_bytes64 > header->nbytes)) {
  ------------------
  |  Branch (4985:7): [True: 0, False: 2.67k]
  |  Branch (4985:29): [True: 0, False: 2.67k]
  ------------------
 4986|      0|    BLOSC_TRACE_ERROR("`start`+`nitems` out of bounds.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4987|      0|    return BLOSC2_ERROR_INVALID_PARAM;
 4988|      0|  }
 4989|       |
 4990|  2.67k|  bool chunk_memcpyed = (header->flags & (uint8_t)BLOSC_MEMCPYED) != 0;
 4991|  2.67k|  if (!context->special_type && !chunk_memcpyed &&
  ------------------
  |  Branch (4991:7): [True: 2.52k, False: 146]
  |  Branch (4991:33): [True: 1.86k, False: 664]
  ------------------
 4992|  1.86k|      ((uint8_t *)(_src + srcsize) < (uint8_t *)(bstarts + context->nblocks))) {
  ------------------
  |  Branch (4992:7): [True: 0, False: 1.86k]
  ------------------
 4993|      0|    BLOSC_TRACE_ERROR("`bstarts` out of bounds.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4994|      0|    return BLOSC2_ERROR_READ_BUFFER;
 4995|      0|  }
 4996|       |
 4997|  2.67k|  bool memcpyed = header->flags & (uint8_t)BLOSC_MEMCPYED;
 4998|  2.67k|  if (context->special_type) {
  ------------------
  |  Branch (4998:7): [True: 146, False: 2.52k]
  ------------------
 4999|       |    // Fake a runlen as if its a memcpyed chunk
 5000|    146|    memcpyed = true;
 5001|    146|  }
 5002|       |
 5003|  2.67k|  bool is_lazy = ((context->header_overhead == BLOSC_EXTENDED_HEADER_LENGTH) &&
  ------------------
  |  Branch (5003:19): [True: 2.59k, False: 78]
  ------------------
 5004|  2.59k|                  (context->blosc2_flags & 0x08u) && !context->special_type);
  ------------------
  |  Branch (5004:19): [True: 16, False: 2.57k]
  |  Branch (5004:54): [True: 0, False: 16]
  ------------------
 5005|  2.67k|  if (memcpyed && !is_lazy && !context->postfilter) {
  ------------------
  |  Branch (5005:7): [True: 810, False: 1.86k]
  |  Branch (5005:19): [True: 810, False: 0]
  |  Branch (5005:31): [True: 810, False: 0]
  ------------------
 5006|       |    // Short-circuit for (non-lazy) memcpyed or special values
 5007|    810|    ntbytes = nitems_bytes;
 5008|    810|    switch (context->special_type) {
 5009|    146|      case BLOSC2_SPECIAL_VALUE: {
  ------------------
  |  Branch (5009:7): [True: 146, False: 664]
  ------------------
 5010|       |        // The repeated value's width is cbytes minus the header, not the header
 5011|       |        // typesize byte (which is left unconstrained for special-value chunks).
 5012|       |        // Derive it the same way blosc_d() does so a crafted typesize cannot make
 5013|       |        // set_values() read past the end of the chunk.
 5014|    146|        int32_t value_typesize = header->cbytes - context->header_overhead;
 5015|    146|        rc = set_values(value_typesize, _src, _dest, ntbytes);
 5016|    146|        if (rc < 0) {
  ------------------
  |  Branch (5016:13): [True: 8, False: 138]
  ------------------
 5017|      8|          BLOSC_TRACE_ERROR("set_values failed");
  ------------------
  |  |   93|      8|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      8|    do {                                            \
  |  |  |  |   98|      8|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      8|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 8, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      8|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 5018|      8|          return BLOSC2_ERROR_DATA;
 5019|      8|        }
 5020|    138|        break;
 5021|    146|      }
 5022|    138|      case BLOSC2_SPECIAL_NAN:
  ------------------
  |  Branch (5022:7): [True: 0, False: 810]
  ------------------
 5023|      0|        rc = set_nans(context->typesize, _dest, ntbytes);
 5024|      0|        if (rc < 0) {
  ------------------
  |  Branch (5024:13): [True: 0, False: 0]
  ------------------
 5025|      0|          BLOSC_TRACE_ERROR("set_nans failed");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 5026|      0|          return BLOSC2_ERROR_DATA;
 5027|      0|        }
 5028|      0|        break;
 5029|      0|      case BLOSC2_SPECIAL_ZERO:
  ------------------
  |  Branch (5029:7): [True: 0, False: 810]
  ------------------
 5030|      0|        memset(_dest, 0, ntbytes);
 5031|      0|        break;
 5032|      0|      case BLOSC2_SPECIAL_UNINIT:
  ------------------
  |  Branch (5032:7): [True: 0, False: 810]
  ------------------
 5033|       |        // We do nothing here
 5034|      0|        break;
 5035|    664|      case BLOSC2_NO_SPECIAL:
  ------------------
  |  Branch (5035:7): [True: 664, False: 146]
  ------------------
 5036|    664|        {
 5037|    664|          int64_t src_offset64 = (int64_t)context->header_overhead + start_bytes64;
 5038|    664|          int64_t src_stop64 = src_offset64 + nitems_bytes64;
 5039|    664|          if ((src_offset64 < 0) || (src_stop64 < src_offset64) || (src_stop64 > srcsize)) {
  ------------------
  |  Branch (5039:15): [True: 0, False: 664]
  |  Branch (5039:37): [True: 0, False: 664]
  |  Branch (5039:68): [True: 0, False: 664]
  ------------------
 5040|      0|            BLOSC_TRACE_ERROR("getitem memcpy source out of bounds.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 5041|      0|            return BLOSC2_ERROR_READ_BUFFER;
 5042|      0|          }
 5043|    664|          _src += (int32_t)src_offset64;
 5044|    664|        }
 5045|      0|        memcpy(_dest, _src, ntbytes);
 5046|    664|        break;
 5047|      0|      default:
  ------------------
  |  Branch (5047:7): [True: 0, False: 810]
  ------------------
 5048|      0|        BLOSC_TRACE_ERROR("Unhandled special value case");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 5049|      0|        BLOSC_ERROR(BLOSC2_ERROR_SCHUNK_SPECIAL);
  ------------------
  |  |  111|      0|    do {                                            \
  |  |  112|      0|        int rc_ = (rc);                             \
  |  |  113|      0|        if (rc_ < BLOSC2_ERROR_SUCCESS) {           \
  |  |  ------------------
  |  |  |  Branch (113:13): [True: 0, False: 0]
  |  |  ------------------
  |  |  114|      0|            char *error_msg = print_error(rc_);     \
  |  |  115|      0|            BLOSC_TRACE_ERROR("%s", error_msg);     \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  116|      0|            return rc_;                             \
  |  |  117|      0|        }                                           \
  |  |  118|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (118:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
 5050|    810|    }
 5051|    802|    return ntbytes;
 5052|    810|  }
 5053|       |
 5054|  1.86k|  if (filters_contain(context->filters, BLOSC_DELTA)) {
  ------------------
  |  Branch (5054:7): [True: 4, False: 1.85k]
  ------------------
 5055|      4|    uint8_t* full_chunk = malloc((size_t)header->nbytes);
 5056|      4|    if (full_chunk == NULL) {
  ------------------
  |  Branch (5056:9): [True: 0, False: 4]
  ------------------
 5057|      0|      return BLOSC2_ERROR_MEMORY_ALLOC;
 5058|      0|    }
 5059|      4|    int dbytes = blosc2_decompress_ctx(context, src, srcsize, full_chunk, header->nbytes);
 5060|      4|    context->dest = NULL;
 5061|      4|    context->destsize = 0;
 5062|      4|    if (dbytes < 0 || dbytes != header->nbytes) {
  ------------------
  |  Branch (5062:9): [True: 0, False: 4]
  |  Branch (5062:23): [True: 0, False: 4]
  ------------------
 5063|      0|      free(full_chunk);
 5064|      0|      return dbytes < 0 ? dbytes : BLOSC2_ERROR_DATA;
  ------------------
  |  Branch (5064:14): [True: 0, False: 0]
  ------------------
 5065|      0|    }
 5066|      4|    memcpy(dest, full_chunk + start_bytes64, (size_t)nitems_bytes);
 5067|      4|    free(full_chunk);
 5068|      4|    return nitems_bytes;
 5069|      4|  }
 5070|       |
 5071|  1.85k|  struct thread_context* scontext = serial_context_get(context);
 5072|  1.85k|  BLOSC_ERROR_NULL(scontext, BLOSC2_ERROR_THREAD_CREATE);
  ------------------
  |  |  104|  1.85k|    do {                                            \
  |  |  105|  1.85k|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 1.85k]
  |  |  ------------------
  |  |  106|      0|            BLOSC_TRACE_ERROR("Pointer is null");   \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  107|      0|            return (rc);                            \
  |  |  108|      0|        }                                           \
  |  |  109|  1.85k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 1.85k]
  |  |  ------------------
  ------------------
 5073|       |
 5074|  3.71k|  for (j = 0; j < context->nblocks; j++) {
  ------------------
  |  Branch (5074:15): [True: 1.86k, False: 1.85k]
  ------------------
 5075|  1.86k|    bsize = header->blocksize;
 5076|  1.86k|    leftoverblock = 0;
 5077|  1.86k|    if ((j == context->nblocks - 1) && (context->leftover > 0)) {
  ------------------
  |  Branch (5077:9): [True: 1.85k, False: 4]
  |  Branch (5077:40): [True: 0, False: 1.85k]
  ------------------
 5078|      0|      bsize = context->leftover;
 5079|      0|      leftoverblock = 1;
 5080|      0|    }
 5081|       |
 5082|       |    /* Compute start & stop for each block */
 5083|  1.86k|    startb = start * header->typesize - j * header->blocksize;
 5084|  1.86k|    stopb = stop * header->typesize - j * header->blocksize;
 5085|  1.86k|    if (stopb <= 0) {
  ------------------
  |  Branch (5085:9): [True: 2, False: 1.85k]
  ------------------
 5086|       |      // We can exit as soon as this block is beyond stop
 5087|      2|      break;
 5088|      2|    }
 5089|  1.85k|    if (startb >= header->blocksize) {
  ------------------
  |  Branch (5089:9): [True: 0, False: 1.85k]
  ------------------
 5090|      0|      continue;
 5091|      0|    }
 5092|  1.85k|    if (startb < 0) {
  ------------------
  |  Branch (5092:9): [True: 0, False: 1.85k]
  ------------------
 5093|      0|      startb = 0;
 5094|      0|    }
 5095|  1.85k|    if (stopb > header->blocksize) {
  ------------------
  |  Branch (5095:9): [True: 0, False: 1.85k]
  ------------------
 5096|      0|      stopb = header->blocksize;
 5097|      0|    }
 5098|  1.85k|    bsize2 = stopb - startb;
 5099|       |
 5100|  1.85k|#if defined(HAVE_ZFP)
 5101|  1.85k|    if (context->compcode == BLOSC_CODEC_ZFP_FIXED_RATE) {
  ------------------
  |  Branch (5101:9): [True: 0, False: 1.85k]
  ------------------
 5102|       |      // The items in this block
 5103|      0|      scontext->zfp_cell_start = startb / context->typesize;
 5104|      0|      scontext->zfp_cell_nitems = bsize2 / context->typesize;
 5105|      0|    }
 5106|  1.85k|#endif /* HAVE_ZFP */
 5107|       |
 5108|       |    /* Do the actual data copy */
 5109|       |    // Regular decompression.  Put results in tmp2.
 5110|       |    // If the items are exactly this block, decompress it in destination and avoid a copy
 5111|  1.85k|    bool get_single_block = ((ntbytes == 0) && (startb == 0) && (bsize == nitems_bytes));
  ------------------
  |  Branch (5111:30): [True: 1.85k, False: 0]
  |  Branch (5111:48): [True: 609, False: 1.24k]
  |  Branch (5111:65): [True: 61, False: 548]
  ------------------
 5112|  1.85k|    uint8_t* tmp2 = get_single_block ? dest : scontext->tmp2;
  ------------------
  |  Branch (5112:21): [True: 61, False: 1.79k]
  ------------------
 5113|       |
 5114|       |    // If memcpyed we don't have a bstarts section (because it is not needed)
 5115|  1.85k|    int32_t src_offset = memcpyed ?
  ------------------
  |  Branch (5115:26): [True: 0, False: 1.85k]
  ------------------
 5116|  1.85k|      context->header_overhead + j * header->blocksize : sw32_(bstarts + j);
 5117|       |
 5118|  1.85k|    int32_t cbytes = blosc_d(scontext, bsize, leftoverblock, memcpyed,
 5119|  1.85k|                             src, srcsize, src_offset, j,
 5120|  1.85k|                             tmp2, 0, scontext->tmp, scontext->tmp3);
 5121|  1.85k|    if (cbytes < 0) {
  ------------------
  |  Branch (5121:9): [True: 0, False: 1.85k]
  ------------------
 5122|      0|      ntbytes = cbytes;
 5123|      0|      break;
 5124|      0|    }
 5125|  1.85k|    if (!get_single_block) {
  ------------------
  |  Branch (5125:9): [True: 1.79k, False: 61]
  ------------------
 5126|       |      /* Copy to destination.  When ZFP decoded just the requested items (a single
 5127|       |         cell), they are at the start of tmp2, else the whole block was decoded. */
 5128|  1.79k|      bool zfp_cell = (scontext->zfp_cell_nitems > 0) && (cbytes == bsize2);
  ------------------
  |  Branch (5128:23): [True: 0, False: 1.79k]
  |  Branch (5128:58): [True: 0, False: 0]
  ------------------
 5129|  1.79k|      memcpy((uint8_t *) dest + ntbytes, tmp2 + (zfp_cell ? 0 : startb), (unsigned int) bsize2);
  ------------------
  |  Branch (5129:50): [True: 0, False: 1.79k]
  ------------------
 5130|  1.79k|    }
 5131|  1.85k|    ntbytes += bsize2;
 5132|  1.85k|  }
 5133|       |
 5134|  1.85k|  scontext->zfp_cell_nitems = 0;
 5135|  1.85k|  serial_context_put(scontext);
 5136|       |
 5137|  1.85k|  if (ntbytes >= 0 && ntbytes != nitems_bytes) {
  ------------------
  |  Branch (5137:7): [True: 1.85k, False: 0]
  |  Branch (5137:23): [True: 0, False: 1.85k]
  ------------------
 5138|       |    // A partial decode must not look like a success: callers that only test for
 5139|       |    // a negative return would silently keep hold of an incompletely filled dest.
 5140|      0|    BLOSC_TRACE_ERROR("Only %d bytes out of the %d requested could be decoded.",
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 5141|      0|                      ntbytes, nitems_bytes);
 5142|      0|    return BLOSC2_ERROR_DATA;
 5143|      0|  }
 5144|       |
 5145|  1.85k|  return ntbytes;
 5146|  1.85k|}
blosc2_getitem:
 5148|  2.69k|int blosc2_getitem(const void* src, int32_t srcsize, int start, int nitems, void* dest, int32_t destsize) {
 5149|  2.69k|  blosc2_context context;
 5150|  2.69k|  int result;
 5151|       |
 5152|       |  /* Minimally populate the context */
 5153|  2.69k|  memset(&context, 0, sizeof(blosc2_context));
 5154|       |
 5155|  2.69k|  context.schunk = g_schunk;
 5156|  2.69k|  context.nthreads = 1;  // force a serial decompression; fixes #95
 5157|       |
 5158|       |  /* Call the actual getitem function */
 5159|  2.69k|  result = blosc2_getitem_ctx(&context, src, srcsize, start, nitems, dest, destsize);
 5160|       |
 5161|       |  /* Release resources */
 5162|  2.69k|  if (context.serial_context != NULL) {
  ------------------
  |  Branch (5162:7): [True: 17, False: 2.67k]
  ------------------
 5163|     17|    free_thread_context(context.serial_context);
 5164|     17|  }
 5165|  2.69k|  return result;
 5166|  2.69k|}
blosc2_getitem_ctx:
 5210|  2.69k|    int start, int nitems, void* dest, int32_t destsize) {
 5211|  2.69k|  blosc_header header;
 5212|  2.69k|  int result = getitem_read_header(src, srcsize, &header);
 5213|  2.69k|  if (result < 0) {
  ------------------
  |  Branch (5213:7): [True: 0, False: 2.69k]
  ------------------
 5214|      0|    return result;
 5215|      0|  }
 5216|       |
 5217|  2.69k|  return getitem_with_header(context, &header, src, srcsize, start, nitems, dest, destsize);
 5218|  2.69k|}
blosc2_getitem_bytes_ctx:
 5221|      2|    int32_t start, int32_t nbytes, void* dest, int32_t destsize) {
 5222|      2|  blosc_header header;
 5223|      2|  int result = getitem_read_header(src, srcsize, &header);
 5224|      2|  if (result < 0) {
  ------------------
  |  Branch (5224:7): [True: 0, False: 2]
  ------------------
 5225|      0|    return result;
 5226|      0|  }
 5227|       |
 5228|      2|  if (start < 0 || nbytes < 0) {
  ------------------
  |  Branch (5228:7): [True: 0, False: 2]
  |  Branch (5228:20): [True: 0, False: 2]
  ------------------
 5229|      0|    BLOSC_TRACE_ERROR("`start` and `nbytes` must not be negative.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 5230|      0|    return BLOSC2_ERROR_INVALID_PARAM;
 5231|      0|  }
 5232|       |
 5233|       |  /* The typesize a chunk records is 1 whenever the original one exceeded
 5234|       |     BLOSC_MAX_TYPESIZE, so for wide types this conversion is a no-op and the
 5235|       |     alignment check below is vacuous.  That is the whole point of this entry
 5236|       |     point: the caller never has to know whether the cap kicked in. */
 5237|      2|  int32_t typesize = header.typesize;
 5238|      2|  if ((start % typesize != 0) || (nbytes % typesize != 0)) {
  ------------------
  |  Branch (5238:7): [True: 0, False: 2]
  |  Branch (5238:34): [True: 0, False: 2]
  ------------------
 5239|      0|    BLOSC_TRACE_ERROR("`start` (%d) and `nbytes` (%d) must both be multiples of "
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 5240|      0|                      "the typesize stored in the chunk (%d).", start, nbytes, typesize);
 5241|      0|    return BLOSC2_ERROR_INVALID_PARAM;
 5242|      0|  }
 5243|       |
 5244|      2|  return getitem_with_header(context, &header, src, srcsize, start / typesize,
 5245|      2|                             nbytes / typesize, dest, destsize);
 5246|      2|}
blosc2_get_nthreads:
 6400|  3.71k|{
 6401|  3.71k|  int16_t nthreads;
 6402|  3.71k|  blosc2_init();
 6403|  3.71k|  blosc2_pthread_mutex_lock(&global_comp_mutex);
  ------------------
  |  |   92|  3.71k|#define blosc2_pthread_mutex_lock(a) pthread_mutex_lock((a))
  ------------------
 6404|  3.71k|  nthreads = g_nthreads;
 6405|  3.71k|  blosc2_pthread_mutex_unlock(&global_comp_mutex);
  ------------------
  |  |   93|  3.71k|#define blosc2_pthread_mutex_unlock(a) pthread_mutex_unlock((a))
  ------------------
 6406|  3.71k|  return nthreads;
 6407|  3.71k|}
blosc2_set_nthreads:
 6409|  1.96k|int16_t blosc2_set_nthreads(int16_t nthreads) {
 6410|  1.96k|  int16_t ret;          /* the previous number of threads */
 6411|       |
 6412|       |  /* Check whether the library should be initialized */
 6413|  1.96k|  blosc2_init();
 6414|       |
 6415|  1.96k|  blosc2_pthread_mutex_lock(&global_comp_mutex);
  ------------------
  |  |   92|  1.96k|#define blosc2_pthread_mutex_lock(a) pthread_mutex_lock((a))
  ------------------
 6416|  1.96k|  ret = g_nthreads;
 6417|  1.96k|  if (nthreads != ret) {
  ------------------
  |  Branch (6417:7): [True: 0, False: 1.96k]
  ------------------
 6418|      0|    int16_t old_new_nthreads = g_global_context->new_nthreads;
 6419|      0|    int16_t old_nthreads = g_global_context->nthreads;
 6420|      0|    g_nthreads = nthreads;
 6421|      0|    g_global_context->new_nthreads = nthreads;
 6422|      0|    int16_t ret2 = check_nthreads(g_global_context, true);
 6423|      0|    if (ret2 < 0) {
  ------------------
  |  Branch (6423:9): [True: 0, False: 0]
  ------------------
 6424|      0|      g_nthreads = ret;
 6425|      0|      g_global_context->new_nthreads = old_new_nthreads;
 6426|      0|      g_global_context->nthreads = old_nthreads;
 6427|      0|      check_nthreads(g_global_context, true);
 6428|      0|      blosc2_pthread_mutex_unlock(&global_comp_mutex);
  ------------------
  |  |   93|      0|#define blosc2_pthread_mutex_unlock(a) pthread_mutex_unlock((a))
  ------------------
 6429|      0|      return ret2;
 6430|      0|    }
 6431|      0|  }
 6432|  1.96k|  blosc2_pthread_mutex_unlock(&global_comp_mutex);
  ------------------
  |  |   93|  1.96k|#define blosc2_pthread_mutex_unlock(a) pthread_mutex_unlock((a))
  ------------------
 6433|       |
 6434|  1.96k|  return ret;
 6435|  1.96k|}
blosc2_cbuffer_sizes:
 6552|  35.4M|int blosc2_cbuffer_sizes(const void* cbuffer, int32_t* nbytes, int32_t* cbytes, int32_t* blocksize) {
 6553|  35.4M|  blosc_header header;
 6554|  35.4M|  int rc = read_chunk_header((uint8_t *) cbuffer, BLOSC_MIN_HEADER_LENGTH, false, &header);
 6555|  35.4M|  if (rc < 0) {
  ------------------
  |  Branch (6555:7): [True: 28, False: 35.4M]
  ------------------
 6556|       |    /* Return zeros if error reading header */
 6557|     28|    memset(&header, 0, sizeof(header));
 6558|     28|  }
 6559|       |
 6560|       |  /* Read the interesting values */
 6561|  35.4M|  if (nbytes != NULL)
  ------------------
  |  Branch (6561:7): [True: 35.4M, False: 2.42k]
  ------------------
 6562|  35.4M|    *nbytes = header.nbytes;
 6563|  35.4M|  if (cbytes != NULL)
  ------------------
  |  Branch (6563:7): [True: 35.4M, False: 70]
  ------------------
 6564|  35.4M|    *cbytes = header.cbytes;
 6565|  35.4M|  if (blocksize != NULL)
  ------------------
  |  Branch (6565:7): [True: 6.33k, False: 35.4M]
  ------------------
 6566|  6.33k|    *blocksize = header.blocksize;
 6567|  35.4M|  return rc;
 6568|  35.4M|}
blosc2_init:
 6758|  7.64k|void blosc2_init(void) {
 6759|       |  /* Return if Blosc is already initialized */
 6760|  7.64k|  if (load_acquire_int(&g_initlib) == BLOSC_STATE_INITIALIZED) return;
  ------------------
  |  |  142|  7.64k|#define load_acquire_int(p) __atomic_load_n((p), __ATOMIC_ACQUIRE)
  ------------------
                if (load_acquire_int(&g_initlib) == BLOSC_STATE_INITIALIZED) return;
  ------------------
  |  |  104|  7.64k|#define BLOSC_STATE_INITIALIZED   1
  ------------------
  |  Branch (6760:7): [True: 5.67k, False: 1.96k]
  ------------------
 6761|       |
 6762|  1.96k|#if !defined(_WIN32)
 6763|       |  /* Before g_init_lock is taken: from now on a fork() waits for it */
 6764|  1.96k|  pthread_once(&atfork_once, register_atfork);
 6765|  1.96k|#endif
 6766|  1.96k|  static_lock(&g_init_lock);
  ------------------
  |  |  132|  1.96k|#define static_lock(l) pthread_mutex_lock(l)
  ------------------
 6767|       |  /* Teardown drops this lock while joining prefetch workers.  Wait without
 6768|       |     holding it so the destroyer can finish; never reinitialize live globals. */
 6769|  1.96k|  while (g_initlib == BLOSC_STATE_TEARDOWN) {
  ------------------
  |  |  105|  1.96k|#define BLOSC_STATE_TEARDOWN      2
  ------------------
  |  Branch (6769:10): [True: 0, False: 1.96k]
  ------------------
 6770|       |#if defined(_WIN32)
 6771|       |    SleepConditionVariableSRW(&g_init_cv, &g_init_lock, INFINITE, 0);
 6772|       |#else
 6773|      0|    pthread_cond_wait(&g_init_cv, &g_init_lock);
 6774|      0|#endif
 6775|      0|  }
 6776|       |  /* Unless another thread initialized it meanwhile */
 6777|  1.96k|  if (g_initlib != BLOSC_STATE_INITIALIZED) {
  ------------------
  |  |  104|  1.96k|#define BLOSC_STATE_INITIALIZED   1
  ------------------
  |  Branch (6777:7): [True: 1.96k, False: 0]
  ------------------
 6778|  1.96k|    blosc2_init_locked();
 6779|  1.96k|  }
 6780|  1.96k|  static_unlock(&g_init_lock);
  ------------------
  |  |  133|  1.96k|#define static_unlock(l) pthread_mutex_unlock(l)
  ------------------
 6781|  1.96k|}
blosc2_tmp_malloc:
 6945|    784|void *blosc2_tmp_malloc(size_t nbytes, size_t *capacity) {
 6946|    784|  *capacity = nbytes;
 6947|    784|#if !defined(_WIN32)
 6948|    784|  tmp_cache_t *cache = nbytes >= BLOSC2_TMP_CACHE_MIN ? tmp_cache_get(false) : NULL;
  ------------------
  |  | 6812|    784|#define BLOSC2_TMP_CACHE_MIN (64 * 1024)
  ------------------
  |  Branch (6948:24): [True: 0, False: 784]
  ------------------
 6949|    784|  if (cache != NULL) {
  ------------------
  |  Branch (6949:7): [True: 0, False: 784]
  ------------------
 6950|       |    // The smallest buffer that fits, and not one far larger than needed
 6951|      0|    int best = -1;
 6952|      0|    for (int i = 0; i < BLOSC2_TMP_CACHE_SLOTS; ++i) {
  ------------------
  |  | 6811|      0|#define BLOSC2_TMP_CACHE_SLOTS 4
  ------------------
  |  Branch (6952:21): [True: 0, False: 0]
  ------------------
 6953|      0|      if (cache->ptr[i] != NULL && cache->size[i] >= nbytes && cache->size[i] / 2 <= nbytes &&
  ------------------
  |  Branch (6953:11): [True: 0, False: 0]
  |  Branch (6953:36): [True: 0, False: 0]
  |  Branch (6953:64): [True: 0, False: 0]
  ------------------
 6954|      0|          (best < 0 || cache->size[i] < cache->size[best])) {
  ------------------
  |  Branch (6954:12): [True: 0, False: 0]
  |  Branch (6954:24): [True: 0, False: 0]
  ------------------
 6955|      0|        best = i;
 6956|      0|      }
 6957|      0|    }
 6958|      0|    if (best >= 0) {
  ------------------
  |  Branch (6958:9): [True: 0, False: 0]
  ------------------
 6959|      0|      void *ptr = cache->ptr[best];
 6960|      0|      *capacity = cache->size[best];
 6961|      0|      cache->ptr[best] = NULL;
 6962|      0|      cache->size[best] = 0;
 6963|      0|      return ptr;
 6964|      0|    }
 6965|      0|  }
 6966|    784|#endif
 6967|    784|  return malloc(nbytes);
 6968|    784|}
blosc2_tmp_free:
 6970|  1.02k|void blosc2_tmp_free(void *ptr, size_t capacity) {
 6971|  1.02k|  if (ptr == NULL) {
  ------------------
  |  Branch (6971:7): [True: 243, False: 784]
  ------------------
 6972|    243|    return;
 6973|    243|  }
 6974|    784|#if !defined(_WIN32)
 6975|    784|  tmp_cache_t *cache = NULL;
 6976|    784|  if (capacity >= BLOSC2_TMP_CACHE_MIN && capacity <= BLOSC2_TMP_CACHE_MAX / 2) {
  ------------------
  |  | 6812|  1.56k|#define BLOSC2_TMP_CACHE_MIN (64 * 1024)
  ------------------
                if (capacity >= BLOSC2_TMP_CACHE_MIN && capacity <= BLOSC2_TMP_CACHE_MAX / 2) {
  ------------------
  |  | 6813|      0|#define BLOSC2_TMP_CACHE_MAX (64 * 1024 * 1024)
  ------------------
  |  Branch (6976:7): [True: 0, False: 784]
  |  Branch (6976:43): [True: 0, False: 0]
  ------------------
 6977|      0|    cache = tmp_cache_get(true);
 6978|      0|  }
 6979|    784|  if (cache != NULL) {
  ------------------
  |  Branch (6979:7): [True: 0, False: 784]
  ------------------
 6980|       |    // Make room by dropping the smallest buffers (each one smaller than this)
 6981|      0|    for (;;) {
 6982|      0|      size_t total = capacity;
 6983|      0|      int empty = -1;
 6984|      0|      int smallest = -1;
 6985|      0|      for (int i = 0; i < BLOSC2_TMP_CACHE_SLOTS; ++i) {
  ------------------
  |  | 6811|      0|#define BLOSC2_TMP_CACHE_SLOTS 4
  ------------------
  |  Branch (6985:23): [True: 0, False: 0]
  ------------------
 6986|      0|        if (cache->ptr[i] == NULL) {
  ------------------
  |  Branch (6986:13): [True: 0, False: 0]
  ------------------
 6987|      0|          empty = i;
 6988|      0|          continue;
 6989|      0|        }
 6990|      0|        total += cache->size[i];
 6991|      0|        if (smallest < 0 || cache->size[i] < cache->size[smallest]) {
  ------------------
  |  Branch (6991:13): [True: 0, False: 0]
  |  Branch (6991:29): [True: 0, False: 0]
  ------------------
 6992|      0|          smallest = i;
 6993|      0|        }
 6994|      0|      }
 6995|      0|      if (empty >= 0 && total <= BLOSC2_TMP_CACHE_MAX) {
  ------------------
  |  | 6813|      0|#define BLOSC2_TMP_CACHE_MAX (64 * 1024 * 1024)
  ------------------
  |  Branch (6995:11): [True: 0, False: 0]
  |  Branch (6995:25): [True: 0, False: 0]
  ------------------
 6996|      0|        cache->ptr[empty] = ptr;
 6997|      0|        cache->size[empty] = capacity;
 6998|      0|        return;
 6999|      0|      }
 7000|      0|      if (smallest < 0 || cache->size[smallest] >= capacity) {
  ------------------
  |  Branch (7000:11): [True: 0, False: 0]
  |  Branch (7000:27): [True: 0, False: 0]
  ------------------
 7001|      0|        break;
 7002|      0|      }
 7003|      0|      free(cache->ptr[smallest]);
 7004|      0|      cache->ptr[smallest] = NULL;
 7005|      0|      cache->size[smallest] = 0;
 7006|      0|    }
 7007|      0|  }
 7008|       |#else
 7009|       |  BLOSC_UNUSED_PARAM(capacity);
 7010|       |#endif
 7011|    784|  free(ptr);
 7012|    784|}
blosc2_tmp_cache_clear:
 7014|  3.93k|void blosc2_tmp_cache_clear(void) {
 7015|  3.93k|#if !defined(_WIN32)
 7016|  3.93k|  tmp_cache_t *cache = tmp_cache_get(false);
 7017|  3.93k|  if (cache != NULL) {
  ------------------
  |  Branch (7017:7): [True: 3.93k, False: 0]
  ------------------
 7018|  19.6k|    for (int i = 0; i < BLOSC2_TMP_CACHE_SLOTS; ++i) {
  ------------------
  |  | 6811|  19.6k|#define BLOSC2_TMP_CACHE_SLOTS 4
  ------------------
  |  Branch (7018:21): [True: 15.7k, False: 3.93k]
  ------------------
 7019|  15.7k|      free(cache->ptr[i]);
 7020|  15.7k|      cache->ptr[i] = NULL;
 7021|  15.7k|      cache->size[i] = 0;
 7022|  15.7k|    }
 7023|  3.93k|    if (cache->serial != NULL && !cache->serial_busy) {
  ------------------
  |  Branch (7023:9): [True: 906, False: 3.02k]
  |  Branch (7023:34): [True: 906, False: 0]
  ------------------
 7024|    906|      free_thread_context(cache->serial);
 7025|       |      cache->serial = NULL;
 7026|    906|    }
 7027|  3.93k|  }
 7028|  3.93k|#endif
 7029|  3.93k|}
blosc2_destroy:
 7067|  1.96k|void blosc2_destroy(void) {
 7068|       |  /* Return if Blosc is not initialized */
 7069|  1.96k|  if (load_acquire_int(&g_initlib) != BLOSC_STATE_INITIALIZED) return;
  ------------------
  |  |  142|  1.96k|#define load_acquire_int(p) __atomic_load_n((p), __ATOMIC_ACQUIRE)
  ------------------
                if (load_acquire_int(&g_initlib) != BLOSC_STATE_INITIALIZED) return;
  ------------------
  |  |  104|  1.96k|#define BLOSC_STATE_INITIALIZED   1
  ------------------
  |  Branch (7069:7): [True: 0, False: 1.96k]
  ------------------
 7070|       |
 7071|  1.96k|  static_lock(&g_init_lock);
  ------------------
  |  |  132|  1.96k|#define static_lock(l) pthread_mutex_lock(l)
  ------------------
 7072|  1.96k|  if (g_initlib != BLOSC_STATE_INITIALIZED) {
  ------------------
  |  |  104|  1.96k|#define BLOSC_STATE_INITIALIZED   1
  ------------------
  |  Branch (7072:7): [True: 0, False: 1.96k]
  ------------------
 7073|      0|    static_unlock(&g_init_lock);
  ------------------
  |  |  133|      0|#define static_unlock(l) pthread_mutex_unlock(l)
  ------------------
 7074|      0|    return;
 7075|      0|  }
 7076|  1.96k|  store_release_int(&g_initlib, BLOSC_STATE_TEARDOWN);
  ------------------
  |  |  143|  1.96k|#define store_release_int(p, v) __atomic_store_n((p), (v), __ATOMIC_RELEASE)
  ------------------
 7077|  1.96k|  static_unlock(&g_init_lock);
  ------------------
  |  |  133|  1.96k|#define static_unlock(l) pthread_mutex_unlock(l)
  ------------------
 7078|       |
 7079|       |  /* Not under g_init_lock: a fork() holds the read-ahead pool's lock while it
 7080|       |     waits for g_init_lock (prefetch.c registers its fork handlers later).
 7081|       |     New prefetch operations and threads are blocked by blosc2_is_initialized(). */
 7082|  1.96k|  prefetch_destroy();
 7083|       |
 7084|  1.96k|  static_lock(&g_init_lock);
  ------------------
  |  |  132|  1.96k|#define static_lock(l) pthread_mutex_lock(l)
  ------------------
 7085|  1.96k|  blosc2_destroy_locked();
 7086|  1.96k|  store_release_int(&g_initlib, BLOSC_STATE_UNINITIALIZED);
  ------------------
  |  |  143|  1.96k|#define store_release_int(p, v) __atomic_store_n((p), (v), __ATOMIC_RELEASE)
  ------------------
 7087|       |#if defined(_WIN32)
 7088|       |  WakeAllConditionVariable(&g_init_cv);
 7089|       |#else
 7090|  1.96k|  pthread_cond_broadcast(&g_init_cv);
 7091|  1.96k|#endif
 7092|  1.96k|  static_unlock(&g_init_lock);
  ------------------
  |  |  133|  1.96k|#define static_unlock(l) pthread_mutex_unlock(l)
  ------------------
 7093|  1.96k|}
blosc2_create_cctx:
 7099|  3.37k|blosc2_context* blosc2_create_cctx(blosc2_cparams cparams) {
 7100|  3.37k|  blosc2_context* context = (blosc2_context*)my_malloc(sizeof(blosc2_context));
 7101|  3.37k|  BLOSC_ERROR_NULL(context, NULL);
  ------------------
  |  |  104|  3.37k|    do {                                            \
  |  |  105|  3.37k|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 3.37k]
  |  |  ------------------
  |  |  106|      0|            BLOSC_TRACE_ERROR("Pointer is null");   \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  107|      0|            return (rc);                            \
  |  |  108|      0|        }                                           \
  |  |  109|  3.37k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 3.37k]
  |  |  ------------------
  ------------------
 7102|       |
 7103|       |  /* Populate the context, using zeros as default values */
 7104|  3.37k|  memset(context, 0, sizeof(blosc2_context));
 7105|       |  /* Early, so that the cleanup at `failed` can always destroy it */
 7106|  3.37k|  blosc2_pthread_mutex_init(&context->nchunk_mutex, NULL);
  ------------------
  |  |   90|  3.37k|#define blosc2_pthread_mutex_init(a, b) pthread_mutex_init((a), (b))
  ------------------
 7107|  3.37k|  context->do_compress = 1;   /* meant for compression */
 7108|  3.37k|  context->use_dict = cparams.use_dict;
 7109|  3.37k|  if (cparams.instr_codec) {
  ------------------
  |  Branch (7109:7): [True: 0, False: 3.37k]
  ------------------
 7110|      0|    context->blosc2_flags = BLOSC2_INSTR_CODEC;
 7111|      0|  }
 7112|       |
 7113|  23.5k|  for (int i = 0; i < BLOSC2_MAX_FILTERS; i++) {
  ------------------
  |  Branch (7113:19): [True: 20.2k, False: 3.36k]
  ------------------
 7114|  20.2k|    context->filters[i] = cparams.filters[i];
 7115|  20.2k|    context->filters_meta[i] = cparams.filters_meta[i];
 7116|       |
 7117|  20.2k|    if (context->filters[i] >= BLOSC_LAST_FILTER && context->filters[i] <= BLOSC2_DEFINED_FILTERS_STOP) {
  ------------------
  |  Branch (7117:9): [True: 503, False: 19.7k]
  |  Branch (7117:53): [True: 2, False: 501]
  ------------------
 7118|      2|      BLOSC_TRACE_ERROR("filter (%d) is not yet defined",
  ------------------
  |  |   93|      2|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      2|    do {                                            \
  |  |  |  |   98|      2|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      2|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 2, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      2|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 7119|      2|                        context->filters[i]);
 7120|      2|      goto failed;
 7121|      2|    }
 7122|  20.2k|    if (context->filters[i] > BLOSC_LAST_REGISTERED_FILTER && context->filters[i] <= BLOSC2_GLOBAL_REGISTERED_FILTERS_STOP) {
  ------------------
  |  Branch (7122:9): [True: 289, False: 19.9k]
  |  Branch (7122:63): [True: 3, False: 286]
  ------------------
 7123|      3|      BLOSC_TRACE_ERROR("filter (%d) is not yet defined",
  ------------------
  |  |   93|      3|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      3|    do {                                            \
  |  |  |  |   98|      3|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      3|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 3, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      3|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 7124|      3|                        context->filters[i]);
 7125|      3|      goto failed;
 7126|      3|    }
 7127|  20.2k|  }
 7128|       |
 7129|  3.36k|#if defined(HAVE_ZFP)
 7130|  3.36k|#include "blosc2/codecs-registry.h"
 7131|  3.36k|  if ((context->compcode >= BLOSC_CODEC_ZFP_FIXED_ACCURACY) && (context->compcode <= BLOSC_CODEC_ZFP_FIXED_RATE)) {
  ------------------
  |  Branch (7131:7): [True: 0, False: 3.36k]
  |  Branch (7131:64): [True: 0, False: 0]
  ------------------
 7132|      0|    for (int i = 0; i < BLOSC2_MAX_FILTERS; ++i) {
  ------------------
  |  Branch (7132:21): [True: 0, False: 0]
  ------------------
 7133|      0|      if ((context->filters[i] == BLOSC_SHUFFLE) || (context->filters[i] == BLOSC_BITSHUFFLE)) {
  ------------------
  |  Branch (7133:11): [True: 0, False: 0]
  |  Branch (7133:53): [True: 0, False: 0]
  ------------------
 7134|      0|        BLOSC_TRACE_ERROR("ZFP cannot be run in presence of SHUFFLE / BITSHUFFLE");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 7135|      0|        goto failed;
 7136|      0|      }
 7137|      0|    }
 7138|      0|  }
 7139|  3.36k|#endif /* HAVE_ZFP */
 7140|       |
 7141|       |  /* Check for a BLOSC_SHUFFLE environment variable */
 7142|  3.36k|  int doshuffle = -1;
 7143|  3.36k|  char* envvar = getenv("BLOSC_SHUFFLE");
 7144|  3.36k|  if (envvar != NULL) {
  ------------------
  |  Branch (7144:7): [True: 0, False: 3.36k]
  ------------------
 7145|      0|    if (strcmp(envvar, "NOSHUFFLE") == 0) {
  ------------------
  |  Branch (7145:9): [True: 0, False: 0]
  ------------------
 7146|      0|      doshuffle = BLOSC_NOSHUFFLE;
 7147|      0|    }
 7148|      0|    else if (strcmp(envvar, "SHUFFLE") == 0) {
  ------------------
  |  Branch (7148:14): [True: 0, False: 0]
  ------------------
 7149|      0|      doshuffle = BLOSC_SHUFFLE;
 7150|      0|    }
 7151|      0|    else if (strcmp(envvar, "BITSHUFFLE") == 0) {
  ------------------
  |  Branch (7151:14): [True: 0, False: 0]
  ------------------
 7152|      0|      doshuffle = BLOSC_BITSHUFFLE;
 7153|      0|    }
 7154|      0|    else {
 7155|      0|      BLOSC_TRACE_WARNING("BLOSC_SHUFFLE environment variable '%s' not recognized\n", envvar);
  ------------------
  |  |   94|      0|#define BLOSC_TRACE_WARNING(msg, ...) BLOSC_TRACE(warning, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 7156|      0|    }
 7157|      0|  }
 7158|       |  /* Check for a BLOSC_DELTA environment variable */
 7159|  3.36k|  int dodelta = BLOSC_NOFILTER;
 7160|  3.36k|  envvar = getenv("BLOSC_DELTA");
 7161|  3.36k|  if (envvar != NULL) {
  ------------------
  |  Branch (7161:7): [True: 0, False: 3.36k]
  ------------------
 7162|      0|    if (strcmp(envvar, "1") == 0) {
  ------------------
  |  Branch (7162:9): [True: 0, False: 0]
  ------------------
 7163|      0|      dodelta = BLOSC_DELTA;
 7164|      0|    } else if (strcmp(envvar, "0") == 0){
  ------------------
  |  Branch (7164:16): [True: 0, False: 0]
  ------------------
 7165|      0|      dodelta = BLOSC_NOFILTER;
 7166|      0|    }
 7167|      0|    else {
 7168|      0|      BLOSC_TRACE_WARNING("BLOSC_DELTA environment variable '%s' not recognized\n", envvar);
  ------------------
  |  |   94|      0|#define BLOSC_TRACE_WARNING(msg, ...) BLOSC_TRACE(warning, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 7169|      0|    }
 7170|      0|  }
 7171|       |  /* Check for a BLOSC_TYPESIZE environment variable */
 7172|  3.36k|  context->typesize = cparams.typesize;
 7173|  3.36k|  envvar = getenv("BLOSC_TYPESIZE");
 7174|  3.36k|  if (envvar != NULL) {
  ------------------
  |  Branch (7174:7): [True: 0, False: 3.36k]
  ------------------
 7175|      0|    int32_t value;
 7176|      0|    errno = 0; /* To distinguish success/failure after call */
 7177|      0|    value = (int32_t) strtol(envvar, NULL, 10);
 7178|      0|    if ((errno != EINVAL) && (value > 0)) {
  ------------------
  |  Branch (7178:9): [True: 0, False: 0]
  |  Branch (7178:30): [True: 0, False: 0]
  ------------------
 7179|      0|      context->typesize = value;
 7180|      0|    }
 7181|      0|    else {
 7182|      0|      BLOSC_TRACE_WARNING("BLOSC_TYPESIZE environment variable '%s' not recognized\n", envvar);
  ------------------
  |  |   94|      0|#define BLOSC_TRACE_WARNING(msg, ...) BLOSC_TRACE(warning, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 7183|      0|    }
 7184|      0|  }
 7185|  3.36k|  build_filters(doshuffle, dodelta, context->typesize, context->filters);
 7186|       |
 7187|  3.36k|  context->clevel = cparams.clevel;
 7188|       |  /* Check for a BLOSC_CLEVEL environment variable */
 7189|  3.36k|  envvar = getenv("BLOSC_CLEVEL");
 7190|  3.36k|  if (envvar != NULL) {
  ------------------
  |  Branch (7190:7): [True: 0, False: 3.36k]
  ------------------
 7191|      0|    int value;
 7192|      0|    errno = 0; /* To distinguish success/failure after call */
 7193|      0|    value = (int)strtol(envvar, NULL, 10);
 7194|      0|    if ((errno != EINVAL) && (value >= 0)) {
  ------------------
  |  Branch (7194:9): [True: 0, False: 0]
  |  Branch (7194:30): [True: 0, False: 0]
  ------------------
 7195|      0|      context->clevel = value;
 7196|      0|    }
 7197|      0|    else {
 7198|      0|      BLOSC_TRACE_WARNING("BLOSC_CLEVEL environment variable '%s' not recognized\n", envvar);
  ------------------
  |  |   94|      0|#define BLOSC_TRACE_WARNING(msg, ...) BLOSC_TRACE(warning, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 7199|      0|    }
 7200|      0|  }
 7201|       |
 7202|  3.36k|  context->compcode = cparams.compcode;
 7203|       |  /* Check for a BLOSC_COMPRESSOR environment variable */
 7204|  3.36k|  envvar = getenv("BLOSC_COMPRESSOR");
 7205|  3.36k|  if (envvar != NULL) {
  ------------------
  |  Branch (7205:7): [True: 0, False: 3.36k]
  ------------------
 7206|      0|    int codec = blosc2_compname_to_compcode(envvar);
 7207|      0|    if (codec >= BLOSC_LAST_CODEC) {
  ------------------
  |  Branch (7207:9): [True: 0, False: 0]
  ------------------
 7208|      0|      BLOSC_TRACE_ERROR("User defined codecs cannot be set here. Use Blosc2 mechanism instead.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 7209|      0|      goto failed;
 7210|      0|    }
 7211|      0|    context->compcode = codec;
 7212|      0|  }
 7213|  3.36k|  context->compcode_meta = cparams.compcode_meta;
 7214|       |
 7215|  3.36k|  context->blocksize = cparams.blocksize;
 7216|       |  /* Check for a BLOSC_BLOCKSIZE environment variable */
 7217|  3.36k|  envvar = getenv("BLOSC_BLOCKSIZE");
 7218|  3.36k|  if (envvar != NULL) {
  ------------------
  |  Branch (7218:7): [True: 0, False: 3.36k]
  ------------------
 7219|      0|    int32_t blocksize;
 7220|      0|    errno = 0; /* To distinguish success/failure after call */
 7221|      0|    blocksize = (int32_t) strtol(envvar, NULL, 10);
 7222|      0|    if ((errno != EINVAL) && (blocksize > 0)) {
  ------------------
  |  Branch (7222:9): [True: 0, False: 0]
  |  Branch (7222:30): [True: 0, False: 0]
  ------------------
 7223|      0|      context->blocksize = blocksize;
 7224|      0|    }
 7225|      0|    else {
 7226|      0|      BLOSC_TRACE_WARNING("BLOSC_BLOCKSIZE environment variable '%s' not recognized\n", envvar);
  ------------------
  |  |   94|      0|#define BLOSC_TRACE_WARNING(msg, ...) BLOSC_TRACE(warning, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 7227|      0|    }
 7228|      0|  }
 7229|       |
 7230|  3.36k|  context->nthreads = cparams.nthreads;
 7231|       |  /* Check for a BLOSC_NTHREADS environment variable */
 7232|  3.36k|  envvar = getenv("BLOSC_NTHREADS");
 7233|  3.36k|  if (envvar != NULL) {
  ------------------
  |  Branch (7233:7): [True: 0, False: 3.36k]
  ------------------
 7234|      0|    errno = 0; /* To distinguish success/failure after call */
 7235|      0|    int16_t nthreads = (int16_t) strtol(envvar, NULL, 10);
 7236|      0|    if ((errno != EINVAL) && (nthreads > 0)) {
  ------------------
  |  Branch (7236:9): [True: 0, False: 0]
  |  Branch (7236:30): [True: 0, False: 0]
  ------------------
 7237|      0|      context->nthreads = nthreads;
 7238|      0|    }
 7239|      0|    else {
 7240|      0|      BLOSC_TRACE_WARNING("BLOSC_NTHREADS environment variable '%s' not recognized\n", envvar);
  ------------------
  |  |   94|      0|#define BLOSC_TRACE_WARNING(msg, ...) BLOSC_TRACE(warning, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 7241|      0|    }
 7242|      0|  }
 7243|  3.36k|  context->new_nthreads = context->nthreads;
 7244|       |
 7245|  3.36k|  context->splitmode = cparams.splitmode;
 7246|       |  /* Check for a BLOSC_SPLITMODE environment variable */
 7247|  3.36k|  envvar = getenv("BLOSC_SPLITMODE");
 7248|  3.36k|  if (envvar != NULL) {
  ------------------
  |  Branch (7248:7): [True: 0, False: 3.36k]
  ------------------
 7249|      0|    int32_t splitmode = -1;
 7250|      0|    if (strcmp(envvar, "ALWAYS") == 0) {
  ------------------
  |  Branch (7250:9): [True: 0, False: 0]
  ------------------
 7251|      0|      splitmode = BLOSC_ALWAYS_SPLIT;
 7252|      0|    }
 7253|      0|    else if (strcmp(envvar, "NEVER") == 0) {
  ------------------
  |  Branch (7253:14): [True: 0, False: 0]
  ------------------
 7254|      0|      splitmode = BLOSC_NEVER_SPLIT;
 7255|      0|    }
 7256|      0|    else if (strcmp(envvar, "AUTO") == 0) {
  ------------------
  |  Branch (7256:14): [True: 0, False: 0]
  ------------------
 7257|      0|      splitmode = BLOSC_AUTO_SPLIT;
 7258|      0|    }
 7259|      0|    else if (strcmp(envvar, "FORWARD_COMPAT") == 0) {
  ------------------
  |  Branch (7259:14): [True: 0, False: 0]
  ------------------
 7260|      0|      splitmode = BLOSC_FORWARD_COMPAT_SPLIT;
 7261|      0|    }
 7262|      0|    else {
 7263|      0|      BLOSC_TRACE_WARNING("BLOSC_SPLITMODE environment variable '%s' not recognized\n", envvar);
  ------------------
  |  |   94|      0|#define BLOSC_TRACE_WARNING(msg, ...) BLOSC_TRACE(warning, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 7264|      0|    }
 7265|      0|    if (splitmode >= 0) {
  ------------------
  |  Branch (7265:9): [True: 0, False: 0]
  ------------------
 7266|      0|      context->splitmode = splitmode;
 7267|      0|    }
 7268|      0|  }
 7269|       |
 7270|  3.36k|  context->threads_started = 0;
 7271|  3.36k|  context->schunk = cparams.schunk;
 7272|       |
 7273|  3.36k|  if (cparams.prefilter != NULL) {
  ------------------
  |  Branch (7273:7): [True: 0, False: 3.36k]
  ------------------
 7274|      0|    context->prefilter = cparams.prefilter;
 7275|      0|    context->preparams = (blosc2_prefilter_params*)my_malloc(sizeof(blosc2_prefilter_params));
 7276|      0|    if (context->preparams == NULL) {
  ------------------
  |  Branch (7276:9): [True: 0, False: 0]
  ------------------
 7277|      0|      goto failed;
 7278|      0|    }
 7279|      0|    memcpy(context->preparams, cparams.preparams, sizeof(blosc2_prefilter_params));
 7280|      0|  }
 7281|       |
 7282|  3.36k|  if (cparams.tuner_id <= 0) {
  ------------------
  |  Branch (7282:7): [True: 3.36k, False: 0]
  ------------------
 7283|  3.36k|    cparams.tuner_id = g_tuner;
 7284|  3.36k|  } else {
 7285|      0|    for (int i = 0; i < g_ntuners; ++i) {
  ------------------
  |  Branch (7285:21): [True: 0, False: 0]
  ------------------
 7286|      0|      if (g_tuners[i].id == cparams.tuner_id) {
  ------------------
  |  Branch (7286:11): [True: 0, False: 0]
  ------------------
 7287|      0|        if (load_acquire_ptr(&g_tuners[i].init) == NULL) {
  ------------------
  |  |  144|      0|#define load_acquire_ptr(p) __atomic_load_n((p), __ATOMIC_ACQUIRE)
  ------------------
  |  Branch (7287:13): [True: 0, False: 0]
  ------------------
 7288|      0|          if (fill_tuner(&g_tuners[i]) < 0) {
  ------------------
  |  Branch (7288:15): [True: 0, False: 0]
  ------------------
 7289|      0|            BLOSC_TRACE_ERROR("Could not load tuner %d.", g_tuners[i].id);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 7290|      0|            goto failed;
 7291|      0|          }
 7292|      0|        }
 7293|      0|        if (g_tuners[i].init(cparams.tuner_params, context, NULL) < 0) {
  ------------------
  |  Branch (7293:13): [True: 0, False: 0]
  ------------------
 7294|      0|          BLOSC_TRACE_ERROR("Error in user-defined tuner %d init function\n", cparams.tuner_id);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 7295|      0|          goto failed;
 7296|      0|        }
 7297|      0|        goto urtunersuccess;
 7298|      0|      }
 7299|      0|    }
 7300|      0|    BLOSC_TRACE_ERROR("User-defined tuner %d not found\n", cparams.tuner_id);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 7301|      0|    goto failed;
 7302|      0|  }
 7303|  3.36k|  urtunersuccess:;
 7304|       |
 7305|  3.36k|  context->tuner_id = cparams.tuner_id;
 7306|       |
 7307|  3.36k|  context->codec_params = cparams.codec_params;
 7308|  3.36k|  memcpy(context->filter_params, cparams.filter_params, BLOSC2_MAX_FILTERS * sizeof(void*));
 7309|       |
 7310|  3.36k|  return context;
 7311|       |
 7312|      5|failed:
 7313|      5|  my_free(context->preparams);
 7314|      5|  blosc2_pthread_mutex_destroy(&context->nchunk_mutex);
  ------------------
  |  |   91|      5|#define blosc2_pthread_mutex_destroy(a) pthread_mutex_destroy((a))
  ------------------
 7315|      5|  my_free(context);
 7316|       |  return NULL;
 7317|  3.36k|}
blosc2_create_dctx:
 7320|  4.23k|blosc2_context* blosc2_create_dctx(blosc2_dparams dparams) {
 7321|  4.23k|  blosc2_context* context = (blosc2_context*)my_malloc(sizeof(blosc2_context));
 7322|  4.23k|  BLOSC_ERROR_NULL(context, NULL);
  ------------------
  |  |  104|  4.23k|    do {                                            \
  |  |  105|  4.23k|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 4.23k]
  |  |  ------------------
  |  |  106|      0|            BLOSC_TRACE_ERROR("Pointer is null");   \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  107|      0|            return (rc);                            \
  |  |  108|      0|        }                                           \
  |  |  109|  4.23k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 4.23k]
  |  |  ------------------
  ------------------
 7323|       |
 7324|       |  /* Populate the context, using zeros as default values */
 7325|  4.23k|  memset(context, 0, sizeof(blosc2_context));
 7326|  4.23k|  context->do_compress = 0;   /* Meant for decompression */
 7327|       |
 7328|  4.23k|  context->nthreads = dparams.nthreads;
 7329|  4.23k|  char* envvar = getenv("BLOSC_NTHREADS");
 7330|  4.23k|  if (envvar != NULL) {
  ------------------
  |  Branch (7330:7): [True: 0, False: 4.23k]
  ------------------
 7331|      0|    errno = 0; /* To distinguish success/failure after call */
 7332|      0|    long nthreads = strtol(envvar, NULL, 10);
 7333|      0|    if ((errno != EINVAL) && (nthreads > 0)) {
  ------------------
  |  Branch (7333:9): [True: 0, False: 0]
  |  Branch (7333:30): [True: 0, False: 0]
  ------------------
 7334|      0|      context->nthreads = (int16_t) nthreads;
 7335|      0|    }
 7336|      0|  }
 7337|  4.23k|  context->new_nthreads = context->nthreads;
 7338|       |
 7339|  4.23k|  context->threads_started = 0;
 7340|  4.23k|  context->block_maskout = NULL;
 7341|  4.23k|  context->block_maskout_nitems = 0;
 7342|  4.23k|  blosc2_pthread_mutex_init(&context->nchunk_mutex, NULL);
  ------------------
  |  |   90|  4.23k|#define blosc2_pthread_mutex_init(a, b) pthread_mutex_init((a), (b))
  ------------------
 7343|  4.23k|  context->schunk = dparams.schunk;
 7344|       |
 7345|  4.23k|  if (dparams.postfilter != NULL) {
  ------------------
  |  Branch (7345:7): [True: 0, False: 4.23k]
  ------------------
 7346|      0|    context->postfilter = dparams.postfilter;
 7347|      0|    context->postparams = (blosc2_postfilter_params*)my_malloc(sizeof(blosc2_postfilter_params));
 7348|      0|    if (context->postparams == NULL) {
  ------------------
  |  Branch (7348:9): [True: 0, False: 0]
  ------------------
 7349|      0|      blosc2_pthread_mutex_destroy(&context->nchunk_mutex);
  ------------------
  |  |   91|      0|#define blosc2_pthread_mutex_destroy(a) pthread_mutex_destroy((a))
  ------------------
 7350|      0|      my_free(context);
 7351|      0|      return NULL;
 7352|      0|    }
 7353|      0|    memcpy(context->postparams, dparams.postparams, sizeof(blosc2_postfilter_params));
 7354|      0|  }
 7355|       |
 7356|  4.23k|  return context;
 7357|  4.23k|}
blosc2_free_ctx:
 7360|  9.57k|void blosc2_free_ctx(blosc2_context* context) {
 7361|  9.57k|  if (load_acquire_int(&g_initlib) == BLOSC_STATE_INITIALIZED ||
  ------------------
  |  |  142|  9.57k|#define load_acquire_int(p) __atomic_load_n((p), __ATOMIC_ACQUIRE)
  ------------------
                if (load_acquire_int(&g_initlib) == BLOSC_STATE_INITIALIZED ||
  ------------------
  |  |  104|  19.1k|#define BLOSC_STATE_INITIALIZED   1
  ------------------
  |  Branch (7361:7): [True: 7.60k, False: 1.96k]
  ------------------
 7362|  1.96k|      context->thread_backend == BLOSC_BACKEND_PER_CONTEXT ||
  ------------------
  |  |   36|  11.5k|#define BLOSC_BACKEND_PER_CONTEXT 3   /* per-context threads; used on Windows */
  ------------------
  |  Branch (7362:7): [True: 0, False: 1.96k]
  ------------------
 7363|  7.60k|      context->thread_backend == BLOSC_BACKEND_CALLBACK) {
  ------------------
  |  |   35|  1.96k|#define BLOSC_BACKEND_CALLBACK 2
  ------------------
  |  Branch (7363:7): [True: 0, False: 1.96k]
  ------------------
 7364|  7.60k|    release_thread_backend(context);
 7365|  7.60k|  }
 7366|  9.57k|  if (context->serial_context != NULL) {
  ------------------
  |  Branch (7366:7): [True: 642, False: 8.92k]
  ------------------
 7367|    642|    free_thread_context(context->serial_context);
 7368|    642|  }
 7369|  9.57k|  blosc2_pthread_mutex_destroy(&context->nchunk_mutex);
  ------------------
  |  |   91|  9.57k|#define blosc2_pthread_mutex_destroy(a) pthread_mutex_destroy((a))
  ------------------
 7370|  9.57k|  release_context_dict_buffer(context);
 7371|  9.57k|  if (context->dict_cdict != NULL) {
  ------------------
  |  Branch (7371:7): [True: 0, False: 9.57k]
  ------------------
 7372|      0|    if (context->compcode == BLOSC_LZ4) {
  ------------------
  |  Branch (7372:9): [True: 0, False: 0]
  ------------------
 7373|      0|      LZ4_freeStream((LZ4_stream_t*)context->dict_cdict);
 7374|      0|    } else if (context->compcode == BLOSC_LZ4HC) {
  ------------------
  |  Branch (7374:16): [True: 0, False: 0]
  ------------------
 7375|      0|      LZ4_freeStreamHC((LZ4_streamHC_t*)context->dict_cdict);
 7376|      0|    }
 7377|      0|#ifdef HAVE_ZSTD
 7378|      0|    else if (context->compcode == BLOSC_ZSTD) {
  ------------------
  |  Branch (7378:14): [True: 0, False: 0]
  ------------------
 7379|      0|      ZSTD_freeCDict(context->dict_cdict);
 7380|      0|    }
 7381|      0|#endif
 7382|      0|  }
 7383|  9.57k|  if (context->dict_ddict != NULL) {
  ------------------
  |  Branch (7383:7): [True: 11, False: 9.55k]
  ------------------
 7384|     11|#ifdef HAVE_ZSTD
 7385|     11|    ZSTD_freeDDict(context->dict_ddict);
 7386|     11|#endif
 7387|     11|  }
 7388|  9.57k|  if (context->tuner_params != NULL) {
  ------------------
  |  Branch (7388:7): [True: 0, False: 9.57k]
  ------------------
 7389|      0|    int rc;
 7390|      0|    if (context->tuner_id < BLOSC_LAST_TUNER && context->tuner_id == BLOSC_STUNE) {
  ------------------
  |  |   26|      0|#define BLOSC_STUNE 0
  ------------------
  |  Branch (7390:9): [True: 0, False: 0]
  |  Branch (7390:49): [True: 0, False: 0]
  ------------------
 7391|      0|      rc = blosc_stune_free(context);
 7392|      0|    } else {
 7393|      0|      for (int i = 0; i < g_ntuners; ++i) {
  ------------------
  |  Branch (7393:23): [True: 0, False: 0]
  ------------------
 7394|      0|        if (g_tuners[i].id == context->tuner_id) {
  ------------------
  |  Branch (7394:13): [True: 0, False: 0]
  ------------------
 7395|      0|          if (load_acquire_ptr(&g_tuners[i].init) == NULL) {
  ------------------
  |  |  144|      0|#define load_acquire_ptr(p) __atomic_load_n((p), __ATOMIC_ACQUIRE)
  ------------------
  |  Branch (7395:15): [True: 0, False: 0]
  ------------------
 7396|      0|            if (fill_tuner(&g_tuners[i]) < 0) {
  ------------------
  |  Branch (7396:17): [True: 0, False: 0]
  ------------------
 7397|      0|              BLOSC_TRACE_ERROR("Could not load tuner %d.", g_tuners[i].id);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 7398|      0|              return;
 7399|      0|            }
 7400|      0|          }
 7401|      0|          rc = g_tuners[i].free(context);
 7402|      0|          goto urtunersuccess;
 7403|      0|        }
 7404|      0|      }
 7405|      0|      BLOSC_TRACE_ERROR("User-defined tuner %d not found\n", context->tuner_id);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 7406|      0|      return;
 7407|      0|      urtunersuccess:;
 7408|      0|    }
 7409|      0|    if (rc < 0) {
  ------------------
  |  Branch (7409:9): [True: 0, False: 0]
  ------------------
 7410|      0|      BLOSC_TRACE_ERROR("Error in user-defined tuner free function\n");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 7411|      0|      return;
 7412|      0|    }
 7413|      0|  }
 7414|       |  /* May be needed if codec_params ever contains nested objects
 7415|       |  if (context->codec_params != NULL) {
 7416|       |    int rc;
 7417|       |    for (int i = 0; i < g_ncodecs; ++i) {
 7418|       |      if (g_codecs[i].compcode == context->compcode) {
 7419|       |        if (g_codecs[i].free == NULL) {
 7420|       |          // Dynamically load codec plugin
 7421|       |          if (fill_codec(&g_codecs[i]) < 0) {
 7422|       |            BLOSC_TRACE_ERROR("Could not load codec %d.", g_codecs[i].compcode);
 7423|       |            return BLOSC2_ERROR_CODEC_SUPPORT;
 7424|       |          }
 7425|       |        }
 7426|       |        if (g_codecs[i].free == NULL){
 7427|       |          // no free func, codec_params is simple
 7428|       |          my_free(context->codec_params);
 7429|       |        }
 7430|       |        else{ // has free function for codec_params (e.g. openzl)
 7431|       |        rc = g_codecs[i].free(context->codec_params);
 7432|       |          goto urcodecsuccess;
 7433|       |        }
 7434|       |      }
 7435|       |    }
 7436|       |      BLOSC_TRACE_ERROR("User-defined compressor codec %d not found", context->compcode);
 7437|       |      return BLOSC2_ERROR_CODEC_SUPPORT;
 7438|       |    urcodecsuccess:;
 7439|       |    if (rc < 0) {
 7440|       |      BLOSC_TRACE_ERROR("Error in user-defined codec free function\n");
 7441|       |      return;
 7442|       |    }
 7443|       |  }
 7444|       |  */
 7445|  9.57k|  if (context->prefilter != NULL) {
  ------------------
  |  Branch (7445:7): [True: 0, False: 9.57k]
  ------------------
 7446|      0|    my_free(context->preparams);
 7447|      0|  }
 7448|  9.57k|  if (context->postfilter != NULL) {
  ------------------
  |  Branch (7448:7): [True: 0, False: 9.57k]
  ------------------
 7449|      0|    my_free(context->postparams);
 7450|      0|  }
 7451|       |
 7452|  9.57k|  if (context->block_maskout != NULL) {
  ------------------
  |  Branch (7452:7): [True: 0, False: 9.57k]
  ------------------
 7453|      0|    free(context->block_maskout);
 7454|      0|  }
 7455|  9.57k|  if (context->blocknbytes != NULL) {
  ------------------
  |  Branch (7455:7): [True: 46, False: 9.52k]
  ------------------
 7456|     46|    free(context->blocknbytes);
 7457|     46|  }
 7458|  9.57k|  if (context->blockoffsets != NULL) {
  ------------------
  |  Branch (7458:7): [True: 46, False: 9.52k]
  ------------------
 7459|     46|    free(context->blockoffsets);
 7460|     46|  }
 7461|  9.57k|  if (context->blockcbytes != NULL) {
  ------------------
  |  Branch (7461:7): [True: 46, False: 9.52k]
  ------------------
 7462|     46|    free(context->blockcbytes);
 7463|     46|  }
 7464|  9.57k|  my_free(context);
 7465|  9.57k|}
blosc2_ctx_get_cparams:
 7468|  1.56k|int blosc2_ctx_get_cparams(blosc2_context *ctx, blosc2_cparams *cparams) {
 7469|  1.56k|  cparams->compcode = ctx->compcode;
 7470|  1.56k|  cparams->compcode_meta = ctx->compcode_meta;
 7471|  1.56k|  cparams->clevel = ctx->clevel;
 7472|  1.56k|  cparams->use_dict = ctx->use_dict;
 7473|  1.56k|  cparams->instr_codec = ctx->blosc2_flags & BLOSC2_INSTR_CODEC;
 7474|  1.56k|  cparams->typesize = ctx->typesize;
 7475|  1.56k|  cparams->nthreads = ctx->nthreads;
 7476|  1.56k|  cparams->blocksize = ctx->blocksize;
 7477|  1.56k|  cparams->splitmode = ctx->splitmode;
 7478|  1.56k|  cparams->schunk = ctx->schunk;
 7479|  10.9k|  for (int i = 0; i < BLOSC2_MAX_FILTERS; ++i) {
  ------------------
  |  Branch (7479:19): [True: 9.40k, False: 1.56k]
  ------------------
 7480|  9.40k|    cparams->filters[i] = ctx->filters[i];
 7481|  9.40k|    cparams->filters_meta[i] = ctx->filters_meta[i];
 7482|  9.40k|  }
 7483|  1.56k|  cparams->prefilter = ctx->prefilter;
 7484|  1.56k|  cparams->preparams = ctx->preparams;
 7485|  1.56k|  cparams->tuner_id = ctx->tuner_id;
 7486|  1.56k|  cparams->codec_params = ctx->codec_params;
 7487|       |
 7488|  1.56k|  return BLOSC2_ERROR_SUCCESS;
 7489|  1.56k|}
blosc2_ctx_get_dparams:
 7492|  2.55k|int blosc2_ctx_get_dparams(blosc2_context *ctx, blosc2_dparams *dparams) {
 7493|  2.55k|  dparams->nthreads = ctx->nthreads;
 7494|  2.55k|  dparams->schunk = ctx->schunk;
 7495|  2.55k|  dparams->postfilter = ctx->postfilter;
 7496|  2.55k|  dparams->postparams = ctx->postparams;
 7497|  2.55k|  dparams->typesize = ctx->typesize;
 7498|       |
 7499|  2.55k|  return BLOSC2_ERROR_SUCCESS;
 7500|  2.55k|}
blosc2_set_maskout:
 7513|  1.12k|int blosc2_set_maskout(blosc2_context *ctx, bool *maskout, int nblocks) {
 7514|       |  // Get rid of a possible mask here (also if the allocation below fails)
 7515|  1.12k|  ctx_clear_maskout(ctx);
 7516|       |
 7517|  1.12k|  bool *maskout_ = malloc(nblocks);
 7518|  1.12k|  BLOSC_ERROR_NULL(maskout_, BLOSC2_ERROR_MEMORY_ALLOC);
  ------------------
  |  |  104|  1.12k|    do {                                            \
  |  |  105|  1.12k|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 1.12k]
  |  |  ------------------
  |  |  106|      0|            BLOSC_TRACE_ERROR("Pointer is null");   \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  107|      0|            return (rc);                            \
  |  |  108|      0|        }                                           \
  |  |  109|  1.12k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 1.12k]
  |  |  ------------------
  ------------------
 7519|  1.12k|  memcpy(maskout_, maskout, nblocks);
 7520|  1.12k|  ctx->block_maskout = maskout_;
 7521|  1.12k|  ctx->block_maskout_nitems = nblocks;
 7522|       |
 7523|  1.12k|  return 0;
 7524|  1.12k|}
blosc2_chunk_zeros:
 7528|    763|int blosc2_chunk_zeros(blosc2_cparams cparams, const int32_t nbytes, void* dest, int32_t destsize) {
 7529|    763|  if (destsize < BLOSC_EXTENDED_HEADER_LENGTH) {
  ------------------
  |  Branch (7529:7): [True: 0, False: 763]
  ------------------
 7530|      0|    BLOSC_TRACE_ERROR("dest buffer is not long enough");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 7531|      0|    return BLOSC2_ERROR_DATA;
 7532|      0|  }
 7533|       |
 7534|    763|  if ((nbytes > 0) && (nbytes % cparams.typesize)) {
  ------------------
  |  Branch (7534:7): [True: 763, False: 0]
  |  Branch (7534:23): [True: 0, False: 763]
  ------------------
 7535|      0|    BLOSC_TRACE_ERROR("nbytes must be a multiple of typesize");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 7536|      0|    return BLOSC2_ERROR_DATA;
 7537|      0|  }
 7538|       |
 7539|    763|  blosc_header header;
 7540|    763|  blosc2_context* context = blosc2_create_cctx(cparams);
 7541|    763|  if (context == NULL) {
  ------------------
  |  Branch (7541:7): [True: 0, False: 763]
  ------------------
 7542|      0|    BLOSC_TRACE_ERROR("Error while creating the compression context");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 7543|      0|    return BLOSC2_ERROR_NULL_POINTER;
 7544|      0|  }
 7545|       |
 7546|    763|  int error = initialize_context_compression(
 7547|    763|          context, NULL, nbytes, dest, destsize,
 7548|    763|          context->clevel, context->filters, context->filters_meta,
 7549|    763|          context->typesize, context->compcode, context->blocksize,
 7550|    763|          context->new_nthreads, context->nthreads, context->splitmode,
 7551|    763|          context->tuner_id, context->tuner_params, context->schunk);
 7552|    763|  if (error <= 0) {
  ------------------
  |  Branch (7552:7): [True: 0, False: 763]
  ------------------
 7553|      0|    blosc2_free_ctx(context);
 7554|      0|    return error;
 7555|      0|  }
 7556|       |
 7557|    763|  memset(&header, 0, sizeof(header));
 7558|    763|  header.version = BLOSC2_VERSION_FORMAT_STABLE;
 7559|    763|  header.versionlz = BLOSC_BLOSCLZ_VERSION_FORMAT;
 7560|    763|  header.flags = BLOSC_DOSHUFFLE | BLOSC_DOBITSHUFFLE;  // extended header
 7561|    763|  header.typesize = context->typesize;
 7562|    763|  header.nbytes = (int32_t)nbytes;
 7563|    763|  header.blocksize = context->blocksize;
 7564|    763|  header.cbytes = BLOSC_EXTENDED_HEADER_LENGTH;
 7565|    763|  header.blosc2_flags = BLOSC2_SPECIAL_ZERO << 4;  // mark chunk as all zeros
 7566|    763|  memcpy((uint8_t *)dest, &header, sizeof(header));
 7567|       |
 7568|    763|  blosc2_free_ctx(context);
 7569|       |
 7570|    763|  return BLOSC_EXTENDED_HEADER_LENGTH;
 7571|    763|}
blosc2_chunk_repeatval:
 7669|     70|                           void* dest, int32_t destsize, const void* repeatval) {
 7670|     70|  if (destsize < BLOSC_EXTENDED_HEADER_LENGTH + cparams.typesize) {
  ------------------
  |  Branch (7670:7): [True: 0, False: 70]
  ------------------
 7671|      0|    BLOSC_TRACE_ERROR("dest buffer is not long enough");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 7672|      0|    return BLOSC2_ERROR_DATA;
 7673|      0|  }
 7674|       |
 7675|     70|  if (nbytes % cparams.typesize) {
  ------------------
  |  Branch (7675:7): [True: 0, False: 70]
  ------------------
 7676|      0|    BLOSC_TRACE_ERROR("nbytes must be a multiple of typesize");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 7677|      0|    return BLOSC2_ERROR_DATA;
 7678|      0|  }
 7679|       |
 7680|     70|  blosc_header header;
 7681|     70|  blosc2_context* context = blosc2_create_cctx(cparams);
 7682|     70|  if (context == NULL) {
  ------------------
  |  Branch (7682:7): [True: 0, False: 70]
  ------------------
 7683|      0|    BLOSC_TRACE_ERROR("Error while creating the compression context");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 7684|      0|    return BLOSC2_ERROR_NULL_POINTER;
 7685|      0|  }
 7686|       |
 7687|     70|  int error = initialize_context_compression(
 7688|     70|          context, NULL, nbytes, dest, destsize,
 7689|     70|          context->clevel, context->filters, context->filters_meta,
 7690|     70|          context->typesize, context->compcode, context->blocksize,
 7691|     70|          context->new_nthreads, context->nthreads, context->splitmode,
 7692|     70|          context->tuner_id, context->tuner_params, context->schunk);
 7693|     70|  if (error <= 0) {
  ------------------
  |  Branch (7693:7): [True: 0, False: 70]
  ------------------
 7694|      0|    blosc2_free_ctx(context);
 7695|      0|    return error;
 7696|      0|  }
 7697|       |
 7698|     70|  memset(&header, 0, sizeof(header));
 7699|     70|  header.version = BLOSC2_VERSION_FORMAT_STABLE;
 7700|     70|  header.versionlz = BLOSC_BLOSCLZ_VERSION_FORMAT;
 7701|     70|  header.flags = BLOSC_DOSHUFFLE | BLOSC_DOBITSHUFFLE;  // extended header
 7702|     70|  header.typesize = context->typesize;
 7703|     70|  header.nbytes = (int32_t)nbytes;
 7704|     70|  header.blocksize = context->blocksize;
 7705|     70|  header.cbytes = BLOSC_EXTENDED_HEADER_LENGTH + cparams.typesize;
 7706|     70|  header.blosc2_flags = BLOSC2_SPECIAL_VALUE << 4;  // mark chunk as all repeated value
 7707|     70|  memcpy((uint8_t *)dest, &header, sizeof(header));
 7708|     70|  memcpy((uint8_t *)dest + sizeof(header), repeatval, cparams.typesize);
 7709|       |
 7710|     70|  blosc2_free_ctx(context);
 7711|       |
 7712|     70|  return BLOSC_EXTENDED_HEADER_LENGTH + cparams.typesize;
 7713|     70|}
register_filter_private:
 7718|  9.82k|int register_filter_private(blosc2_filter *filter) {
 7719|  9.82k|    BLOSC_ERROR_NULL(filter, BLOSC2_ERROR_INVALID_PARAM);
  ------------------
  |  |  104|  9.82k|    do {                                            \
  |  |  105|  9.82k|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 9.82k]
  |  |  ------------------
  |  |  106|      0|            BLOSC_TRACE_ERROR("Pointer is null");   \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  107|      0|            return (rc);                            \
  |  |  108|      0|        }                                           \
  |  |  109|  9.82k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 9.82k]
  |  |  ------------------
  ------------------
 7720|  9.82k|    if (g_nfilters == UINT8_MAX) {
  ------------------
  |  Branch (7720:9): [True: 0, False: 9.82k]
  ------------------
 7721|      0|        BLOSC_TRACE_ERROR("Can not register more filters");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 7722|      0|        return BLOSC2_ERROR_CODEC_SUPPORT;
 7723|      0|    }
 7724|  9.82k|    if (filter->id < BLOSC2_GLOBAL_REGISTERED_FILTERS_START) {
  ------------------
  |  Branch (7724:9): [True: 0, False: 9.82k]
  ------------------
 7725|      0|        BLOSC_TRACE_ERROR("The id must be greater or equal than %d", BLOSC2_GLOBAL_REGISTERED_FILTERS_START);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 7726|      0|        return BLOSC2_ERROR_FAILURE;
 7727|      0|    }
 7728|       |    /* This condition can never be fulfilled
 7729|       |    if (filter->id > BLOSC2_USER_REGISTERED_FILTERS_STOP) {
 7730|       |        BLOSC_TRACE_ERROR("The id must be less than or equal to %d", BLOSC2_USER_REGISTERED_FILTERS_STOP);
 7731|       |        return BLOSC2_ERROR_FAILURE;
 7732|       |    }
 7733|       |    */
 7734|       |
 7735|  29.4k|    for (uint64_t i = 0; i < g_nfilters; ++i) {
  ------------------
  |  Branch (7735:26): [True: 19.6k, False: 9.82k]
  ------------------
 7736|  19.6k|      if (g_filters[i].id == filter->id) {
  ------------------
  |  Branch (7736:11): [True: 0, False: 19.6k]
  ------------------
 7737|      0|        if (strcmp(g_filters[i].name, filter->name) != 0) {
  ------------------
  |  Branch (7737:13): [True: 0, False: 0]
  ------------------
 7738|      0|          BLOSC_TRACE_ERROR("The filter (ID: %d) plugin is already registered with name: %s."
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 7739|      0|                            "  Choose another one !", filter->id, g_filters[i].name);
 7740|      0|          return BLOSC2_ERROR_FAILURE;
 7741|      0|        }
 7742|      0|        else {
 7743|       |          // Already registered, so no more actions needed
 7744|      0|          return BLOSC2_ERROR_SUCCESS;
 7745|      0|        }
 7746|      0|      }
 7747|  19.6k|    }
 7748|       |
 7749|  9.82k|    blosc2_filter *filter_new = &g_filters[g_nfilters++];
 7750|  9.82k|    memcpy(filter_new, filter, sizeof(blosc2_filter));
 7751|       |
 7752|  9.82k|    return BLOSC2_ERROR_SUCCESS;
 7753|  9.82k|}
register_codec_private:
 7768|  17.6k|int register_codec_private(blosc2_codec *codec) {
 7769|  17.6k|    BLOSC_ERROR_NULL(codec, BLOSC2_ERROR_INVALID_PARAM);
  ------------------
  |  |  104|  17.6k|    do {                                            \
  |  |  105|  17.6k|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 17.6k]
  |  |  ------------------
  |  |  106|      0|            BLOSC_TRACE_ERROR("Pointer is null");   \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  107|      0|            return (rc);                            \
  |  |  108|      0|        }                                           \
  |  |  109|  17.6k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 17.6k]
  |  |  ------------------
  ------------------
 7770|  17.6k|    if (g_ncodecs == UINT8_MAX) {
  ------------------
  |  Branch (7770:9): [True: 0, False: 17.6k]
  ------------------
 7771|      0|      BLOSC_TRACE_ERROR("Can not register more codecs");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 7772|      0|      return BLOSC2_ERROR_CODEC_SUPPORT;
 7773|      0|    }
 7774|  17.6k|    if (codec->compcode < BLOSC2_GLOBAL_REGISTERED_CODECS_START) {
  ------------------
  |  Branch (7774:9): [True: 0, False: 17.6k]
  ------------------
 7775|      0|      BLOSC_TRACE_ERROR("The id must be greater or equal than %d", BLOSC2_GLOBAL_REGISTERED_CODECS_START);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 7776|      0|      return BLOSC2_ERROR_FAILURE;
 7777|      0|    }
 7778|       |    /* This condition can never be fulfilled
 7779|       |    if (codec->compcode > BLOSC2_USER_REGISTERED_CODECS_STOP) {
 7780|       |      BLOSC_TRACE_ERROR("The id must be less or equal to %d", BLOSC2_USER_REGISTERED_CODECS_STOP);
 7781|       |      return BLOSC2_ERROR_FAILURE;
 7782|       |    }
 7783|       |     */
 7784|       |
 7785|  88.4k|    for (int i = 0; i < g_ncodecs; ++i) {
  ------------------
  |  Branch (7785:21): [True: 70.7k, False: 17.6k]
  ------------------
 7786|  70.7k|      if (g_codecs[i].compcode == codec->compcode) {
  ------------------
  |  Branch (7786:11): [True: 0, False: 70.7k]
  ------------------
 7787|      0|        if (strcmp(g_codecs[i].compname, codec->compname) != 0) {
  ------------------
  |  Branch (7787:13): [True: 0, False: 0]
  ------------------
 7788|      0|          BLOSC_TRACE_ERROR("The codec (ID: %d) plugin is already registered with name: %s."
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 7789|      0|                            "  Choose another one !", codec->compcode, codec->compname);
 7790|      0|          return BLOSC2_ERROR_CODEC_PARAM;
 7791|      0|        }
 7792|      0|        else {
 7793|       |          // Already registered, so no more actions needed
 7794|      0|          return BLOSC2_ERROR_SUCCESS;
 7795|      0|        }
 7796|      0|      }
 7797|  70.7k|    }
 7798|       |
 7799|  17.6k|    blosc2_codec *codec_new = &g_codecs[g_ncodecs++];
 7800|  17.6k|    memcpy(codec_new, codec, sizeof(blosc2_codec));
 7801|       |
 7802|  17.6k|    return BLOSC2_ERROR_SUCCESS;
 7803|  17.6k|}
register_tuner_private:
 7818|  1.96k|int register_tuner_private(blosc2_tuner *tuner) {
 7819|  1.96k|  BLOSC_ERROR_NULL(tuner, BLOSC2_ERROR_INVALID_PARAM);
  ------------------
  |  |  104|  1.96k|    do {                                            \
  |  |  105|  1.96k|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 1.96k]
  |  |  ------------------
  |  |  106|      0|            BLOSC_TRACE_ERROR("Pointer is null");   \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  107|      0|            return (rc);                            \
  |  |  108|      0|        }                                           \
  |  |  109|  1.96k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 1.96k]
  |  |  ------------------
  ------------------
 7820|  1.96k|  if (g_ntuners == UINT8_MAX) {
  ------------------
  |  Branch (7820:7): [True: 0, False: 1.96k]
  ------------------
 7821|      0|    BLOSC_TRACE_ERROR("Can not register more tuners");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 7822|      0|    return BLOSC2_ERROR_CODEC_SUPPORT;
 7823|      0|  }
 7824|  1.96k|  if (tuner->id < BLOSC2_GLOBAL_REGISTERED_TUNER_START) {
  ------------------
  |  Branch (7824:7): [True: 0, False: 1.96k]
  ------------------
 7825|      0|    BLOSC_TRACE_ERROR("The id must be greater or equal than %d", BLOSC2_GLOBAL_REGISTERED_TUNER_START);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 7826|      0|    return BLOSC2_ERROR_FAILURE;
 7827|      0|  }
 7828|       |
 7829|  1.96k|  for (int i = 0; i < g_ntuners; ++i) {
  ------------------
  |  Branch (7829:19): [True: 0, False: 1.96k]
  ------------------
 7830|      0|    if (g_tuners[i].id == tuner->id) {
  ------------------
  |  Branch (7830:9): [True: 0, False: 0]
  ------------------
 7831|      0|      if (strcmp(g_tuners[i].name, tuner->name) != 0) {
  ------------------
  |  Branch (7831:11): [True: 0, False: 0]
  ------------------
 7832|      0|        BLOSC_TRACE_ERROR("The tuner (ID: %d) plugin is already registered with name: %s."
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 7833|      0|                          "  Choose another one !", tuner->id, g_tuners[i].name);
 7834|      0|        return BLOSC2_ERROR_FAILURE;
 7835|      0|      }
 7836|      0|      else {
 7837|       |        // Already registered, so no more actions needed
 7838|      0|        return BLOSC2_ERROR_SUCCESS;
 7839|      0|      }
 7840|      0|    }
 7841|      0|  }
 7842|       |
 7843|  1.96k|  blosc2_tuner *tuner_new = &g_tuners[g_ntuners++];
 7844|  1.96k|  memcpy(tuner_new, tuner, sizeof(blosc2_tuner));
 7845|       |
 7846|  1.96k|  return BLOSC2_ERROR_SUCCESS;
 7847|  1.96k|}
_blosc2_register_io_cb:
 7860|  3.93k|int _blosc2_register_io_cb(const blosc2_io_cb *io) {
 7861|       |
 7862|  5.89k|  for (uint64_t i = 0; i < g_nio; ++i) {
  ------------------
  |  Branch (7862:24): [True: 5.89k, False: 2]
  ------------------
 7863|  5.89k|    if (g_ios[i].id == io->id) {
  ------------------
  |  Branch (7863:9): [True: 3.92k, False: 1.96k]
  ------------------
 7864|  3.92k|      if (strcmp(g_ios[i].name, io->name) != 0) {
  ------------------
  |  Branch (7864:11): [True: 0, False: 3.92k]
  ------------------
 7865|      0|        BLOSC_TRACE_ERROR("The IO (ID: %d) plugin is already registered with name: %s."
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 7866|      0|                          "  Choose another one !", io->id, g_ios[i].name);
 7867|      0|        return BLOSC2_ERROR_PLUGIN_IO;
 7868|      0|      }
 7869|  3.92k|      else {
 7870|       |        // Already registered, so no more actions needed
 7871|  3.92k|        return BLOSC2_ERROR_SUCCESS;
 7872|  3.92k|      }
 7873|  3.92k|    }
 7874|  5.89k|  }
 7875|       |
 7876|      2|  blosc2_io_cb *io_new = &g_ios[g_nio++];
 7877|      2|  memcpy(io_new, io, sizeof(blosc2_io_cb));
 7878|       |
 7879|      2|  return BLOSC2_ERROR_SUCCESS;
 7880|  3.93k|}
blosc2_get_io_cb:
 7897|  12.1k|blosc2_io_cb *blosc2_get_io_cb(uint8_t id) {
 7898|       |  // If g_initlib is not set by blosc2_init() this function will try to read
 7899|       |  // uninitialized memory. We should therefore always return NULL in that case
 7900|  12.1k|  if (load_acquire_int(&g_initlib) != BLOSC_STATE_INITIALIZED) {
  ------------------
  |  |  142|  12.1k|#define load_acquire_int(p) __atomic_load_n((p), __ATOMIC_ACQUIRE)
  ------------------
                if (load_acquire_int(&g_initlib) != BLOSC_STATE_INITIALIZED) {
  ------------------
  |  |  104|  12.1k|#define BLOSC_STATE_INITIALIZED   1
  ------------------
  |  Branch (7900:7): [True: 0, False: 12.1k]
  ------------------
 7901|      0|    return NULL;
 7902|      0|  }
 7903|  12.1k|  for (uint64_t i = 0; i < g_nio; ++i) {
  ------------------
  |  Branch (7903:24): [True: 12.1k, False: 0]
  ------------------
 7904|  12.1k|    if (g_ios[i].id == id) {
  ------------------
  |  Branch (7904:9): [True: 12.1k, False: 0]
  ------------------
 7905|  12.1k|      return &g_ios[i];
 7906|  12.1k|    }
 7907|  12.1k|  }
 7908|      0|  if (id == BLOSC2_IO_FILESYSTEM) {
  ------------------
  |  Branch (7908:7): [True: 0, False: 0]
  ------------------
 7909|      0|    if (_blosc2_register_io_cb(&BLOSC2_IO_CB_DEFAULTS) < 0) {
  ------------------
  |  Branch (7909:9): [True: 0, False: 0]
  ------------------
 7910|      0|      BLOSC_TRACE_ERROR("Error registering the default IO API");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 7911|      0|      return NULL;
 7912|      0|    }
 7913|      0|    return blosc2_get_io_cb(id);
 7914|      0|  }
 7915|      0|  else if (id == BLOSC2_IO_FILESYSTEM_MMAP) {
  ------------------
  |  Branch (7915:12): [True: 0, False: 0]
  ------------------
 7916|      0|    if (_blosc2_register_io_cb(&BLOSC2_IO_CB_MMAP) < 0) {
  ------------------
  |  Branch (7916:9): [True: 0, False: 0]
  ------------------
 7917|      0|      BLOSC_TRACE_ERROR("Error registering the mmap IO API");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 7918|      0|      return NULL;
 7919|      0|    }
 7920|      0|    return blosc2_get_io_cb(id);
 7921|      0|  }
 7922|      0|  return NULL;
 7923|      0|}
blosc2_unidim_to_multidim:
 7925|  58.0k|void blosc2_unidim_to_multidim(uint8_t ndim, int64_t *shape, int64_t i, int64_t *index) {
 7926|  58.0k|  if (ndim == 0) {
  ------------------
  |  Branch (7926:7): [True: 0, False: 58.0k]
  ------------------
 7927|      0|    return;
 7928|      0|  }
 7929|  58.0k|  assert(ndim <= B2ND_MAX_DIM);
 7930|  58.0k|  int64_t strides[B2ND_MAX_DIM];
 7931|       |
 7932|  58.0k|  strides[ndim - 1] = 1;
 7933|   213k|  for (int j = ndim - 2; j >= 0; --j) {
  ------------------
  |  Branch (7933:26): [True: 155k, False: 58.0k]
  ------------------
 7934|   155k|      strides[j] = shape[j + 1] * strides[j + 1];
 7935|   155k|  }
 7936|       |
 7937|  58.0k|  index[0] = i / strides[0];
 7938|   213k|  for (int j = 1; j < ndim; ++j) {
  ------------------
  |  Branch (7938:19): [True: 155k, False: 58.0k]
  ------------------
 7939|   155k|      index[j] = (i % strides[j - 1]) / strides[j];
 7940|   155k|  }
 7941|  58.0k|}
blosc2_multidim_to_unidim:
 7943|  3.05k|void blosc2_multidim_to_unidim(const int64_t *index, int8_t ndim, const int64_t *strides, int64_t *i) {
 7944|  3.05k|  *i = 0;
 7945|  14.8k|  for (int j = 0; j < ndim; ++j) {
  ------------------
  |  Branch (7945:19): [True: 11.8k, False: 3.05k]
  ------------------
 7946|  11.8k|    *i += index[j] * strides[j];
 7947|  11.8k|  }
 7948|  3.05k|}
blosc2_error_string:
 7995|     32|const char *blosc2_error_string(int error_code) {
 7996|     32|  switch (error_code) {
 7997|     29|    case BLOSC2_ERROR_FAILURE:
  ------------------
  |  Branch (7997:5): [True: 29, False: 3]
  ------------------
 7998|     29|      return "Generic failure";
 7999|      0|    case BLOSC2_ERROR_STREAM:
  ------------------
  |  Branch (7999:5): [True: 0, False: 32]
  ------------------
 8000|      0|      return "Bad stream";
 8001|      3|    case BLOSC2_ERROR_DATA:
  ------------------
  |  Branch (8001:5): [True: 3, False: 29]
  ------------------
 8002|      3|      return "Invalid data";
 8003|      0|    case BLOSC2_ERROR_MEMORY_ALLOC:
  ------------------
  |  Branch (8003:5): [True: 0, False: 32]
  ------------------
 8004|      0|      return "Memory alloc/realloc failure";
 8005|      0|    case BLOSC2_ERROR_READ_BUFFER:
  ------------------
  |  Branch (8005:5): [True: 0, False: 32]
  ------------------
 8006|      0|      return "Not enough space to read";
 8007|      0|    case BLOSC2_ERROR_WRITE_BUFFER:
  ------------------
  |  Branch (8007:5): [True: 0, False: 32]
  ------------------
 8008|      0|      return "Not enough space to write";
 8009|      0|    case BLOSC2_ERROR_CODEC_SUPPORT:
  ------------------
  |  Branch (8009:5): [True: 0, False: 32]
  ------------------
 8010|      0|      return "Codec not supported";
 8011|      0|    case BLOSC2_ERROR_CODEC_PARAM:
  ------------------
  |  Branch (8011:5): [True: 0, False: 32]
  ------------------
 8012|      0|      return "Invalid parameter supplied to codec";
 8013|      0|    case BLOSC2_ERROR_CODEC_DICT:
  ------------------
  |  Branch (8013:5): [True: 0, False: 32]
  ------------------
 8014|      0|      return "Codec dictionary error";
 8015|      0|    case BLOSC2_ERROR_VERSION_SUPPORT:
  ------------------
  |  Branch (8015:5): [True: 0, False: 32]
  ------------------
 8016|      0|      return "Version not supported";
 8017|      0|    case BLOSC2_ERROR_INVALID_HEADER:
  ------------------
  |  Branch (8017:5): [True: 0, False: 32]
  ------------------
 8018|      0|      return "Invalid value in header";
 8019|      0|    case BLOSC2_ERROR_INVALID_PARAM:
  ------------------
  |  Branch (8019:5): [True: 0, False: 32]
  ------------------
 8020|      0|      return "Invalid parameter supplied to function";
 8021|      0|    case BLOSC2_ERROR_FILE_READ:
  ------------------
  |  Branch (8021:5): [True: 0, False: 32]
  ------------------
 8022|      0|      return "File read failure";
 8023|      0|    case BLOSC2_ERROR_FILE_WRITE:
  ------------------
  |  Branch (8023:5): [True: 0, False: 32]
  ------------------
 8024|      0|      return "File write failure";
 8025|      0|    case BLOSC2_ERROR_FILE_OPEN:
  ------------------
  |  Branch (8025:5): [True: 0, False: 32]
  ------------------
 8026|      0|      return "File open failure";
 8027|      0|    case BLOSC2_ERROR_NOT_FOUND:
  ------------------
  |  Branch (8027:5): [True: 0, False: 32]
  ------------------
 8028|      0|      return "Not found";
 8029|      0|    case BLOSC2_ERROR_RUN_LENGTH:
  ------------------
  |  Branch (8029:5): [True: 0, False: 32]
  ------------------
 8030|      0|      return "Bad run length encoding";
 8031|      0|    case BLOSC2_ERROR_FILTER_PIPELINE:
  ------------------
  |  Branch (8031:5): [True: 0, False: 32]
  ------------------
 8032|      0|      return "Filter pipeline error";
 8033|      0|    case BLOSC2_ERROR_CHUNK_INSERT:
  ------------------
  |  Branch (8033:5): [True: 0, False: 32]
  ------------------
 8034|      0|      return "Chunk insert failure";
 8035|      0|    case BLOSC2_ERROR_CHUNK_APPEND:
  ------------------
  |  Branch (8035:5): [True: 0, False: 32]
  ------------------
 8036|      0|      return "Chunk append failure";
 8037|      0|    case BLOSC2_ERROR_CHUNK_UPDATE:
  ------------------
  |  Branch (8037:5): [True: 0, False: 32]
  ------------------
 8038|      0|      return "Chunk update failure";
 8039|      0|    case BLOSC2_ERROR_2GB_LIMIT:
  ------------------
  |  Branch (8039:5): [True: 0, False: 32]
  ------------------
 8040|      0|      return "Sizes larger than 2gb not supported";
 8041|      0|    case BLOSC2_ERROR_SCHUNK_COPY:
  ------------------
  |  Branch (8041:5): [True: 0, False: 32]
  ------------------
 8042|      0|      return "Super-chunk copy failure";
 8043|      0|    case BLOSC2_ERROR_FRAME_TYPE:
  ------------------
  |  Branch (8043:5): [True: 0, False: 32]
  ------------------
 8044|      0|      return "Wrong type for frame";
 8045|      0|    case BLOSC2_ERROR_FILE_TRUNCATE:
  ------------------
  |  Branch (8045:5): [True: 0, False: 32]
  ------------------
 8046|      0|      return "File truncate failure";
 8047|      0|    case BLOSC2_ERROR_LOCK:
  ------------------
  |  Branch (8047:5): [True: 0, False: 32]
  ------------------
 8048|      0|      return "Frame lock failure";
 8049|      0|    case BLOSC2_ERROR_THREAD_CREATE:
  ------------------
  |  Branch (8049:5): [True: 0, False: 32]
  ------------------
 8050|      0|      return "Thread or thread context creation failure";
 8051|      0|    case BLOSC2_ERROR_POSTFILTER:
  ------------------
  |  Branch (8051:5): [True: 0, False: 32]
  ------------------
 8052|      0|      return "Postfilter failure";
 8053|      0|    case BLOSC2_ERROR_FRAME_SPECIAL:
  ------------------
  |  Branch (8053:5): [True: 0, False: 32]
  ------------------
 8054|      0|      return "Special frame failure";
 8055|      0|    case BLOSC2_ERROR_SCHUNK_SPECIAL:
  ------------------
  |  Branch (8055:5): [True: 0, False: 32]
  ------------------
 8056|      0|      return "Special super-chunk failure";
 8057|      0|    case BLOSC2_ERROR_PLUGIN_IO:
  ------------------
  |  Branch (8057:5): [True: 0, False: 32]
  ------------------
 8058|      0|      return "IO plugin error";
 8059|      0|    case BLOSC2_ERROR_FILE_REMOVE:
  ------------------
  |  Branch (8059:5): [True: 0, False: 32]
  ------------------
 8060|      0|      return "Remove file failure";
 8061|      0|    case BLOSC2_ERROR_NULL_POINTER:
  ------------------
  |  Branch (8061:5): [True: 0, False: 32]
  ------------------
 8062|      0|      return "Pointer is null";
 8063|      0|    case BLOSC2_ERROR_INVALID_INDEX:
  ------------------
  |  Branch (8063:5): [True: 0, False: 32]
  ------------------
 8064|      0|      return "Invalid index";
 8065|      0|    case BLOSC2_ERROR_METALAYER_NOT_FOUND:
  ------------------
  |  Branch (8065:5): [True: 0, False: 32]
  ------------------
 8066|      0|      return "Metalayer has not been found";
 8067|      0|    case BLOSC2_ERROR_MAX_BUFSIZE_EXCEEDED:
  ------------------
  |  Branch (8067:5): [True: 0, False: 32]
  ------------------
 8068|      0|      return "Maximum buffersize exceeded";
 8069|      0|    case BLOSC2_ERROR_TUNER:
  ------------------
  |  Branch (8069:5): [True: 0, False: 32]
  ------------------
 8070|      0|      return "Tuner failure";
 8071|      0|    default:
  ------------------
  |  Branch (8071:5): [True: 0, False: 32]
  ------------------
 8072|      0|      return "Unknown error";
 8073|     32|  }
 8074|     32|}
blosc2.c:shuffle_size:
  791|  30.6k|static int32_t shuffle_size(const blosc2_context* context, int i) {
  792|  30.6k|  return context->filters_meta[i] == 0 ? context->typesize : context->filters_meta[i];
  ------------------
  |  Branch (792:10): [True: 14.8k, False: 15.7k]
  ------------------
  793|  30.6k|}
blosc2.c:flags_to_filters:
  875|  35.4M|static void flags_to_filters(const uint8_t flags, uint8_t* filters) {
  876|       |  /* Initialize the filter pipeline */
  877|  35.4M|  memset(filters, 0, BLOSC2_MAX_FILTERS);
  878|       |  /* Fill the filter pipeline */
  879|  35.4M|  if (flags & BLOSC_DOSHUFFLE)
  ------------------
  |  Branch (879:7): [True: 35.4M, False: 5.37k]
  ------------------
  880|  35.4M|    filters[BLOSC2_MAX_FILTERS - 1] = BLOSC_SHUFFLE;
  881|  35.4M|  if (flags & BLOSC_DOBITSHUFFLE)
  ------------------
  |  Branch (881:7): [True: 35.4M, False: 4.20k]
  ------------------
  882|  35.4M|    filters[BLOSC2_MAX_FILTERS - 1] = BLOSC_BITSHUFFLE;
  883|  35.4M|  if (flags & BLOSC_DODELTA)
  ------------------
  |  Branch (883:7): [True: 35.0M, False: 364k]
  ------------------
  884|  35.0M|    filters[BLOSC2_MAX_FILTERS - 2] = BLOSC_DELTA;
  885|  35.4M|}
blosc2.c:load_codec_locked:
 1155|      4|static int load_codec_locked(blosc2_codec *codec) {
 1156|      4|  char libpath[PATH_MAX];
 1157|      4|  void *lib = load_lib(codec->compname, libpath);
 1158|      4|  if(lib == NULL) {
  ------------------
  |  Branch (1158:6): [True: 4, False: 0]
  ------------------
 1159|      4|    BLOSC_TRACE_ERROR("Error while loading the library for codec `%s`", codec->compname);
  ------------------
  |  |   93|      4|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      4|    do {                                            \
  |  |  |  |   98|      4|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      4|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 4, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      4|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1160|      4|    return BLOSC2_ERROR_FAILURE;
 1161|      4|  }
 1162|       |
 1163|      0|  codec_info *info = dlsym(lib, "info");
 1164|      0|  if (info == NULL) {
  ------------------
  |  Branch (1164:7): [True: 0, False: 0]
  ------------------
 1165|      0|    BLOSC_TRACE_ERROR("`info` symbol cannot be loaded from plugin `%s`", codec->compname);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1166|      0|    dlclose(lib);
 1167|      0|    return BLOSC2_ERROR_FAILURE;
 1168|      0|  }
 1169|      0|  void *encoder = plugin_dlsym(lib, info->encoder);
 1170|      0|  void *decoder = plugin_dlsym(lib, info->decoder);
 1171|       |
 1172|      0|  if (encoder == NULL || decoder == NULL) {
  ------------------
  |  Branch (1172:7): [True: 0, False: 0]
  |  Branch (1172:26): [True: 0, False: 0]
  ------------------
 1173|      0|    BLOSC_TRACE_ERROR("encoder or decoder cannot be loaded from plugin `%s`", codec->compname);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1174|      0|    dlclose(lib);
 1175|      0|    return BLOSC2_ERROR_FAILURE;
 1176|      0|  }
 1177|      0|  codec->encoder = encoder;
 1178|      0|  store_release_ptr(&codec->decoder, decoder);
  ------------------
  |  |  145|      0|#define store_release_ptr(p, v) __atomic_store_n((p), (v), __ATOMIC_RELEASE)
  ------------------
 1179|       |
 1180|       |  /* If ever add .free function in future for codec params
 1181|       |  codecparams_info *info2 = dlsym(lib, "info2");
 1182|       |  if (info2 != NULL) {
 1183|       |    // New plugin (e.g. openzl) with free function for codec_params defined
 1184|       |    // will be used when destroying context in blosc2_free_ctx
 1185|       |      codec->free = dlsym(lib, info2->free);
 1186|       |  }
 1187|       |  else{
 1188|       |    codec->free = NULL;
 1189|       |  }
 1190|       |  */
 1191|       |
 1192|      0|  return BLOSC2_ERROR_SUCCESS;
 1193|      0|}
blosc2.c:_cycle_buffers_forward:
 1311|  14.4k|                                   const uint8_t *input) {
 1312|  14.4k|  uint8_t *prev_src = *src;
 1313|  14.4k|  *src = *dest;
 1314|  14.4k|  *dest = (prev_src == input) ? *tmp : prev_src;
  ------------------
  |  Branch (1314:11): [True: 7.95k, False: 6.52k]
  ------------------
 1315|  14.4k|}
blosc2.c:fused_shuffle_bytedelta_size:
  799|  20.5k|static int fused_shuffle_bytedelta_size(const blosc2_context *context, int i) {
  800|  20.5k|  if (i < 0 || i + 1 >= BLOSC2_MAX_FILTERS || context->filters[i] != BLOSC_SHUFFLE ||
  ------------------
  |  Branch (800:7): [True: 170, False: 20.3k]
  |  Branch (800:16): [True: 7.96k, False: 12.3k]
  |  Branch (800:47): [True: 12.0k, False: 318]
  ------------------
  801|  20.3k|      context->filters[i + 1] != BLOSC_FILTER_BYTEDELTA) {
  ------------------
  |  Branch (801:7): [True: 165, False: 153]
  ------------------
  802|  20.3k|    return 0;
  803|  20.3k|  }
  804|    153|  int delta_size = context->filters_meta[i + 1];
  805|    153|  if (delta_size == 0 && context->schunk != NULL) {
  ------------------
  |  Branch (805:7): [True: 6, False: 147]
  |  Branch (805:26): [True: 0, False: 6]
  ------------------
  806|      0|    delta_size = context->schunk->typesize;
  807|      0|  }
  808|    153|  int size = shuffle_size(context, i);
  809|    153|  return (size == 2 || size == 4 || size == 8) && size == delta_size &&
  ------------------
  |  Branch (809:11): [True: 37, False: 116]
  |  Branch (809:24): [True: 33, False: 83]
  |  Branch (809:37): [True: 42, False: 41]
  |  Branch (809:51): [True: 80, False: 32]
  ------------------
  810|     80|         shuffle_bytedelta_available() ? size : 0;
  ------------------
  |  Branch (810:10): [True: 80, False: 0]
  ------------------
  811|  20.5k|}
blosc2.c:bitshuffle_scratch:
 1322|  7.31k|static uint8_t* bitshuffle_scratch(struct thread_context* thread_context, int32_t bsize) {
 1323|  7.31k|  size_t offset = (size_t)(thread_context->tmp4 - thread_context->tmp);
 1324|  7.31k|  size_t shift = (16 - ((uintptr_t)thread_context->tmp4 & 15)) & 15;
 1325|  7.31k|  if (offset + shift + (size_t)bsize <= thread_context->tmp_nbytes) {
  ------------------
  |  Branch (1325:7): [True: 7.27k, False: 43]
  ------------------
 1326|  7.27k|    return thread_context->tmp4 + shift;
 1327|  7.27k|  }
 1328|     43|  if (offset + (size_t)bsize <= thread_context->tmp_nbytes) {
  ------------------
  |  Branch (1328:7): [True: 43, False: 0]
  ------------------
 1329|     43|    return thread_context->tmp4;
 1330|     43|  }
 1331|      0|  return NULL;
 1332|     43|}
blosc2.c:destroy_thread_context:
 2689|  1.56k|static void destroy_thread_context(struct thread_context* thread_context) {
 2690|  1.56k|  my_free(thread_context->tmp);
 2691|  1.56k|  free(thread_context->blosclz_state);
 2692|  1.56k|#if defined(HAVE_ZSTD)
 2693|  1.56k|  if (thread_context->zstd_cctx != NULL) {
  ------------------
  |  Branch (2693:7): [True: 28, False: 1.53k]
  ------------------
 2694|     28|    ZSTD_freeCCtx(thread_context->zstd_cctx);
 2695|     28|  }
 2696|  1.56k|  if (thread_context->zstd_dctx != NULL) {
  ------------------
  |  Branch (2696:7): [True: 404, False: 1.16k]
  ------------------
 2697|    404|    ZSTD_freeDCtx(thread_context->zstd_dctx);
 2698|    404|  }
 2699|  1.56k|#endif
 2700|  1.56k|  if (thread_context->lz4_cstream != NULL) {
  ------------------
  |  Branch (2700:7): [True: 5, False: 1.56k]
  ------------------
 2701|      5|    LZ4_freeStream((LZ4_stream_t*)thread_context->lz4_cstream);
 2702|      5|  }
 2703|  1.56k|  if (thread_context->lz4hc_cstream != NULL) {
  ------------------
  |  Branch (2703:7): [True: 0, False: 1.56k]
  ------------------
 2704|      0|    LZ4_freeStreamHC((LZ4_streamHC_t*)thread_context->lz4hc_cstream);
 2705|      0|  }
 2706|  1.56k|}
blosc2.c:my_free:
  412|  12.7k|static void my_free(void* block) {
  413|       |#if defined(_WIN32)
  414|       |  _aligned_free(block);
  415|       |#else
  416|  12.7k|  free(block);
  417|  12.7k|#endif  /* _WIN32 */
  418|  12.7k|}
blosc2.c:initialize_context_compression:
 2879|  2.05k|        blosc2_schunk* schunk) {
 2880|       |
 2881|       |  /* The block size and the filters divide by the typesize */
 2882|  2.05k|  if (typesize <= 0) {
  ------------------
  |  Branch (2882:7): [True: 0, False: 2.05k]
  ------------------
 2883|      0|    BLOSC_TRACE_ERROR("The typesize must be positive, not %d.", typesize);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2884|      0|    return BLOSC2_ERROR_INVALID_PARAM;
 2885|      0|  }
 2886|       |
 2887|       |  /* Check typesize limits */
 2888|  2.05k|  if (typesize > BLOSC2_MAXTYPESIZE) {
  ------------------
  |  Branch (2888:7): [True: 0, False: 2.05k]
  ------------------
 2889|       |    // If typesize is too large for Blosc2, return an error
 2890|      0|    BLOSC_TRACE_ERROR("Typesize cannot exceed %d bytes.", BLOSC2_MAXTYPESIZE);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2891|      0|    return BLOSC2_ERROR_INVALID_PARAM;
 2892|      0|  }
 2893|       |  /* Now, cap typesize so that blosc2 split machinery can continue to work.  This has to be
 2894|       |     done before the tuner chooses the block size, which depends on the typesize: a buffer
 2895|       |     with a larger typesize is a plain stream of bytes and is blocked as one. */
 2896|  2.05k|  if (typesize > BLOSC_MAX_TYPESIZE) {
  ------------------
  |  Branch (2896:7): [True: 0, False: 2.05k]
  ------------------
 2897|       |    /* If typesize is too large, treat buffer as an 1-byte stream. */
 2898|      0|    typesize = 1;
 2899|      0|  }
 2900|       |
 2901|       |  /* Set parameters */
 2902|  2.05k|  context->do_compress = 1;
 2903|  2.05k|  context->src = (const uint8_t*)src;
 2904|  2.05k|  context->srcsize = srcsize;
 2905|  2.05k|  context->dest = (uint8_t*)dest;
 2906|  2.05k|  context->output_bytes = 0;
 2907|  2.05k|  context->destsize = destsize;
 2908|  2.05k|  context->sourcesize = srcsize;
 2909|  2.05k|  context->typesize = typesize;
 2910|  2.05k|  context->filter_flags = filters_to_flags(filters);
 2911|  14.3k|  for (int i = 0; i < BLOSC2_MAX_FILTERS; i++) {
  ------------------
  |  Branch (2911:19): [True: 12.3k, False: 2.05k]
  ------------------
 2912|  12.3k|    context->filters[i] = filters[i];
 2913|  12.3k|    context->filters_meta[i] = filters_meta[i];
 2914|  12.3k|  }
 2915|  2.05k|  context->compcode = compressor;
 2916|  2.05k|  context->nthreads = nthreads;
 2917|  2.05k|  context->new_nthreads = new_nthreads;
 2918|  2.05k|  context->clevel = clevel;
 2919|  2.05k|  context->schunk = schunk;
 2920|  2.05k|  context->tuner_params = tuner_params;
 2921|  2.05k|  context->tuner_id = tuner_id;
 2922|  2.05k|  context->splitmode = splitmode;
 2923|  2.05k|  context->blosc2_flags2 = 0;
 2924|  2.05k|  if (context->blocknbytes != NULL) {
  ------------------
  |  Branch (2924:7): [True: 0, False: 2.05k]
  ------------------
 2925|      0|    free(context->blocknbytes);
 2926|      0|    context->blocknbytes = NULL;
 2927|      0|  }
 2928|  2.05k|  if (context->blockoffsets != NULL) {
  ------------------
  |  Branch (2928:7): [True: 0, False: 2.05k]
  ------------------
 2929|      0|    free(context->blockoffsets);
 2930|      0|    context->blockoffsets = NULL;
 2931|      0|  }
 2932|  2.05k|  if (context->blockcbytes != NULL) {
  ------------------
  |  Branch (2932:7): [True: 0, False: 2.05k]
  ------------------
 2933|      0|    free(context->blockcbytes);
 2934|      0|    context->blockcbytes = NULL;
 2935|      0|  }
 2936|  2.05k|  context->vlblock_sources = NULL;
 2937|  2.05k|  context->vlblock_dests = NULL;
 2938|       |  /* tuner some compression parameters */
 2939|  2.05k|  context->blocksize = (int32_t)blocksize;
 2940|  2.05k|  int rc = 0;
 2941|  2.05k|  if (context->tuner_params != NULL) {
  ------------------
  |  Branch (2941:7): [True: 0, False: 2.05k]
  ------------------
 2942|      0|    if (context->tuner_id < BLOSC_LAST_TUNER && context->tuner_id == BLOSC_STUNE) {
  ------------------
  |  |   26|      0|#define BLOSC_STUNE 0
  ------------------
  |  Branch (2942:9): [True: 0, False: 0]
  |  Branch (2942:49): [True: 0, False: 0]
  ------------------
 2943|      0|      if (blosc_stune_next_cparams(context) < 0) {
  ------------------
  |  Branch (2943:11): [True: 0, False: 0]
  ------------------
 2944|      0|        BLOSC_TRACE_ERROR("Error in stune next_cparams func\n");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2945|      0|        return BLOSC2_ERROR_TUNER;
 2946|      0|      }
 2947|      0|    } else {
 2948|      0|      for (int i = 0; i < g_ntuners; ++i) {
  ------------------
  |  Branch (2948:23): [True: 0, False: 0]
  ------------------
 2949|      0|        if (g_tuners[i].id == context->tuner_id) {
  ------------------
  |  Branch (2949:13): [True: 0, False: 0]
  ------------------
 2950|      0|          if (load_acquire_ptr(&g_tuners[i].init) == NULL) {
  ------------------
  |  |  144|      0|#define load_acquire_ptr(p) __atomic_load_n((p), __ATOMIC_ACQUIRE)
  ------------------
  |  Branch (2950:15): [True: 0, False: 0]
  ------------------
 2951|      0|            if (fill_tuner(&g_tuners[i]) < 0) {
  ------------------
  |  Branch (2951:17): [True: 0, False: 0]
  ------------------
 2952|      0|              BLOSC_TRACE_ERROR("Could not load tuner %d.", g_tuners[i].id);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2953|      0|              return BLOSC2_ERROR_FAILURE;
 2954|      0|            }
 2955|      0|          }
 2956|      0|          if (g_tuners[i].next_cparams(context) < 0) {
  ------------------
  |  Branch (2956:15): [True: 0, False: 0]
  ------------------
 2957|      0|            BLOSC_TRACE_ERROR("Error in tuner %d next_cparams func\n", context->tuner_id);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2958|      0|            return BLOSC2_ERROR_TUNER;
 2959|      0|          }
 2960|      0|          if (g_tuners[i].id == BLOSC_BTUNE && context->blocksize == 0) {
  ------------------
  |  Branch (2960:15): [True: 0, False: 0]
  |  Branch (2960:48): [True: 0, False: 0]
  ------------------
 2961|       |            // Call stune for initializing blocksize
 2962|      0|            if (blosc_stune_next_blocksize(context) < 0) {
  ------------------
  |  Branch (2962:17): [True: 0, False: 0]
  ------------------
 2963|      0|              BLOSC_TRACE_ERROR("Error in stune next_blocksize func\n");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2964|      0|              return BLOSC2_ERROR_TUNER;
 2965|      0|            }
 2966|      0|          }
 2967|      0|          goto urtunersuccess;
 2968|      0|        }
 2969|      0|      }
 2970|      0|      BLOSC_TRACE_ERROR("User-defined tuner %d not found\n", context->tuner_id);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2971|      0|      return BLOSC2_ERROR_INVALID_PARAM;
 2972|      0|    }
 2973|  2.05k|  } else {
 2974|  2.05k|    if (context->tuner_id < BLOSC_LAST_TUNER && context->tuner_id == BLOSC_STUNE) {
  ------------------
  |  |   26|  2.05k|#define BLOSC_STUNE 0
  ------------------
  |  Branch (2974:9): [True: 2.05k, False: 0]
  |  Branch (2974:49): [True: 2.05k, False: 0]
  ------------------
 2975|  2.05k|      rc = blosc_stune_next_blocksize(context);
 2976|  2.05k|    } else {
 2977|      0|      for (int i = 0; i < g_ntuners; ++i) {
  ------------------
  |  Branch (2977:23): [True: 0, False: 0]
  ------------------
 2978|      0|        if (g_tuners[i].id == context->tuner_id) {
  ------------------
  |  Branch (2978:13): [True: 0, False: 0]
  ------------------
 2979|      0|          if (load_acquire_ptr(&g_tuners[i].init) == NULL) {
  ------------------
  |  |  144|      0|#define load_acquire_ptr(p) __atomic_load_n((p), __ATOMIC_ACQUIRE)
  ------------------
  |  Branch (2979:15): [True: 0, False: 0]
  ------------------
 2980|      0|            if (fill_tuner(&g_tuners[i]) < 0) {
  ------------------
  |  Branch (2980:17): [True: 0, False: 0]
  ------------------
 2981|      0|              BLOSC_TRACE_ERROR("Could not load tuner %d.", g_tuners[i].id);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2982|      0|              return BLOSC2_ERROR_FAILURE;
 2983|      0|            }
 2984|      0|          }
 2985|      0|          rc = g_tuners[i].next_blocksize(context);
 2986|      0|          goto urtunersuccess;
 2987|      0|        }
 2988|      0|      }
 2989|      0|      BLOSC_TRACE_ERROR("User-defined tuner %d not found\n", context->tuner_id);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2990|      0|      return BLOSC2_ERROR_INVALID_PARAM;
 2991|      0|    }
 2992|  2.05k|  }
 2993|  2.05k|  urtunersuccess:;
 2994|  2.05k|  if (rc < 0) {
  ------------------
  |  Branch (2994:7): [True: 0, False: 2.05k]
  ------------------
 2995|      0|    BLOSC_TRACE_ERROR("Error in tuner next_blocksize func\n");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2996|      0|    return BLOSC2_ERROR_TUNER;
 2997|      0|  }
 2998|       |  /* The header must record the block size that the tuner settled on (it rounds a requested
 2999|       |     one to a multiple of the typesize, for instance), not the one that was asked for: a reader
 3000|       |     splits the chunk into blocks of the size in the header.  Variable-length block chunks
 3001|       |     store something else there and set it themselves. */
 3002|  2.05k|  context->header_blocksize = context->blocksize;
 3003|       |
 3004|       |
 3005|       |  /* Check buffer size limits */
 3006|  2.05k|  if (srcsize > BLOSC2_MAX_BUFFERSIZE) {
  ------------------
  |  Branch (3006:7): [True: 0, False: 2.05k]
  ------------------
 3007|      0|    BLOSC_TRACE_ERROR("Input buffer size cannot exceed %d bytes.",
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3008|      0|                      BLOSC2_MAX_BUFFERSIZE);
 3009|      0|    return BLOSC2_ERROR_MAX_BUFSIZE_EXCEEDED;
 3010|      0|  }
 3011|       |
 3012|  2.05k|  if (destsize < BLOSC2_MAX_OVERHEAD) {
  ------------------
  |  Branch (3012:7): [True: 0, False: 2.05k]
  ------------------
 3013|      0|    BLOSC_TRACE_ERROR("Output buffer size should be larger than %d bytes.",
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3014|      0|                      BLOSC2_MAX_OVERHEAD);
 3015|      0|    return BLOSC2_ERROR_MAX_BUFSIZE_EXCEEDED;
 3016|      0|  }
 3017|       |
 3018|       |  /* Compression level */
 3019|  2.05k|  if (clevel < 0 || clevel > 9) {
  ------------------
  |  Branch (3019:7): [True: 0, False: 2.05k]
  |  Branch (3019:21): [True: 0, False: 2.05k]
  ------------------
 3020|       |    /* If clevel not in 0..9, print an error */
 3021|      0|    BLOSC_TRACE_ERROR("`clevel` parameter must be between 0 and 9!.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3022|      0|    return BLOSC2_ERROR_CODEC_PARAM;
 3023|      0|  }
 3024|       |
 3025|       |  /* Dictionary support is only available for ZSTD, LZ4, and LZ4HC.
 3026|       |   * Skip the check when src is NULL (special-value chunks): no compression
 3027|       |   * will actually happen, so codec compatibility is irrelevant. */
 3028|  2.05k|  if (src != NULL && context->use_dict && context->compcode != BLOSC_ZSTD &&
  ------------------
  |  Branch (3028:7): [True: 1.22k, False: 833]
  |  Branch (3028:22): [True: 0, False: 1.22k]
  |  Branch (3028:43): [True: 0, False: 0]
  ------------------
 3029|      0|      context->compcode != BLOSC_LZ4 && context->compcode != BLOSC_LZ4HC) {
  ------------------
  |  Branch (3029:7): [True: 0, False: 0]
  |  Branch (3029:41): [True: 0, False: 0]
  ------------------
 3030|      0|    BLOSC_TRACE_ERROR("`use_dict` is only supported for ZSTD, LZ4, and LZ4HC codecs.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3031|      0|    return BLOSC2_ERROR_CODEC_PARAM;
 3032|      0|  }
 3033|       |
 3034|  2.05k|  blosc2_calculate_blocks(context);
 3035|       |
 3036|  2.05k|  return 1;
 3037|  2.05k|}
blosc2.c:filters_to_flags:
  852|  7.05k|static uint8_t filters_to_flags(const uint8_t* filters) {
  853|  7.05k|  uint8_t flags = 0;
  854|       |
  855|  49.3k|  for (int i = 0; i < BLOSC2_MAX_FILTERS; i++) {
  ------------------
  |  Branch (855:19): [True: 42.3k, False: 7.05k]
  ------------------
  856|  42.3k|    switch (filters[i]) {
  857|  5.58k|      case BLOSC_SHUFFLE:
  ------------------
  |  Branch (857:7): [True: 5.58k, False: 36.7k]
  ------------------
  858|  5.58k|        flags |= BLOSC_DOSHUFFLE;
  859|  5.58k|        break;
  860|    944|      case BLOSC_BITSHUFFLE:
  ------------------
  |  Branch (860:7): [True: 944, False: 41.3k]
  ------------------
  861|    944|        flags |= BLOSC_DOBITSHUFFLE;
  862|    944|        break;
  863|    353|      case BLOSC_DELTA:
  ------------------
  |  Branch (863:7): [True: 353, False: 41.9k]
  ------------------
  864|    353|        flags |= BLOSC_DODELTA;
  865|    353|        break;
  866|  35.4k|      default :
  ------------------
  |  Branch (866:7): [True: 35.4k, False: 6.88k]
  ------------------
  867|  35.4k|        break;
  868|  42.3k|    }
  869|  42.3k|  }
  870|  7.05k|  return flags;
  871|  7.05k|}
blosc2.c:blosc2_calculate_blocks:
 1042|  8.16k|static inline void blosc2_calculate_blocks(blosc2_context* context) {
 1043|       |  /* Compute number of blocks in buffer */
 1044|  8.16k|  context->nblocks = context->sourcesize / context->blocksize;
 1045|  8.16k|  context->leftover = context->sourcesize % context->blocksize;
 1046|  8.16k|  context->nblocks = (context->leftover > 0) ?
  ------------------
  |  Branch (1046:22): [True: 510, False: 7.65k]
  ------------------
 1047|  7.65k|                     (context->nblocks + 1) : context->nblocks;
 1048|  8.16k|}
blosc2.c:blosc1_format_check:
 3674|  1.22k|static int blosc1_format_check(const blosc2_context* context) {
 3675|  1.22k|  if (!context->blosc1_format) {
  ------------------
  |  Branch (3675:7): [True: 1.22k, False: 0]
  ------------------
 3676|  1.22k|    return BLOSC2_ERROR_SUCCESS;
 3677|  1.22k|  }
 3678|      0|  switch (context->compcode) {
 3679|      0|    case BLOSC_BLOSCLZ:
  ------------------
  |  Branch (3679:5): [True: 0, False: 0]
  ------------------
 3680|      0|    case BLOSC_LZ4:
  ------------------
  |  Branch (3680:5): [True: 0, False: 0]
  ------------------
 3681|      0|    case BLOSC_LZ4HC:
  ------------------
  |  Branch (3681:5): [True: 0, False: 0]
  ------------------
 3682|      0|    case BLOSC_ZLIB:
  ------------------
  |  Branch (3682:5): [True: 0, False: 0]
  ------------------
 3683|      0|    case BLOSC_ZSTD:
  ------------------
  |  Branch (3683:5): [True: 0, False: 0]
  ------------------
 3684|      0|      break;
 3685|      0|    default:
  ------------------
  |  Branch (3685:5): [True: 0, False: 0]
  ------------------
 3686|      0|      BLOSC_TRACE_ERROR("Codec %d cannot be used when writing Blosc1 chunks.", context->compcode);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3687|      0|      return BLOSC2_ERROR_CODEC_SUPPORT;
 3688|      0|  }
 3689|       |  /* The Blosc1 header only has flags for a shuffle or a bitshuffle, so the pipeline can have
 3690|       |     one of those and nothing else, in any of its slots. */
 3691|      0|  int nfilters = 0;
 3692|      0|  for (int i = 0; i < BLOSC2_MAX_FILTERS; i++) {
  ------------------
  |  Branch (3692:19): [True: 0, False: 0]
  ------------------
 3693|      0|    uint8_t filter = context->filters[i];
 3694|      0|    if (filter == BLOSC_NOFILTER) {
  ------------------
  |  Branch (3694:9): [True: 0, False: 0]
  ------------------
 3695|      0|      continue;
 3696|      0|    }
 3697|      0|    bool plain_shuffle = (filter == BLOSC_SHUFFLE || filter == BLOSC_BITSHUFFLE) &&
  ------------------
  |  Branch (3697:27): [True: 0, False: 0]
  |  Branch (3697:54): [True: 0, False: 0]
  ------------------
 3698|      0|                         context->filters_meta[i] == 0;
  ------------------
  |  Branch (3698:26): [True: 0, False: 0]
  ------------------
 3699|      0|    if (!plain_shuffle || ++nfilters > 1) {
  ------------------
  |  Branch (3699:9): [True: 0, False: 0]
  |  Branch (3699:27): [True: 0, False: 0]
  ------------------
 3700|      0|      BLOSC_TRACE_ERROR("Filter %d in slot %d cannot be used when writing Blosc1 chunks.", filter, i);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3701|      0|      return BLOSC2_ERROR_FILTER_PIPELINE;
 3702|      0|    }
 3703|      0|  }
 3704|      0|  if (context->use_dict || (context->blosc2_flags2 & BLOSC2_VL_BLOCKS)) {
  ------------------
  |  Branch (3704:7): [True: 0, False: 0]
  |  Branch (3704:28): [True: 0, False: 0]
  ------------------
 3705|      0|    BLOSC_TRACE_ERROR("Dictionaries and variable-length blocks cannot be used when writing Blosc1 chunks.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3706|      0|    return BLOSC2_ERROR_INVALID_PARAM;
 3707|      0|  }
 3708|      0|  return BLOSC2_ERROR_SUCCESS;
 3709|      0|}
blosc2.c:write_compression_header:
 3444|  1.22k|static int write_compression_header(blosc2_context* context, bool extended_header) {
 3445|  1.22k|  blosc_header header;
 3446|  1.22k|  int dont_split;
 3447|  1.22k|  bool vlblocks = (context->blosc2_flags2 & BLOSC2_VL_BLOCKS) != 0;
 3448|       |
 3449|  1.22k|  if (context->clevel == 0) {
  ------------------
  |  Branch (3449:7): [True: 1, False: 1.22k]
  ------------------
 3450|       |    /* Compression level 0 means no compression — dicts serve no purpose here */
 3451|      1|    context->use_dict = 0;
 3452|      1|  }
 3453|       |
 3454|  1.22k|  int dict_training = context->use_dict && (context->dict_cdict == NULL);
  ------------------
  |  Branch (3454:23): [True: 0, False: 1.22k]
  |  Branch (3454:44): [True: 0, False: 0]
  ------------------
 3455|       |
 3456|  1.22k|  context->header_flags = 0;
 3457|       |
 3458|  1.22k|  if (!vlblocks && context->clevel == 0) {
  ------------------
  |  Branch (3458:7): [True: 1.22k, False: 0]
  |  Branch (3458:20): [True: 1, False: 1.22k]
  ------------------
 3459|       |    /* Compression level 0 means buffer to be memcpy'ed */
 3460|      1|    context->header_flags |= (uint8_t)BLOSC_MEMCPYED;
 3461|      1|  }
 3462|  1.22k|  if (!vlblocks && context->sourcesize < BLOSC_MIN_BUFFERSIZE) {
  ------------------
  |  Branch (3462:7): [True: 1.22k, False: 0]
  |  Branch (3462:20): [True: 28, False: 1.19k]
  ------------------
 3463|       |    /* Buffer is too small.  Try memcpy'ing. */
 3464|     28|    context->header_flags |= (uint8_t)BLOSC_MEMCPYED;
 3465|     28|  }
 3466|       |
 3467|  1.22k|  bool memcpyed = context->header_flags & (uint8_t)BLOSC_MEMCPYED;
 3468|  1.22k|  if (extended_header) {
  ------------------
  |  Branch (3468:7): [True: 1.22k, False: 0]
  ------------------
 3469|       |    /* Indicate that we are building an extended header */
 3470|  1.22k|    context->header_overhead = BLOSC_EXTENDED_HEADER_LENGTH;
 3471|  1.22k|    context->header_flags |= (BLOSC_DOSHUFFLE | BLOSC_DOBITSHUFFLE);
 3472|       |    /* Store filter pipeline info at the end of the header */
 3473|  1.22k|    if (dict_training || memcpyed) {
  ------------------
  |  Branch (3473:9): [True: 0, False: 1.22k]
  |  Branch (3473:26): [True: 28, False: 1.19k]
  ------------------
 3474|     28|      context->bstarts = NULL;
 3475|     28|      context->output_bytes = context->header_overhead;
 3476|  1.19k|    } else {
 3477|  1.19k|      context->bstarts = (int32_t*)(context->dest + context->header_overhead);
 3478|  1.19k|      context->output_bytes = context->header_overhead + (int32_t)sizeof(int32_t) * context->nblocks;
 3479|  1.19k|    }
 3480|  1.22k|  } else {
 3481|       |    // Regular header
 3482|      0|    context->header_overhead = BLOSC_MIN_HEADER_LENGTH;
 3483|      0|    if (memcpyed) {
  ------------------
  |  Branch (3483:9): [True: 0, False: 0]
  ------------------
 3484|      0|      context->bstarts = NULL;
 3485|      0|      context->output_bytes = context->header_overhead;
 3486|      0|    } else {
 3487|      0|      context->bstarts = (int32_t *) (context->dest + context->header_overhead);
 3488|      0|      context->output_bytes = context->header_overhead + (int32_t)sizeof(int32_t) * context->nblocks;
 3489|      0|    }
 3490|      0|  }
 3491|       |
 3492|       |  /* If the header + block starts don't fit in destsize, fall back to memcpy */
 3493|  1.22k|  if (!memcpyed && context->output_bytes > context->destsize) {
  ------------------
  |  Branch (3493:7): [True: 1.19k, False: 28]
  |  Branch (3493:20): [True: 0, False: 1.19k]
  ------------------
 3494|      0|    context->header_flags |= (uint8_t)BLOSC_MEMCPYED;
 3495|      0|    memcpyed = true;
 3496|      0|    context->bstarts = NULL;
 3497|      0|    context->output_bytes = context->header_overhead;
 3498|      0|  }
 3499|       |
 3500|       |  // when memcpyed bit is set, there is no point in dealing with others
 3501|  1.22k|  if (!memcpyed) {
  ------------------
  |  Branch (3501:7): [True: 1.19k, False: 28]
  ------------------
 3502|  1.19k|    if (context->filter_flags & BLOSC_DOSHUFFLE) {
  ------------------
  |  Branch (3502:9): [True: 741, False: 452]
  ------------------
 3503|       |      /* Byte-shuffle is active */
 3504|    741|      context->header_flags |= BLOSC_DOSHUFFLE;
 3505|    741|    }
 3506|       |
 3507|  1.19k|    if (context->filter_flags & BLOSC_DOBITSHUFFLE) {
  ------------------
  |  Branch (3507:9): [True: 225, False: 968]
  ------------------
 3508|       |      /* Bit-shuffle is active */
 3509|    225|      context->header_flags |= BLOSC_DOBITSHUFFLE;
 3510|    225|    }
 3511|       |
 3512|  1.19k|    if (context->filter_flags & BLOSC_DODELTA) {
  ------------------
  |  Branch (3512:9): [True: 58, False: 1.13k]
  ------------------
 3513|       |      /* Delta is active */
 3514|     58|      context->header_flags |= BLOSC_DODELTA;
 3515|     58|    }
 3516|       |
 3517|  1.19k|    dont_split = vlblocks || !split_block(context, context->typesize,
  ------------------
  |  Branch (3517:18): [True: 0, False: 1.19k]
  |  Branch (3517:30): [True: 1.19k, False: 0]
  ------------------
 3518|  1.19k|                                          context->blocksize);
 3519|       |
 3520|       |    /* dont_split is in bit 4 */
 3521|  1.19k|    context->header_flags |= dont_split << 4;
 3522|       |    /* codec starts at bit 5 */
 3523|  1.19k|    uint8_t compformat = compcode_to_compformat(context->compcode);
 3524|  1.19k|    context->header_flags |= compformat << 5;
 3525|  1.19k|  }
 3526|       |
 3527|       |  // Create blosc header and store to dest
 3528|  1.22k|  blosc2_initialize_header_from_context(context, &header, extended_header);
 3529|       |
 3530|  1.22k|  memcpy(context->dest, &header, (extended_header) ?
  ------------------
  |  Branch (3530:34): [True: 1.22k, False: 0]
  ------------------
 3531|  1.22k|    BLOSC_EXTENDED_HEADER_LENGTH : BLOSC_MIN_HEADER_LENGTH);
 3532|       |
 3533|  1.22k|  return 1;
 3534|  1.22k|}
blosc2.c:compcode_to_compformat:
  536|  1.19k|static int compcode_to_compformat(int compcode) {
  537|  1.19k|  switch (compcode) {
  538|    704|    case BLOSC_BLOSCLZ: return BLOSC_BLOSCLZ_FORMAT;
  ------------------
  |  Branch (538:5): [True: 704, False: 489]
  ------------------
  539|     22|    case BLOSC_LZ4:     return BLOSC_LZ4_FORMAT;
  ------------------
  |  Branch (539:5): [True: 22, False: 1.17k]
  ------------------
  540|      0|    case BLOSC_LZ4HC:   return BLOSC_LZ4HC_FORMAT;
  ------------------
  |  Branch (540:5): [True: 0, False: 1.19k]
  ------------------
  541|       |
  542|      0|#if defined(HAVE_ZLIB)
  543|      0|    case BLOSC_ZLIB:    return BLOSC_ZLIB_FORMAT;
  ------------------
  |  Branch (543:5): [True: 0, False: 1.19k]
  ------------------
  544|      0|#endif /*  HAVE_ZLIB */
  545|       |
  546|      0|#if defined(HAVE_ZSTD)
  547|    324|    case BLOSC_ZSTD:    return BLOSC_ZSTD_FORMAT;
  ------------------
  |  Branch (547:5): [True: 324, False: 869]
  ------------------
  548|      0|      break;
  549|      0|#endif /*  HAVE_ZSTD */
  550|    143|    default:
  ------------------
  |  Branch (550:5): [True: 143, False: 1.05k]
  ------------------
  551|    143|      return BLOSC_UDCODEC_FORMAT;
  552|  1.19k|  }
  553|      0|  BLOSC_ERROR(BLOSC2_ERROR_FAILURE);
  ------------------
  |  |  111|      0|    do {                                            \
  |  |  112|      0|        int rc_ = (rc);                             \
  |  |  113|      0|        if (rc_ < BLOSC2_ERROR_SUCCESS) {           \
  |  |  ------------------
  |  |  |  Branch (113:13): [True: 0, False: 0]
  |  |  ------------------
  |  |  114|      0|            char *error_msg = print_error(rc_);     \
  |  |  115|      0|            BLOSC_TRACE_ERROR("%s", error_msg);     \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  116|      0|            return rc_;                             \
  |  |  117|      0|        }                                           \
  |  |  118|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (118:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  554|      0|}
blosc2.c:blosc2_initialize_header_from_context:
 1256|  1.22k|static int blosc2_initialize_header_from_context(blosc2_context* context, blosc_header* header, bool extended_header) {
 1257|  1.22k|  int32_t header_blocksize = (int32_t)(context->header_blocksize > 0 ? context->header_blocksize : context->blocksize);
  ------------------
  |  Branch (1257:40): [True: 1.22k, False: 0]
  ------------------
 1258|  1.22k|  if ((context->blosc2_flags2 & BLOSC2_VL_BLOCKS) == 0 &&
  ------------------
  |  Branch (1258:7): [True: 1.22k, False: 0]
  ------------------
 1259|  1.22k|      context->sourcesize > 0 && header_blocksize > context->sourcesize) {
  ------------------
  |  Branch (1259:7): [True: 1.22k, False: 0]
  |  Branch (1259:34): [True: 0, False: 1.22k]
  ------------------
 1260|      0|    header_blocksize = (int32_t)context->sourcesize;
 1261|      0|  }
 1262|  1.22k|  memset(header, 0, sizeof(blosc_header));
 1263|       |
 1264|  1.22k|  header->version = (context->blosc2_flags2 & BLOSC2_VL_BLOCKS) ?
  ------------------
  |  Branch (1264:21): [True: 0, False: 1.22k]
  ------------------
 1265|      0|                    BLOSC2_VERSION_FORMAT_VL_BLOCKS :
 1266|  1.22k|                    BLOSC2_VERSION_FORMAT_STABLE;
 1267|  1.22k|  if (context->blosc1_format) {
  ------------------
  |  Branch (1267:7): [True: 0, False: 1.22k]
  ------------------
 1268|      0|    header->version = BLOSC1_VERSION_FORMAT;
 1269|      0|  }
 1270|  1.22k|  header->versionlz = compcode_to_compversion(context->compcode);
 1271|  1.22k|  header->flags = context->header_flags;
 1272|  1.22k|  header->typesize = (uint8_t)context->typesize;
 1273|  1.22k|  header->nbytes = (int32_t)context->sourcesize;
 1274|  1.22k|  header->blocksize = header_blocksize;
 1275|       |
 1276|  1.22k|  int little_endian = is_little_endian();
 1277|  1.22k|  if (!little_endian) {
  ------------------
  |  Branch (1277:7): [True: 0, False: 1.22k]
  ------------------
 1278|      0|    header->nbytes = bswap32_(header->nbytes);
 1279|      0|    header->blocksize = bswap32_(header->blocksize);
 1280|       |    // cbytes written after compression
 1281|      0|  }
 1282|       |
 1283|  1.22k|  if (extended_header) {
  ------------------
  |  Branch (1283:7): [True: 1.22k, False: 0]
  ------------------
 1284|       |    /* Store filter pipeline info at the end of the header */
 1285|  8.54k|    for (int i = 0; i < BLOSC2_MAX_FILTERS; i++) {
  ------------------
  |  Branch (1285:21): [True: 7.32k, False: 1.22k]
  ------------------
 1286|  7.32k|      header->filters[i] = context->filters[i];
 1287|  7.32k|      header->filters_meta[i] = context->filters_meta[i];
 1288|  7.32k|    }
 1289|  1.22k|    header->udcompcode = context->compcode;
 1290|  1.22k|    header->compcode_meta = context->compcode_meta;
 1291|  1.22k|    header->blosc2_flags2 = context->blosc2_flags2;
 1292|       |
 1293|  1.22k|    if (!little_endian) {
  ------------------
  |  Branch (1293:9): [True: 0, False: 1.22k]
  ------------------
 1294|      0|      header->blosc2_flags |= BLOSC2_BIGENDIAN;
 1295|      0|    }
 1296|  1.22k|    if (context->use_dict) {
  ------------------
  |  Branch (1296:9): [True: 0, False: 1.22k]
  ------------------
 1297|      0|      header->blosc2_flags |= BLOSC2_USEDICT;
 1298|      0|    }
 1299|  1.22k|    if (context->blosc2_flags & BLOSC2_INSTR_CODEC) {
  ------------------
  |  Branch (1299:9): [True: 0, False: 1.22k]
  ------------------
 1300|      0|      header->blosc2_flags |= BLOSC2_INSTR_CODEC;
 1301|      0|    }
 1302|  1.22k|  }
 1303|       |
 1304|  1.22k|  return 0;
 1305|  1.22k|}
blosc2.c:compcode_to_compversion:
  558|  1.22k|static int compcode_to_compversion(int compcode) {
  559|       |  /* Write compressor format */
  560|  1.22k|  switch (compcode) {
  561|    731|    case BLOSC_BLOSCLZ:
  ------------------
  |  Branch (561:5): [True: 731, False: 490]
  ------------------
  562|    731|      return BLOSC_BLOSCLZ_VERSION_FORMAT;
  563|     23|    case BLOSC_LZ4:
  ------------------
  |  Branch (563:5): [True: 23, False: 1.19k]
  ------------------
  564|     23|      return BLOSC_LZ4_VERSION_FORMAT;
  565|      0|    case BLOSC_LZ4HC:
  ------------------
  |  Branch (565:5): [True: 0, False: 1.22k]
  ------------------
  566|      0|      return BLOSC_LZ4HC_VERSION_FORMAT;
  567|       |
  568|      0|#if defined(HAVE_ZLIB)
  569|      0|    case BLOSC_ZLIB:
  ------------------
  |  Branch (569:5): [True: 0, False: 1.22k]
  ------------------
  570|      0|      return BLOSC_ZLIB_VERSION_FORMAT;
  571|      0|      break;
  572|      0|#endif /*  HAVE_ZLIB */
  573|       |
  574|      0|#if defined(HAVE_ZSTD)
  575|    324|    case BLOSC_ZSTD:
  ------------------
  |  Branch (575:5): [True: 324, False: 897]
  ------------------
  576|    324|      return BLOSC_ZSTD_VERSION_FORMAT;
  577|      0|      break;
  578|      0|#endif /*  HAVE_ZSTD */
  579|    143|    default:
  ------------------
  |  Branch (579:5): [True: 143, False: 1.07k]
  ------------------
  580|    462|      for (int i = 0; i < g_ncodecs; ++i) {
  ------------------
  |  Branch (580:23): [True: 462, False: 0]
  ------------------
  581|    462|        if (compcode == g_codecs[i].compcode) {
  ------------------
  |  Branch (581:13): [True: 143, False: 319]
  ------------------
  582|    143|          return g_codecs[i].version;
  583|    143|        }
  584|    462|      }
  585|  1.22k|  }
  586|      0|  return BLOSC2_ERROR_FAILURE;
  587|  1.22k|}
blosc2.c:blosc_compress_context:
 3537|  1.22k|static int blosc_compress_context(blosc2_context* context) {
 3538|  1.22k|  int ntbytes = 0;
 3539|  1.22k|  blosc_timestamp_t last = {0}, current;
 3540|  1.22k|  bool memcpyed = context->header_flags & (uint8_t)BLOSC_MEMCPYED;
 3541|       |
 3542|  1.22k|  if (context->tuner_params != NULL) {
  ------------------
  |  Branch (3542:7): [True: 0, False: 1.22k]
  ------------------
 3543|      0|    blosc_set_timestamp(&last);
 3544|      0|  }
 3545|       |
 3546|  1.22k|  if (!memcpyed) {
  ------------------
  |  Branch (3546:7): [True: 1.19k, False: 28]
  ------------------
 3547|       |    /* Do the actual compression */
 3548|  1.19k|    ntbytes = do_job(context);
 3549|  1.19k|    if (ntbytes < 0) {
  ------------------
  |  Branch (3549:9): [True: 1, False: 1.19k]
  ------------------
 3550|      1|      return ntbytes;
 3551|      1|    }
 3552|  1.19k|    if (ntbytes == 0) {
  ------------------
  |  Branch (3552:9): [True: 245, False: 947]
  ------------------
 3553|       |      // Try out with a memcpy later on (last chance for fitting src buffer in dest).
 3554|    245|      context->header_flags |= (uint8_t)BLOSC_MEMCPYED;
 3555|    245|      memcpyed = true;
 3556|    245|    }
 3557|  1.19k|  }
 3558|       |
 3559|  1.22k|  int dont_split = (context->header_flags & 0x10) >> 4;
 3560|  1.22k|  int nstreams = context->nblocks;
 3561|  1.22k|  if (!dont_split) {
  ------------------
  |  Branch (3561:7): [True: 28, False: 1.19k]
  ------------------
 3562|       |    // When splitting, the number of streams is computed differently
 3563|     28|    if (context->leftover) {
  ------------------
  |  Branch (3563:9): [True: 0, False: 28]
  ------------------
 3564|      0|      nstreams = (context->nblocks - 1) * context->typesize + 1;
 3565|      0|    }
 3566|     28|    else {
 3567|     28|      nstreams *= context->typesize;
 3568|     28|    }
 3569|     28|  }
 3570|       |
 3571|  1.22k|  if (memcpyed) {
  ------------------
  |  Branch (3571:7): [True: 273, False: 947]
  ------------------
 3572|    273|    if (context->sourcesize + context->header_overhead > context->destsize) {
  ------------------
  |  Branch (3572:9): [True: 0, False: 273]
  ------------------
 3573|       |      /* We are exceeding maximum output size */
 3574|      0|      ntbytes = 0;
 3575|      0|    }
 3576|    273|    else {
 3577|    273|      context->output_bytes = context->header_overhead;
 3578|    273|      ntbytes = do_job(context);
 3579|    273|      if (ntbytes < 0) {
  ------------------
  |  Branch (3579:11): [True: 0, False: 273]
  ------------------
 3580|      0|        return ntbytes;
 3581|      0|      }
 3582|       |      // Success!  update the memcpy bit in header
 3583|    273|      context->dest[BLOSC2_CHUNK_FLAGS] = context->header_flags;
 3584|    273|      if (context->dict_cdict != NULL) {
  ------------------
  |  Branch (3584:11): [True: 0, False: 273]
  ------------------
 3585|       |        // The copy overwrote the dictionary that this pass was going to use
 3586|      0|        context->dest[BLOSC2_CHUNK_BLOSC2_FLAGS] &= ~(uint8_t)BLOSC2_USEDICT;
 3587|      0|      }
 3588|       |      // and clear the memcpy bit in context (for next reuse)
 3589|    273|      context->header_flags &= ~(uint8_t)BLOSC_MEMCPYED;
 3590|    273|    }
 3591|    273|  }
 3592|    947|  else {
 3593|       |    // Check whether we have a run for the whole chunk
 3594|    947|    int dict_training = context->use_dict && (context->dict_cdict == NULL);
  ------------------
  |  Branch (3594:25): [True: 0, False: 947]
  |  Branch (3594:46): [True: 0, False: 0]
  ------------------
 3595|    947|    int start_csizes = context->header_overhead + 4 * context->nblocks;
 3596|    947|    if (!dict_training && ntbytes == (int)(start_csizes + nstreams * sizeof(int32_t))) {
  ------------------
  |  Branch (3596:9): [True: 947, False: 0]
  |  Branch (3596:27): [True: 32, False: 915]
  ------------------
 3597|       |      // The streams are all zero runs (by construction).  Encode it...
 3598|     32|      context->dest[BLOSC2_CHUNK_BLOSC2_FLAGS] |= BLOSC2_SPECIAL_ZERO << 4;
 3599|       |      // ...and assign the new chunk length
 3600|     32|      ntbytes = context->header_overhead;
 3601|     32|    }
 3602|    947|  }
 3603|       |
 3604|       |  /* Set the number of compressed bytes in header */
 3605|  1.22k|  _sw32(context->dest + BLOSC2_CHUNK_CBYTES, ntbytes);
 3606|  1.22k|  if (context->blosc2_flags & BLOSC2_INSTR_CODEC) {
  ------------------
  |  Branch (3606:7): [True: 0, False: 1.22k]
  ------------------
 3607|      0|    dont_split = (context->header_flags & 0x10) >> 4;
 3608|      0|    int32_t blocksize = dont_split ? (int32_t)sizeof(blosc2_instr) : (int32_t)sizeof(blosc2_instr) * context->typesize;
  ------------------
  |  Branch (3608:25): [True: 0, False: 0]
  ------------------
 3609|      0|    _sw32(context->dest + BLOSC2_CHUNK_NBYTES, nstreams * (int32_t)sizeof(blosc2_instr));
 3610|      0|    _sw32(context->dest + BLOSC2_CHUNK_BLOCKSIZE, blocksize);
 3611|      0|  }
 3612|       |
 3613|       |  /* Set the number of bytes in dest buffer (might be useful for tuner) */
 3614|  1.22k|  context->destsize = ntbytes;
 3615|       |
 3616|  1.22k|  if (context->tuner_params != NULL) {
  ------------------
  |  Branch (3616:7): [True: 0, False: 1.22k]
  ------------------
 3617|      0|    blosc_set_timestamp(&current);
 3618|      0|    double ctime = blosc_elapsed_secs(last, current);
 3619|      0|    int rc;
 3620|      0|    if (context->tuner_id < BLOSC_LAST_TUNER && context->tuner_id == BLOSC_STUNE) {
  ------------------
  |  |   26|      0|#define BLOSC_STUNE 0
  ------------------
  |  Branch (3620:9): [True: 0, False: 0]
  |  Branch (3620:49): [True: 0, False: 0]
  ------------------
 3621|      0|      rc = blosc_stune_update(context, ctime);
 3622|      0|    } else {
 3623|      0|      for (int i = 0; i < g_ntuners; ++i) {
  ------------------
  |  Branch (3623:23): [True: 0, False: 0]
  ------------------
 3624|      0|        if (g_tuners[i].id == context->tuner_id) {
  ------------------
  |  Branch (3624:13): [True: 0, False: 0]
  ------------------
 3625|      0|          if (load_acquire_ptr(&g_tuners[i].init) == NULL) {
  ------------------
  |  |  144|      0|#define load_acquire_ptr(p) __atomic_load_n((p), __ATOMIC_ACQUIRE)
  ------------------
  |  Branch (3625:15): [True: 0, False: 0]
  ------------------
 3626|      0|            if (fill_tuner(&g_tuners[i]) < 0) {
  ------------------
  |  Branch (3626:17): [True: 0, False: 0]
  ------------------
 3627|      0|              BLOSC_TRACE_ERROR("Could not load tuner %d.", g_tuners[i].id);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3628|      0|              return BLOSC2_ERROR_FAILURE;
 3629|      0|            }
 3630|      0|          }
 3631|      0|          rc = g_tuners[i].update(context, ctime);
 3632|      0|          goto urtunersuccess;
 3633|      0|        }
 3634|      0|      }
 3635|      0|      BLOSC_TRACE_ERROR("User-defined tuner %d not found\n", context->tuner_id);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3636|      0|      return BLOSC2_ERROR_INVALID_PARAM;
 3637|      0|      urtunersuccess:;
 3638|      0|    }
 3639|      0|    if (rc < 0) {
  ------------------
  |  Branch (3639:9): [True: 0, False: 0]
  ------------------
 3640|      0|      BLOSC_TRACE_ERROR("Error in tuner update func\n");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3641|      0|      return BLOSC2_ERROR_TUNER;
 3642|      0|    }
 3643|      0|  }
 3644|       |
 3645|  1.22k|  return ntbytes;
 3646|  1.22k|}
blosc2.c:blosc_run_decompression_with_context:
 4515|  3.47k|                                                void* dest, int32_t destsize) {
 4516|  3.47k|  blosc_header header;
 4517|  3.47k|  int32_t ntbytes;
 4518|  3.47k|  int rc;
 4519|       |
 4520|  3.47k|  rc = read_chunk_header(src, srcsize, true, &header);
 4521|  3.47k|  if (rc < 0) {
  ------------------
  |  Branch (4521:7): [True: 3, False: 3.47k]
  ------------------
 4522|      3|    return rc;
 4523|      3|  }
 4524|       |
 4525|  3.47k|  if (header.nbytes > destsize) {
  ------------------
  |  Branch (4525:7): [True: 0, False: 3.47k]
  ------------------
 4526|       |    // Not enough space for writing into the destination
 4527|      0|    return BLOSC2_ERROR_WRITE_BUFFER;
 4528|      0|  }
 4529|       |
 4530|  3.47k|  rc = initialize_context_decompression(context, &header, src, srcsize, dest, destsize);
 4531|  3.47k|  if (rc < 0) {
  ------------------
  |  Branch (4531:7): [True: 156, False: 3.31k]
  ------------------
 4532|    156|    return rc;
 4533|    156|  }
 4534|       |
 4535|       |  /* Do the actual decompression */
 4536|  3.31k|  ntbytes = do_job(context);
 4537|  3.31k|  if (ntbytes < 0) {
  ------------------
  |  Branch (4537:7): [True: 877, False: 2.43k]
  ------------------
 4538|    877|    return ntbytes;
 4539|    877|  }
 4540|       |
 4541|  3.31k|  assert(ntbytes <= (int32_t)destsize);
 4542|  2.43k|  return ntbytes;
 4543|  3.31k|}
blosc2.c:initialize_context_decompression:
 3206|  3.47k|                                            int32_t srcsize, void* dest, int32_t destsize) {
 3207|  3.47k|  int32_t bstarts_end;
 3208|  3.47k|  bool vlblocks;
 3209|       |
 3210|  3.47k|  context->do_compress = 0;
 3211|  3.47k|  context->src = (const uint8_t*)src;
 3212|  3.47k|  context->srcsize = srcsize;
 3213|  3.47k|  context->dest = (uint8_t*)dest;
 3214|  3.47k|  context->destsize = destsize;
 3215|  3.47k|  context->output_bytes = 0;
 3216|  3.47k|  context->vlblock_sources = NULL;
 3217|  3.47k|  context->vlblock_dests = NULL;
 3218|  3.47k|  if (context->blocknbytes != NULL) {
  ------------------
  |  Branch (3218:7): [True: 0, False: 3.47k]
  ------------------
 3219|      0|    free(context->blocknbytes);
 3220|      0|    context->blocknbytes = NULL;
 3221|      0|  }
 3222|  3.47k|  if (context->blockoffsets != NULL) {
  ------------------
  |  Branch (3222:7): [True: 0, False: 3.47k]
  ------------------
 3223|      0|    free(context->blockoffsets);
 3224|      0|    context->blockoffsets = NULL;
 3225|      0|  }
 3226|  3.47k|  if (context->blockcbytes != NULL) {
  ------------------
  |  Branch (3226:7): [True: 0, False: 3.47k]
  ------------------
 3227|      0|    free(context->blockcbytes);
 3228|      0|    context->blockcbytes = NULL;
 3229|      0|  }
 3230|       |
 3231|  3.47k|  int rc = blosc2_initialize_context_from_header(context, header);
 3232|  3.47k|  if (rc < 0) {
  ------------------
  |  Branch (3232:7): [True: 0, False: 3.47k]
  ------------------
 3233|      0|    return rc;
 3234|      0|  }
 3235|  3.47k|  clear_context_decompression_dict(context);
 3236|  3.47k|  vlblocks = (context->blosc2_flags2 & BLOSC2_VL_BLOCKS) != 0;
 3237|  3.47k|  bool is_lazy = ((context->header_overhead == BLOSC_EXTENDED_HEADER_LENGTH) &&
  ------------------
  |  Branch (3237:19): [True: 2.38k, False: 1.08k]
  ------------------
 3238|  2.38k|                  (context->blosc2_flags & 0x08u));
  ------------------
  |  Branch (3238:19): [True: 98, False: 2.28k]
  ------------------
 3239|       |
 3240|       |  /* Check that we have enough space to decompress */
 3241|  3.47k|  if (context->sourcesize > (int32_t)context->destsize) {
  ------------------
  |  Branch (3241:7): [True: 0, False: 3.47k]
  ------------------
 3242|      0|    return BLOSC2_ERROR_WRITE_BUFFER;
 3243|      0|  }
 3244|       |
 3245|  3.47k|  if (context->block_maskout != NULL) {
  ------------------
  |  Branch (3245:7): [True: 1.12k, False: 2.34k]
  ------------------
 3246|  1.12k|    if (context->block_maskout_nitems != context->nblocks) {
  ------------------
  |  Branch (3246:9): [True: 0, False: 1.12k]
  ------------------
 3247|      0|      BLOSC_TRACE_ERROR("The number of items in block_maskout (%d) must match the number"
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3248|      0|                        " of blocks in chunk (%d).",
 3249|      0|                        context->block_maskout_nitems, context->nblocks);
 3250|      0|      return BLOSC2_ERROR_DATA;
 3251|      0|    }
 3252|  1.12k|    if (filters_contain(context->filters, BLOSC_DELTA)) {
  ------------------
  |  Branch (3252:9): [True: 112, False: 1.01k]
  ------------------
 3253|    112|      bool any_needed = false;
 3254|    112|      for (int i = 0; i < context->block_maskout_nitems; ++i) {
  ------------------
  |  Branch (3254:23): [True: 112, False: 0]
  ------------------
 3255|    112|        if (!context->block_maskout[i]) {
  ------------------
  |  Branch (3255:13): [True: 112, False: 0]
  ------------------
 3256|    112|          any_needed = true;
 3257|    112|          break;
 3258|    112|        }
 3259|    112|      }
 3260|    112|      if (any_needed) {
  ------------------
  |  Branch (3260:11): [True: 112, False: 0]
  ------------------
 3261|       |        // Delta filter encodes subsequent blocks relative to block 0; block 0 must be unmasked.
 3262|    112|        context->block_maskout[0] = false;
 3263|    112|      }
 3264|    112|    }
 3265|  1.12k|  }
 3266|       |
 3267|  3.47k|  context->special_type = (header->blosc2_flags >> 4) & BLOSC2_SPECIAL_MASK;
 3268|  3.47k|  if (context->special_type > BLOSC2_SPECIAL_LASTID) {
  ------------------
  |  Branch (3268:7): [True: 0, False: 3.47k]
  ------------------
 3269|      0|    BLOSC_TRACE_ERROR("Unknown special values ID (%d) ",
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3270|      0|                      context->special_type);
 3271|      0|    return BLOSC2_ERROR_DATA;
 3272|      0|  }
 3273|       |
 3274|  3.47k|  int memcpyed = (context->header_flags & (uint8_t) BLOSC_MEMCPYED);
 3275|  3.47k|  if (memcpyed && (header->cbytes != header->nbytes + context->header_overhead)) {
  ------------------
  |  Branch (3275:7): [True: 481, False: 2.99k]
  |  Branch (3275:19): [True: 13, False: 468]
  ------------------
 3276|     13|    BLOSC_TRACE_ERROR("Wrong header info for this memcpyed chunk");
  ------------------
  |  |   93|     13|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|     13|    do {                                            \
  |  |  |  |   98|     13|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|     13|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 13, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|     13|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3277|     13|    return BLOSC2_ERROR_DATA;
 3278|     13|  }
 3279|       |
 3280|  3.45k|  if ((header->nbytes == 0) && (header->cbytes == context->header_overhead) &&
  ------------------
  |  Branch (3280:7): [True: 0, False: 3.45k]
  |  Branch (3280:32): [True: 0, False: 0]
  ------------------
 3281|      0|      !context->special_type) {
  ------------------
  |  Branch (3281:7): [True: 0, False: 0]
  ------------------
 3282|       |    // A compressed buffer with only a header can only contain a zero-length buffer
 3283|      0|    return 0;
 3284|      0|  }
 3285|       |
 3286|  3.45k|  context->bstarts = (int32_t *) (context->src + context->header_overhead);
 3287|  3.45k|  bstarts_end = context->header_overhead;
 3288|  3.45k|  if (!context->special_type && !memcpyed) {
  ------------------
  |  Branch (3288:7): [True: 3.22k, False: 238]
  |  Branch (3288:33): [True: 2.75k, False: 468]
  ------------------
 3289|  2.75k|    size_t bstarts_end_tmp;
 3290|  2.75k|    size_t bstarts_nbytes;
 3291|  2.75k|    if (context->nblocks < 0 ||
  ------------------
  |  Branch (3291:9): [True: 0, False: 2.75k]
  ------------------
 3292|  2.75k|        !blosc2_checked_mul_size((size_t)context->nblocks, sizeof(int32_t), &bstarts_nbytes) ||
  ------------------
  |  Branch (3292:9): [True: 0, False: 2.75k]
  ------------------
 3293|  2.75k|        !blosc2_checked_add_size((size_t)context->header_overhead, bstarts_nbytes, &bstarts_end_tmp) ||
  ------------------
  |  Branch (3293:9): [True: 0, False: 2.75k]
  ------------------
 3294|  2.75k|        bstarts_end_tmp > (size_t)INT32_MAX) {
  ------------------
  |  Branch (3294:9): [True: 10, False: 2.74k]
  ------------------
 3295|     10|      BLOSC_TRACE_ERROR("Invalid bstarts size in chunk header.");
  ------------------
  |  |   93|     10|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|     10|    do {                                            \
  |  |  |  |   98|     10|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|     10|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 10, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|     10|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3296|     10|      return BLOSC2_ERROR_INVALID_HEADER;
 3297|     10|    }
 3298|       |    /* If chunk is not special or a memcpyed, we do have a bstarts section */
 3299|  2.74k|    bstarts_end = (int32_t)bstarts_end_tmp;
 3300|  2.74k|  }
 3301|       |
 3302|  3.44k|  if (srcsize < bstarts_end) {
  ------------------
  |  Branch (3302:7): [True: 27, False: 3.42k]
  ------------------
 3303|     27|    BLOSC_TRACE_ERROR("`bstarts` exceeds length of source buffer.");
  ------------------
  |  |   93|     27|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|     27|    do {                                            \
  |  |  |  |   98|     27|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|     27|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 27, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|     27|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3304|     27|    return BLOSC2_ERROR_READ_BUFFER;
 3305|     27|  }
 3306|       |
 3307|  3.42k|  if (vlblocks && is_lazy && !context->special_type && !memcpyed) {
  ------------------
  |  Branch (3307:7): [True: 48, False: 3.37k]
  |  Branch (3307:19): [True: 2, False: 46]
  |  Branch (3307:30): [True: 2, False: 0]
  |  Branch (3307:56): [True: 2, False: 0]
  ------------------
 3308|      2|    size_t block_csizes_nbytes;
 3309|      2|    size_t trailer_meta_nbytes;
 3310|      2|    size_t lazy_trailer_end;
 3311|      2|    if (context->srcsize < 0 || context->nblocks < 0 ||
  ------------------
  |  Branch (3311:9): [True: 0, False: 2]
  |  Branch (3311:33): [True: 0, False: 2]
  ------------------
 3312|      2|        !blosc2_checked_mul_size((size_t)context->nblocks, sizeof(int32_t), &block_csizes_nbytes) ||
  ------------------
  |  Branch (3312:9): [True: 0, False: 2]
  ------------------
 3313|      2|        !blosc2_checked_add_size(sizeof(int32_t) + sizeof(int64_t), block_csizes_nbytes, &trailer_meta_nbytes) ||
  ------------------
  |  Branch (3313:9): [True: 0, False: 2]
  ------------------
 3314|      2|        !blosc2_checked_add_size((size_t)bstarts_end, trailer_meta_nbytes, &lazy_trailer_end) ||
  ------------------
  |  Branch (3314:9): [True: 0, False: 2]
  ------------------
 3315|      2|        (size_t)context->srcsize < lazy_trailer_end) {
  ------------------
  |  Branch (3315:9): [True: 1, False: 1]
  ------------------
 3316|      1|      BLOSC_TRACE_ERROR("Lazy trailer exceeds source buffer.");
  ------------------
  |  |   93|      1|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      1|    do {                                            \
  |  |  |  |   98|      1|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      1|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 1, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      1|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3317|      1|      return BLOSC2_ERROR_READ_BUFFER;
 3318|      1|    }
 3319|      2|  }
 3320|  3.42k|  srcsize -= bstarts_end;
 3321|       |
 3322|       |  /* Read optional dictionary if flag set.  A memcpyed chunk has none, even if the flag says so
 3323|       |     (older versions left it on chunks with a dictionary that did not compress) */
 3324|  3.42k|  if ((context->blosc2_flags & BLOSC2_USEDICT) && !memcpyed && !is_lazy) {
  ------------------
  |  Branch (3324:7): [True: 72, False: 3.34k]
  |  Branch (3324:51): [True: 71, False: 1]
  |  Branch (3324:64): [True: 55, False: 16]
  ------------------
 3325|     55|    context->use_dict = 1;
 3326|       |    // The dictionary section is after the bstarts block: [int32 size | raw bytes]
 3327|     55|    if (srcsize < (signed)sizeof(int32_t)) {
  ------------------
  |  Branch (3327:9): [True: 1, False: 54]
  ------------------
 3328|      1|      BLOSC_TRACE_ERROR("Not enough space to read size of dictionary.");
  ------------------
  |  |   93|      1|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      1|    do {                                            \
  |  |  |  |   98|      1|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      1|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 1, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      1|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3329|      1|      return BLOSC2_ERROR_READ_BUFFER;
 3330|      1|    }
 3331|     54|    srcsize -= sizeof(int32_t);
 3332|       |    // Read dictionary size
 3333|     54|    context->dict_size = sw32_(context->src + bstarts_end);
 3334|     54|    if (context->dict_size <= 0 || context->dict_size > BLOSC2_MAXDICTSIZE) {
  ------------------
  |  Branch (3334:9): [True: 20, False: 34]
  |  Branch (3334:36): [True: 18, False: 16]
  ------------------
 3335|     38|      BLOSC_TRACE_ERROR("Dictionary size is smaller than minimum or larger than maximum allowed.");
  ------------------
  |  |   93|     38|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|     38|    do {                                            \
  |  |  |  |   98|     38|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|     38|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 38, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|     38|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3336|     38|      return BLOSC2_ERROR_CODEC_DICT;
 3337|     38|    }
 3338|     16|    if (srcsize < (int32_t)context->dict_size) {
  ------------------
  |  Branch (3338:9): [True: 4, False: 12]
  ------------------
 3339|      4|      BLOSC_TRACE_ERROR("Not enough space to read entire dictionary.");
  ------------------
  |  |   93|      4|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      4|    do {                                            \
  |  |  |  |   98|      4|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      4|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 4, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      4|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3340|      4|      return BLOSC2_ERROR_READ_BUFFER;
 3341|      4|    }
 3342|     12|    srcsize -= context->dict_size;
 3343|       |    // dict_buffer points directly into the source chunk — no copy needed
 3344|     12|    context->dict_buffer = (void*)(context->src + bstarts_end + sizeof(int32_t));
 3345|     12|    context->dict_buffer_owned = false;
 3346|     12|#if defined(HAVE_ZSTD)
 3347|       |    // context->compcode during decompression holds the format code (flags >> 5),
 3348|       |    // so compare against BLOSC_ZSTD_FORMAT (not BLOSC_ZSTD).
 3349|     12|    if (context->compcode == BLOSC_ZSTD_FORMAT) {
  ------------------
  |  Branch (3349:9): [True: 11, False: 1]
  ------------------
 3350|     11|      context->dict_ddict = ZSTD_createDDict(context->dict_buffer, context->dict_size);
 3351|     11|      if (context->dict_ddict == NULL) {
  ------------------
  |  Branch (3351:11): [True: 0, False: 11]
  ------------------
 3352|      0|        BLOSC_TRACE_ERROR("Cannot create ZSTD dictionary for chunk.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3353|      0|        return BLOSC2_ERROR_CODEC_DICT;
 3354|      0|      }
 3355|     11|    }
 3356|     12|#endif   // HAVE_ZSTD
 3357|       |    // For LZ4/LZ4HC: dict_buffer and dict_size are sufficient; no digested object needed.
 3358|     12|  }
 3359|  3.36k|  else if ((context->blosc2_flags & BLOSC2_USEDICT) && !memcpyed && is_lazy) {
  ------------------
  |  Branch (3359:12): [True: 17, False: 3.34k]
  |  Branch (3359:56): [True: 16, False: 1]
  |  Branch (3359:69): [True: 16, False: 0]
  ------------------
 3360|     16|    rc = load_lazy_chunk_dict(context, header, bstarts_end);
 3361|     16|    if (rc < 0) {
  ------------------
  |  Branch (3361:9): [True: 16, False: 0]
  ------------------
 3362|     16|      return rc;
 3363|     16|    }
 3364|     16|  }
 3365|       |
 3366|  3.36k|  if (vlblocks && !context->special_type && !memcpyed) {
  ------------------
  |  Branch (3366:7): [True: 46, False: 3.31k]
  |  Branch (3366:19): [True: 46, False: 0]
  |  Branch (3366:45): [True: 46, False: 0]
  ------------------
 3367|     46|    context->blocknbytes = malloc((size_t)context->nblocks * sizeof(int32_t));
 3368|     46|    BLOSC_ERROR_NULL(context->blocknbytes, BLOSC2_ERROR_MEMORY_ALLOC);
  ------------------
  |  |  104|     46|    do {                                            \
  |  |  105|     46|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 46]
  |  |  ------------------
  |  |  106|      0|            BLOSC_TRACE_ERROR("Pointer is null");   \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  107|      0|            return (rc);                            \
  |  |  108|      0|        }                                           \
  |  |  109|     46|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 46]
  |  |  ------------------
  ------------------
 3369|     46|    context->blockoffsets = malloc((size_t)context->nblocks * sizeof(int32_t));
 3370|     46|    BLOSC_ERROR_NULL(context->blockoffsets, BLOSC2_ERROR_MEMORY_ALLOC);
  ------------------
  |  |  104|     46|    do {                                            \
  |  |  105|     46|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 46]
  |  |  ------------------
  |  |  106|      0|            BLOSC_TRACE_ERROR("Pointer is null");   \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  107|      0|            return (rc);                            \
  |  |  108|      0|        }                                           \
  |  |  109|     46|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 46]
  |  |  ------------------
  ------------------
 3371|     46|    context->blockcbytes = malloc((size_t)context->nblocks * sizeof(int32_t));
 3372|     46|    BLOSC_ERROR_NULL(context->blockcbytes, BLOSC2_ERROR_MEMORY_ALLOC);
  ------------------
  |  |  104|     46|    do {                                            \
  |  |  105|     46|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 46]
  |  |  ------------------
  |  |  106|      0|            BLOSC_TRACE_ERROR("Pointer is null");   \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  107|      0|            return (rc);                            \
  |  |  108|      0|        }                                           \
  |  |  109|     46|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 46]
  |  |  ------------------
  ------------------
 3373|       |
 3374|     46|    if (is_lazy) {
  ------------------
  |  Branch (3374:9): [True: 0, False: 46]
  ------------------
 3375|       |      // Lazy VL: block data is on disk, so blocknbytes is unknown at this point.
 3376|       |      // Populate blockcbytes from bstarts differences; blocksize gets max(blockcbytes)
 3377|       |      // as a safe upper bound so tmp buffers are large enough for the lazy block read.
 3378|      0|      int32_t max_csize = 0;
 3379|      0|      for (int32_t i = 0; i < context->nblocks; ++i) {
  ------------------
  |  Branch (3379:27): [True: 0, False: 0]
  ------------------
 3380|      0|        int32_t bstart = sw32_(context->bstarts + i);
 3381|      0|        int32_t next_bstart = (i + 1 < context->nblocks) ?
  ------------------
  |  Branch (3381:31): [True: 0, False: 0]
  ------------------
 3382|      0|            sw32_(context->bstarts + i + 1) : header->cbytes;
 3383|      0|        if (bstart < bstarts_end || next_bstart <= bstart ||
  ------------------
  |  Branch (3383:13): [True: 0, False: 0]
  |  Branch (3383:37): [True: 0, False: 0]
  ------------------
 3384|      0|            next_bstart > header->cbytes) {
  ------------------
  |  Branch (3384:13): [True: 0, False: 0]
  ------------------
 3385|      0|          BLOSC_TRACE_ERROR("Invalid VL-block offsets in lazy chunk.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3386|      0|          return BLOSC2_ERROR_INVALID_HEADER;
 3387|      0|        }
 3388|      0|        context->blocknbytes[i] = 0;   // unknown until block is read from disk
 3389|      0|        context->blockoffsets[i] = 0;  // unknown
 3390|      0|        context->blockcbytes[i] = next_bstart - bstart;
 3391|      0|        if (context->blockcbytes[i] > max_csize) {
  ------------------
  |  Branch (3391:13): [True: 0, False: 0]
  ------------------
 3392|      0|          max_csize = context->blockcbytes[i];
 3393|      0|        }
 3394|      0|      }
 3395|      0|      context->blocksize = max_csize;
 3396|      0|      context->leftover = 0;
 3397|      0|    }
 3398|     46|    else {
 3399|     46|      int32_t max_blocksize = 0;
 3400|     46|      int64_t total_nbytes = 0;
 3401|     46|      int32_t prev_bstart = 0;
 3402|     46|      for (int32_t i = 0; i < context->nblocks; ++i) {
  ------------------
  |  Branch (3402:27): [True: 46, False: 0]
  ------------------
 3403|     46|        int32_t bstart = sw32_(context->bstarts + i);
 3404|     46|        int32_t next_bstart = (i + 1 < context->nblocks) ?
  ------------------
  |  Branch (3404:31): [True: 46, False: 0]
  ------------------
 3405|     46|            sw32_(context->bstarts + i + 1) : header->cbytes;
 3406|     46|        if (bstart < bstarts_end || bstart <= prev_bstart || next_bstart <= bstart ||
  ------------------
  |  Branch (3406:13): [True: 5, False: 41]
  |  Branch (3406:37): [True: 0, False: 41]
  |  Branch (3406:62): [True: 17, False: 24]
  ------------------
 3407|     46|            next_bstart > header->cbytes || bstart > context->srcsize - (int32_t)sizeof(int32_t)) {
  ------------------
  |  Branch (3407:13): [True: 24, False: 0]
  |  Branch (3407:45): [True: 0, False: 0]
  ------------------
 3408|     46|          BLOSC_TRACE_ERROR("Invalid VL-block offsets in chunk.");
  ------------------
  |  |   93|     46|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|     46|    do {                                            \
  |  |  |  |   98|     46|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|     46|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 46, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|     46|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3409|     46|          return BLOSC2_ERROR_INVALID_HEADER;
 3410|     46|        }
 3411|      0|        context->blocknbytes[i] = sw32_(context->src + bstart);
 3412|      0|        context->blockcbytes[i] = next_bstart - bstart;
 3413|      0|        if (context->blocknbytes[i] <= 0) {
  ------------------
  |  Branch (3413:13): [True: 0, False: 0]
  ------------------
 3414|      0|          BLOSC_TRACE_ERROR("Invalid VL-block uncompressed size in chunk.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3415|      0|          return BLOSC2_ERROR_INVALID_HEADER;
 3416|      0|        }
 3417|      0|        if (total_nbytes > INT32_MAX) {
  ------------------
  |  Branch (3417:13): [True: 0, False: 0]
  ------------------
 3418|      0|          BLOSC_TRACE_ERROR("Invalid VL-block cumulative size in chunk.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3419|      0|          return BLOSC2_ERROR_INVALID_HEADER;
 3420|      0|        }
 3421|      0|        context->blockoffsets[i] = (int32_t)total_nbytes;
 3422|      0|        total_nbytes += context->blocknbytes[i];
 3423|      0|        if (total_nbytes > context->sourcesize) {
  ------------------
  |  Branch (3423:13): [True: 0, False: 0]
  ------------------
 3424|      0|          BLOSC_TRACE_ERROR("VL-block sizes exceed chunk nbytes.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3425|      0|          return BLOSC2_ERROR_INVALID_HEADER;
 3426|      0|        }
 3427|      0|        if (context->blocknbytes[i] > max_blocksize) {
  ------------------
  |  Branch (3427:13): [True: 0, False: 0]
  ------------------
 3428|      0|          max_blocksize = context->blocknbytes[i];
 3429|      0|        }
 3430|      0|        prev_bstart = bstart;
 3431|      0|      }
 3432|      0|      if (total_nbytes != context->sourcesize) {
  ------------------
  |  Branch (3432:11): [True: 0, False: 0]
  ------------------
 3433|      0|        BLOSC_TRACE_ERROR("VL-block sizes do not add up to chunk nbytes.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3434|      0|        return BLOSC2_ERROR_INVALID_HEADER;
 3435|      0|      }
 3436|      0|      context->blocksize = max_blocksize;
 3437|      0|      context->leftover = 0;
 3438|      0|    }
 3439|     46|  }
 3440|       |
 3441|  3.31k|  return 0;
 3442|  3.36k|}
blosc2.c:load_lazy_chunk_dict:
 3152|     16|static int load_lazy_chunk_dict(blosc2_context* context, blosc_header* header, int32_t bstarts_end) {
 3153|     16|  int32_t dict_offset = bstarts_end;
 3154|     16|  if (header->cbytes < dict_offset + (int32_t)sizeof(int32_t)) {
  ------------------
  |  Branch (3154:7): [True: 1, False: 15]
  ------------------
 3155|      1|    BLOSC_TRACE_ERROR("Lazy chunk dictionary header exceeds chunk length.");
  ------------------
  |  |   93|      1|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      1|    do {                                            \
  |  |  |  |   98|      1|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      1|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 1, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      1|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3156|      1|    return BLOSC2_ERROR_INVALID_HEADER;
 3157|      1|  }
 3158|       |
 3159|     15|  uint8_t dict_size_buf[sizeof(int32_t)];
 3160|     15|  int rc = read_lazy_chunk_bytes(context, dict_offset, dict_size_buf, (int32_t)sizeof(dict_size_buf),
 3161|     15|                                 "Cannot open frame file for lazy chunk dictionary read.",
 3162|     15|                                 "Cannot read lazy chunk dictionary size from disk.");
 3163|     15|  if (rc < 0) {
  ------------------
  |  Branch (3163:7): [True: 15, False: 0]
  ------------------
 3164|     15|    return rc;
 3165|     15|  }
 3166|       |
 3167|      0|  context->dict_size = sw32_(dict_size_buf);
 3168|      0|  if (context->dict_size <= 0 || context->dict_size > BLOSC2_MAXDICTSIZE) {
  ------------------
  |  Branch (3168:7): [True: 0, False: 0]
  |  Branch (3168:34): [True: 0, False: 0]
  ------------------
 3169|      0|    BLOSC_TRACE_ERROR("Dictionary size is smaller than minimum or larger than maximum allowed.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3170|      0|    return BLOSC2_ERROR_CODEC_DICT;
 3171|      0|  }
 3172|      0|  if (header->cbytes < dict_offset + (int32_t)sizeof(int32_t) + context->dict_size) {
  ------------------
  |  Branch (3172:7): [True: 0, False: 0]
  ------------------
 3173|      0|    BLOSC_TRACE_ERROR("Lazy chunk dictionary exceeds chunk length.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3174|      0|    return BLOSC2_ERROR_INVALID_HEADER;
 3175|      0|  }
 3176|       |
 3177|      0|  context->dict_buffer = malloc((size_t)context->dict_size);
 3178|      0|  BLOSC_ERROR_NULL(context->dict_buffer, BLOSC2_ERROR_MEMORY_ALLOC);
  ------------------
  |  |  104|      0|    do {                                            \
  |  |  105|      0|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 0]
  |  |  ------------------
  |  |  106|      0|            BLOSC_TRACE_ERROR("Pointer is null");   \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  107|      0|            return (rc);                            \
  |  |  108|      0|        }                                           \
  |  |  109|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
 3179|      0|  context->dict_buffer_owned = true;
 3180|      0|  rc = read_lazy_chunk_bytes(context, dict_offset + (int32_t)sizeof(int32_t),
 3181|      0|                             context->dict_buffer, context->dict_size,
 3182|      0|                             "Cannot open frame file for lazy chunk dictionary read.",
 3183|      0|                             "Cannot read lazy chunk dictionary from disk.");
 3184|      0|  if (rc < 0) {
  ------------------
  |  Branch (3184:7): [True: 0, False: 0]
  ------------------
 3185|      0|    release_context_dict_buffer(context);
 3186|      0|    return rc;
 3187|      0|  }
 3188|       |
 3189|      0|  context->use_dict = 1;
 3190|      0|#if defined(HAVE_ZSTD)
 3191|      0|  if (context->compcode == BLOSC_ZSTD_FORMAT) {
  ------------------
  |  Branch (3191:7): [True: 0, False: 0]
  ------------------
 3192|      0|    context->dict_ddict = ZSTD_createDDict(context->dict_buffer, context->dict_size);
 3193|      0|    if (context->dict_ddict == NULL) {
  ------------------
  |  Branch (3193:9): [True: 0, False: 0]
  ------------------
 3194|      0|      release_context_dict_buffer(context);
 3195|      0|      BLOSC_TRACE_ERROR("Cannot create ZSTD dictionary for lazy chunk.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3196|      0|      return BLOSC2_ERROR_CODEC_DICT;
 3197|      0|    }
 3198|      0|  }
 3199|      0|#endif
 3200|       |
 3201|      0|  return 0;
 3202|      0|}
blosc2.c:do_job:
 2836|  4.78k|static int do_job(blosc2_context* context) {
 2837|  4.78k|  int32_t ntbytes;
 2838|       |
 2839|       |  /* Set sentinels */
 2840|  4.78k|  context->dref_not_init = 1;
 2841|       |
 2842|       |  /* Apply thread-count changes before deciding whether this operation actually
 2843|       |     needs a parallel backend.  POSIX defers backend startup for serial jobs.
 2844|       |     Windows keeps its existing per-context thread lifecycle and starts/rebinds
 2845|       |     the backend eagerly. */
 2846|       |#if defined(_WIN32)
 2847|       |  int rc = check_nthreads(context, true);
 2848|       |#else
 2849|  4.78k|  int rc = check_nthreads(context, false);
 2850|  4.78k|#endif
 2851|       |
 2852|       |  /* Run serially with one thread, with fewer than two full blocks of source
 2853|       |     data, or if thread configuration/backend setup fails. */
 2854|  4.78k|  if (context->nthreads == 1 || (context->sourcesize / context->blocksize) <= 1 || rc < 0) {
  ------------------
  |  Branch (2854:7): [True: 4.05k, False: 730]
  |  Branch (2854:33): [True: 730, False: 0]
  |  Branch (2854:84): [True: 0, False: 0]
  ------------------
 2855|  4.78k|    ntbytes = run_serial_job(context);
 2856|  4.78k|  }
 2857|      0|  else {
 2858|      0|    rc = check_nthreads(context, true);
 2859|      0|    if (rc < 0) {
  ------------------
  |  Branch (2859:9): [True: 0, False: 0]
  ------------------
 2860|       |      /* Backend startup failed; run serially and retry on the next parallel job. */
 2861|      0|      ntbytes = run_serial_job(context);
 2862|      0|    }
 2863|      0|    else {
 2864|      0|      ntbytes = parallel_blosc(context);
 2865|      0|    }
 2866|      0|  }
 2867|       |
 2868|  4.78k|  return ntbytes;
 2869|  4.78k|}
blosc2.c:run_serial_job:
 2824|  4.78k|static int run_serial_job(blosc2_context* context) {
 2825|  4.78k|  struct thread_context* thread_context = serial_context_get(context);
 2826|  4.78k|  if (thread_context == NULL) {
  ------------------
  |  Branch (2826:7): [True: 0, False: 4.78k]
  ------------------
 2827|      0|    return BLOSC2_ERROR_THREAD_CREATE;
 2828|      0|  }
 2829|  4.78k|  int ntbytes = serial_blosc(thread_context);
 2830|  4.78k|  serial_context_put(thread_context);
 2831|  4.78k|  return ntbytes;
 2832|  4.78k|}
blosc2.c:serial_blosc:
 2571|  4.78k|static int serial_blosc(struct thread_context* thread_context) {
 2572|  4.78k|  blosc2_context* context = thread_context->parent_context;
 2573|  4.78k|  bool vlblocks = (context->blosc2_flags2 & BLOSC2_VL_BLOCKS) != 0;
 2574|  4.78k|  int32_t j, bsize, leftoverblock;
 2575|  4.78k|  int32_t cbytes;
 2576|  4.78k|  int32_t ntbytes = context->output_bytes;
 2577|  4.78k|  int32_t* bstarts = context->bstarts;
 2578|  4.78k|  uint8_t* tmp = thread_context->tmp;
 2579|  4.78k|  uint8_t* tmp2 = thread_context->tmp2;
 2580|  4.78k|  int dict_training = context->use_dict && (context->dict_cdict == NULL);
  ------------------
  |  Branch (2580:23): [True: 12, False: 4.76k]
  |  Branch (2580:44): [True: 12, False: 0]
  ------------------
 2581|  4.78k|  bool memcpyed = context->header_flags & (uint8_t)BLOSC_MEMCPYED;
 2582|  4.78k|  if (!context->do_compress && context->special_type) {
  ------------------
  |  Branch (2582:7): [True: 3.31k, False: 1.46k]
  |  Branch (2582:32): [True: 222, False: 3.09k]
  ------------------
 2583|       |    // Fake a runlen as if it was a memcpyed chunk
 2584|    222|    memcpyed = true;
 2585|    222|  }
 2586|       |
 2587|  35.4M|  for (j = 0; j < context->nblocks; j++) {
  ------------------
  |  Branch (2587:15): [True: 35.4M, False: 3.65k]
  ------------------
 2588|  35.4M|    if (context->do_compress && !memcpyed && !dict_training) {
  ------------------
  |  Branch (2588:9): [True: 10.0k, False: 35.4M]
  |  Branch (2588:33): [True: 7.96k, False: 2.07k]
  |  Branch (2588:46): [True: 7.96k, False: 0]
  ------------------
 2589|  7.96k|      _sw32(bstarts + j, ntbytes);
 2590|  7.96k|    }
 2591|  35.4M|    bsize = vlblocks ? context->blocknbytes[j] : context->blocksize;
  ------------------
  |  Branch (2591:13): [True: 0, False: 35.4M]
  ------------------
 2592|  35.4M|    leftoverblock = 0;
 2593|  35.4M|    if (!vlblocks && (j == context->nblocks - 1) && (context->leftover > 0)) {
  ------------------
  |  Branch (2593:9): [True: 35.4M, False: 0]
  |  Branch (2593:22): [True: 4.55k, False: 35.4M]
  |  Branch (2593:53): [True: 216, False: 4.34k]
  ------------------
 2594|    216|      bsize = context->leftover;
 2595|    216|      leftoverblock = 1;
 2596|    216|    }
 2597|  35.4M|    if (context->do_compress) {
  ------------------
  |  Branch (2597:9): [True: 10.0k, False: 35.4M]
  ------------------
 2598|  10.0k|      if (memcpyed && !context->prefilter) {
  ------------------
  |  Branch (2598:11): [True: 2.07k, False: 7.96k]
  |  Branch (2598:23): [True: 405, False: 1.66k]
  ------------------
 2599|       |        /* We want to memcpy only */
 2600|    405|        memcpy(context->dest + context->header_overhead + j * context->blocksize,
 2601|    405|               context->src + j * context->blocksize, (unsigned int)bsize);
 2602|    405|        cbytes = (int32_t)bsize;
 2603|    405|      }
 2604|  9.62k|      else {
 2605|       |        /* Regular compression */
 2606|  9.62k|        cbytes = blosc_c(thread_context, bsize, leftoverblock, ntbytes,
 2607|  9.62k|                         context->destsize,
 2608|  9.62k|                         vlblocks ? context->vlblock_sources[j] : context->src,
  ------------------
  |  Branch (2608:26): [True: 0, False: 9.62k]
  ------------------
 2609|  9.62k|                         vlblocks ? 0 : j * context->blocksize,
  ------------------
  |  Branch (2609:26): [True: 0, False: 9.62k]
  ------------------
 2610|  9.62k|                         context->dest + ntbytes, tmp, tmp2);
 2611|  9.62k|        if (cbytes == 0) {
  ------------------
  |  Branch (2611:13): [True: 245, False: 9.38k]
  ------------------
 2612|    245|          ntbytes = 0;              /* incompressible data */
 2613|    245|          break;
 2614|    245|        }
 2615|  9.62k|      }
 2616|  10.0k|    }
 2617|  35.4M|    else {
 2618|       |      /* Regular decompression */
 2619|       |      // If memcpyed we don't have a bstarts section (because it is not needed)
 2620|  35.4M|      int32_t src_offset = memcpyed ?
  ------------------
  |  Branch (2620:28): [True: 35.3M, False: 12.1k]
  ------------------
 2621|  35.3M|          context->header_overhead + j * context->blocksize : sw32_(bstarts + j);
 2622|  35.4M|      uint8_t *dest_block = (vlblocks && context->vlblock_dests != NULL) ? context->vlblock_dests[j] : context->dest;
  ------------------
  |  Branch (2622:30): [True: 0, False: 35.4M]
  |  Branch (2622:42): [True: 0, False: 0]
  ------------------
 2623|  35.4M|      int32_t dest_offset = (vlblocks && context->vlblock_dests != NULL) ? 0 :
  ------------------
  |  Branch (2623:30): [True: 0, False: 35.4M]
  |  Branch (2623:42): [True: 0, False: 0]
  ------------------
 2624|  35.4M|                            (vlblocks ? context->blockoffsets[j] : j * context->blocksize);
  ------------------
  |  Branch (2624:30): [True: 0, False: 35.4M]
  ------------------
 2625|  35.4M|      cbytes = blosc_d(thread_context, bsize, leftoverblock, memcpyed,
 2626|  35.4M|                       context->src, context->srcsize, src_offset, j,
 2627|  35.4M|                       dest_block, dest_offset, tmp, tmp2);
 2628|  35.4M|    }
 2629|       |
 2630|  35.4M|    if (cbytes < 0) {
  ------------------
  |  Branch (2630:9): [True: 878, False: 35.4M]
  ------------------
 2631|    878|      ntbytes = cbytes;         /* error in blosc_c or blosc_d */
 2632|    878|      break;
 2633|    878|    }
 2634|  35.4M|    ntbytes += cbytes;
 2635|  35.4M|  }
 2636|       |
 2637|  4.78k|  return ntbytes;
 2638|  4.78k|}
blosc2.c:blosc_c:
 1579|  9.62k|                   uint8_t* tmp, uint8_t* tmp2) {
 1580|  9.62k|  blosc2_context* context = thread_context->parent_context;
 1581|  9.62k|  int dont_split = (context->header_flags & 0x10) >> 4;
 1582|  9.62k|  bool vlblocks = (context->blosc2_flags2 & BLOSC2_VL_BLOCKS) != 0;
 1583|  9.62k|  int dict_training = context->use_dict && context->dict_cdict == NULL;
  ------------------
  |  Branch (1583:23): [True: 0, False: 9.62k]
  |  Branch (1583:44): [True: 0, False: 0]
  ------------------
 1584|  9.62k|  int32_t j, neblock, nstreams;
 1585|  9.62k|  int32_t cbytes;                   /* number of compressed bytes in split */
 1586|  9.62k|  int32_t ctbytes = 0;              /* number of compressed bytes in block */
 1587|  9.62k|  int32_t maxout;
 1588|  9.62k|  int32_t typesize = context->typesize;
 1589|  9.62k|  bool output_is_disposable = (context->preparams != NULL) ? context->preparams->output_is_disposable : false;
  ------------------
  |  Branch (1589:31): [True: 8.18k, False: 1.43k]
  ------------------
 1590|  9.62k|  const char* compname;
 1591|  9.62k|  int accel;
 1592|  9.62k|  const uint8_t* _src;
 1593|  9.62k|  uint8_t *_tmp = tmp, *_tmp2 = tmp2;
 1594|  9.62k|  int last_filter_index = last_filter(context, 'c');
 1595|  9.62k|  bool memcpyed = context->header_flags & (uint8_t)BLOSC_MEMCPYED;
 1596|  9.62k|  bool instr_codec = context->blosc2_flags & BLOSC2_INSTR_CODEC;
 1597|  9.62k|  blosc_timestamp_t last, current;
 1598|  9.62k|  float filter_time = 0.f;
 1599|       |
 1600|  9.62k|  if (instr_codec) {
  ------------------
  |  Branch (1600:7): [True: 0, False: 9.62k]
  ------------------
 1601|      0|    blosc_set_timestamp(&last);
 1602|      0|  }
 1603|       |
 1604|       |  // See whether we have a run here
 1605|  9.62k|  if (last_filter_index >= 0 || context->prefilter != NULL) {
  ------------------
  |  Branch (1605:7): [True: 9.62k, False: 0]
  |  Branch (1605:33): [True: 0, False: 0]
  ------------------
 1606|       |    /* Apply the filter pipeline just for the prefilter */
 1607|  9.62k|    if (memcpyed && context->prefilter != NULL) {
  ------------------
  |  Branch (1607:9): [True: 1.66k, False: 7.96k]
  |  Branch (1607:21): [True: 1.66k, False: 0]
  ------------------
 1608|       |      // We only need the prefilter output
 1609|  1.66k|      _src = pipeline_forward(thread_context, bsize, src, offset, dest, _tmp2);
 1610|  1.66k|      if (_src == NULL) {
  ------------------
  |  Branch (1610:11): [True: 0, False: 1.66k]
  ------------------
 1611|      0|        return BLOSC2_ERROR_FILTER_PIPELINE;
 1612|      0|      }
 1613|  1.66k|      return bsize;
 1614|  1.66k|    }
 1615|       |    /* Apply regular filter pipeline */
 1616|  7.96k|    _src = pipeline_forward(thread_context, bsize, src, offset, _tmp, _tmp2);
 1617|  7.96k|    if (_src == NULL) {
  ------------------
  |  Branch (1617:9): [True: 1, False: 7.95k]
  ------------------
 1618|      1|      return BLOSC2_ERROR_FILTER_PIPELINE;
 1619|      1|    }
 1620|  7.96k|  } else {
 1621|      0|    _src = src + offset;
 1622|      0|  }
 1623|       |
 1624|  7.95k|  if (instr_codec) {
  ------------------
  |  Branch (1624:7): [True: 0, False: 7.95k]
  ------------------
 1625|      0|    blosc_set_timestamp(&current);
 1626|      0|    filter_time = (float) blosc_elapsed_secs(last, current);
 1627|      0|    last = current;
 1628|      0|  }
 1629|       |
 1630|  7.95k|  assert(context->clevel > 0);
 1631|       |
 1632|       |  /* Calculate acceleration for different compressors */
 1633|  7.95k|  accel = get_accel(context);
 1634|       |
 1635|       |  /* The number of compressed data streams for this block */
 1636|  7.95k|  if (!dont_split && !leftoverblock && !dict_training) {
  ------------------
  |  Branch (1636:7): [True: 0, False: 7.95k]
  |  Branch (1636:22): [True: 0, False: 0]
  |  Branch (1636:40): [True: 0, False: 0]
  ------------------
 1637|      0|    nstreams = (int32_t)typesize;
 1638|      0|  }
 1639|  7.95k|  else {
 1640|  7.95k|    nstreams = 1;
 1641|  7.95k|  }
 1642|  7.95k|  neblock = bsize / nstreams;
 1643|  15.6k|  for (j = 0; j < nstreams; j++) {
  ------------------
  |  Branch (1643:15): [True: 7.95k, False: 7.71k]
  ------------------
 1644|  7.95k|    if (instr_codec) {
  ------------------
  |  Branch (1644:9): [True: 0, False: 7.95k]
  ------------------
 1645|      0|      blosc_set_timestamp(&last);
 1646|      0|    }
 1647|  7.95k|    if (!dict_training) {
  ------------------
  |  Branch (1647:9): [True: 7.95k, False: 0]
  ------------------
 1648|  7.95k|      dest += sizeof(int32_t);
 1649|  7.95k|      ntbytes += sizeof(int32_t);
 1650|  7.95k|      ctbytes += sizeof(int32_t);
 1651|       |
 1652|  7.95k|      if (!vlblocks && context->header_overhead == BLOSC_EXTENDED_HEADER_LENGTH && output_is_disposable) {
  ------------------
  |  Branch (1652:11): [True: 7.95k, False: 0]
  |  Branch (1652:24): [True: 7.95k, False: 0]
  |  Branch (1652:84): [True: 0, False: 7.95k]
  ------------------
 1653|       |        // Simulate a run of 0s
 1654|      0|        memset(dest - 4, 0, sizeof(int32_t));
 1655|      0|        continue;
 1656|      0|      }
 1657|       |
 1658|  7.95k|      const uint8_t *ip = (uint8_t *) _src + j * neblock;
 1659|  7.95k|      const uint8_t *ipbound = (uint8_t *) _src + (j + 1) * neblock;
 1660|       |
 1661|  7.95k|      if (!vlblocks && context->header_overhead == BLOSC_EXTENDED_HEADER_LENGTH && get_run(ip, ipbound)) {
  ------------------
  |  Branch (1661:11): [True: 7.95k, False: 0]
  |  Branch (1661:24): [True: 7.95k, False: 0]
  |  Branch (1661:84): [True: 1.17k, False: 6.78k]
  ------------------
 1662|       |        // A run
 1663|  1.17k|        int32_t value = _src[j * neblock];
 1664|  1.17k|        if (ntbytes > destsize) {
  ------------------
  |  Branch (1664:13): [True: 0, False: 1.17k]
  ------------------
 1665|      0|          return 0;    /* Non-compressible data */
 1666|      0|        }
 1667|       |
 1668|  1.17k|        if (instr_codec) {
  ------------------
  |  Branch (1668:13): [True: 0, False: 1.17k]
  ------------------
 1669|      0|          blosc_set_timestamp(&current);
 1670|      0|          int32_t instr_size = sizeof(blosc2_instr);
 1671|      0|          ntbytes += instr_size;
 1672|      0|          ctbytes += instr_size;
 1673|      0|          if (ntbytes > destsize) {
  ------------------
  |  Branch (1673:15): [True: 0, False: 0]
  ------------------
 1674|      0|            return 0;    /* Non-compressible data */
 1675|      0|          }
 1676|      0|          _sw32(dest - 4, instr_size);
 1677|      0|          blosc2_instr *desti = (blosc2_instr *)dest;
 1678|      0|          memset(desti, 0, sizeof(blosc2_instr));
 1679|       |          // Special values have an overhead of about 1 int32
 1680|      0|          int32_t ssize = value == 0 ? sizeof(int32_t) : sizeof(int32_t) + 1;
  ------------------
  |  Branch (1680:27): [True: 0, False: 0]
  ------------------
 1681|      0|          desti->cratio = (float) neblock / (float) ssize;
 1682|      0|          float ctime = (float) blosc_elapsed_secs(last, current);
 1683|      0|          desti->cspeed = (float) neblock / ctime;
 1684|      0|          desti->filter_speed = (float) neblock / filter_time;
 1685|      0|          desti->flags[0] = 1;    // mark a runlen
 1686|      0|          dest += instr_size;
 1687|      0|          continue;
 1688|      0|        }
 1689|       |
 1690|       |        // Encode the repeated byte in the first (LSB) byte of the length of the split.
 1691|  1.17k|        _sw32(dest - 4, -value);    // write the value in two's complement
 1692|  1.17k|        if (value > 0) {
  ------------------
  |  Branch (1692:13): [True: 49, False: 1.12k]
  ------------------
 1693|       |          // Mark encoding as a run-length (== 0 is always a 0's run)
 1694|     49|          ntbytes += 1;
 1695|     49|          ctbytes += 1;
 1696|     49|          if (ntbytes > destsize) {
  ------------------
  |  Branch (1696:15): [True: 0, False: 49]
  ------------------
 1697|      0|            return 0;    /* Non-compressible data */
 1698|      0|          }
 1699|       |          // Set MSB bit (sign) to 1 (not really necessary here, but for demonstration purposes)
 1700|       |          // dest[-1] |= 0x80;
 1701|     49|          dest[0] = 0x1;   // set run-length bit (0) in token
 1702|     49|          dest += 1;
 1703|     49|        }
 1704|  1.17k|        continue;
 1705|  1.17k|      }
 1706|  7.95k|    }
 1707|       |
 1708|  6.78k|    maxout = neblock;
 1709|  6.78k|    if (ntbytes + maxout > destsize && !instr_codec) {
  ------------------
  |  Branch (1709:9): [True: 847, False: 5.93k]
  |  Branch (1709:40): [True: 847, False: 0]
  ------------------
 1710|       |      /* avoid buffer * overrun */
 1711|    847|      maxout = destsize - ntbytes;
 1712|    847|      if (maxout <= 0) {
  ------------------
  |  Branch (1712:11): [True: 22, False: 825]
  ------------------
 1713|     22|        return 0;                  /* non-compressible block */
 1714|     22|      }
 1715|    847|    }
 1716|  6.76k|    if (dict_training) {
  ------------------
  |  Branch (1716:9): [True: 0, False: 6.76k]
  ------------------
 1717|       |      // We are in the build dict state, so don't compress
 1718|       |      // TODO: copy only a percentage for sampling
 1719|      0|      memcpy(dest, _src + j * neblock, (unsigned int)neblock);
 1720|      0|      cbytes = (int32_t)neblock;
 1721|      0|    }
 1722|  6.76k|    else if (context->compcode == BLOSC_BLOSCLZ) {
  ------------------
  |  Branch (1722:14): [True: 2.18k, False: 4.57k]
  ------------------
 1723|  2.18k|      if (thread_context->blosclz_state == NULL) {
  ------------------
  |  Branch (1723:11): [True: 47, False: 2.13k]
  ------------------
 1724|     47|        thread_context->blosclz_state = calloc(1, sizeof(blosclz_state));
 1725|     47|      }
 1726|  2.18k|      cbytes = thread_context->blosclz_state != NULL ?
  ------------------
  |  Branch (1726:16): [True: 2.18k, False: 0]
  ------------------
 1727|  2.18k|               blosclz_compress_state(context->clevel, _src + j * neblock, (int)neblock,
 1728|  2.18k|                                      dest, maxout, thread_context->blosclz_state) :
 1729|  2.18k|               blosclz_compress(context->clevel, _src + j * neblock, (int)neblock,
 1730|      0|                                dest, maxout, context);
 1731|  2.18k|    }
 1732|  4.57k|    else if (context->compcode == BLOSC_LZ4) {
  ------------------
  |  Branch (1732:14): [True: 82, False: 4.49k]
  ------------------
 1733|     82|      cbytes = lz4_wrap_compress((char*)_src + j * neblock, (size_t)neblock,
 1734|     82|                                 (char*)dest, (size_t)maxout, accel,
 1735|     82|                                 thread_context);
 1736|     82|    }
 1737|  4.49k|    else if (context->compcode == BLOSC_LZ4HC) {
  ------------------
  |  Branch (1737:14): [True: 0, False: 4.49k]
  ------------------
 1738|      0|      cbytes = lz4hc_wrap_compress((char*)_src + j * neblock, (size_t)neblock,
 1739|      0|                                   (char*)dest, (size_t)maxout, context->clevel,
 1740|      0|                                   thread_context);
 1741|      0|    }
 1742|  4.49k|  #if defined(HAVE_ZLIB)
 1743|  4.49k|    else if (context->compcode == BLOSC_ZLIB) {
  ------------------
  |  Branch (1743:14): [True: 0, False: 4.49k]
  ------------------
 1744|      0|      cbytes = zlib_wrap_compress((char*)_src + j * neblock, (size_t)neblock,
 1745|      0|                                  (char*)dest, (size_t)maxout, context->clevel);
 1746|      0|    }
 1747|  4.49k|  #endif /* HAVE_ZLIB */
 1748|  4.49k|  #if defined(HAVE_ZSTD)
 1749|  4.49k|    else if (context->compcode == BLOSC_ZSTD) {
  ------------------
  |  Branch (1749:14): [True: 4.36k, False: 131]
  ------------------
 1750|  4.36k|      cbytes = zstd_wrap_compress(thread_context,
 1751|  4.36k|                                  (char*)_src + j * neblock, (size_t)neblock,
 1752|  4.36k|                                  (char*)dest, (size_t)maxout, context->clevel);
 1753|  4.36k|    }
 1754|    131|  #endif /* HAVE_ZSTD */
 1755|    131|    else if (context->compcode > BLOSC2_DEFINED_CODECS_STOP) {
  ------------------
  |  Branch (1755:14): [True: 131, False: 0]
  ------------------
 1756|    426|      for (int i = 0; i < g_ncodecs; ++i) {
  ------------------
  |  Branch (1756:23): [True: 426, False: 0]
  ------------------
 1757|    426|        if (g_codecs[i].compcode == context->compcode) {
  ------------------
  |  Branch (1757:13): [True: 131, False: 295]
  ------------------
 1758|    131|          if (load_acquire_ptr(&g_codecs[i].decoder) == NULL) {
  ------------------
  |  |  144|    131|#define load_acquire_ptr(p) __atomic_load_n((p), __ATOMIC_ACQUIRE)
  ------------------
  |  Branch (1758:15): [True: 0, False: 131]
  ------------------
 1759|       |            // Dynamically load codec plugin
 1760|      0|            if (fill_codec(&g_codecs[i]) < 0) {
  ------------------
  |  Branch (1760:17): [True: 0, False: 0]
  ------------------
 1761|      0|              BLOSC_TRACE_ERROR("Could not load codec %d.", g_codecs[i].compcode);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1762|      0|              return BLOSC2_ERROR_CODEC_SUPPORT;
 1763|      0|            }
 1764|      0|          }
 1765|    131|          blosc2_cparams cparams;
 1766|    131|          blosc2_ctx_get_cparams(context, &cparams);
 1767|    131|          cbytes = g_codecs[i].encoder(_src + j * neblock,
 1768|    131|                                        neblock,
 1769|    131|                                        dest,
 1770|    131|                                        maxout,
 1771|    131|                                        context->compcode_meta,
 1772|    131|                                        &cparams,
 1773|    131|                                        context->src);
 1774|    131|          goto urcodecsuccess;
 1775|    131|        }
 1776|    426|      }
 1777|      0|      BLOSC_TRACE_ERROR("User-defined compressor codec %d not found during compression", context->compcode);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1778|      0|      return BLOSC2_ERROR_CODEC_SUPPORT;
 1779|    131|    urcodecsuccess:
 1780|    131|      ;
 1781|    131|    } else {
 1782|      0|      blosc2_compcode_to_compname(context->compcode, &compname);
 1783|      0|      BLOSC_TRACE_ERROR("Blosc has not been compiled with '%s' compression support."
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1784|      0|                        "Please use one having it.", compname);
 1785|      0|      return BLOSC2_ERROR_CODEC_SUPPORT;
 1786|      0|    }
 1787|       |
 1788|  6.76k|    if (cbytes > maxout) {
  ------------------
  |  Branch (1788:9): [True: 0, False: 6.76k]
  ------------------
 1789|       |      /* Buffer overrun caused by compression (should never happen) */
 1790|      0|      return BLOSC2_ERROR_WRITE_BUFFER;
 1791|      0|    }
 1792|  6.76k|    if (cbytes < 0) {
  ------------------
  |  Branch (1792:9): [True: 0, False: 6.76k]
  ------------------
 1793|       |      /* cbytes should never be negative */
 1794|      0|      return BLOSC2_ERROR_DATA;
 1795|      0|    }
 1796|  6.76k|    if (cbytes == 0) {
  ------------------
  |  Branch (1796:9): [True: 2.19k, False: 4.56k]
  ------------------
 1797|       |      // When cbytes is 0, the compressor has not been able to compress anything
 1798|  2.19k|      cbytes = neblock;
 1799|  2.19k|    }
 1800|       |
 1801|  6.76k|    if (instr_codec) {
  ------------------
  |  Branch (1801:9): [True: 0, False: 6.76k]
  ------------------
 1802|      0|      blosc_set_timestamp(&current);
 1803|      0|      int32_t instr_size = sizeof(blosc2_instr);
 1804|      0|      ntbytes += instr_size;
 1805|      0|      ctbytes += instr_size;
 1806|      0|      if (ntbytes > destsize) {
  ------------------
  |  Branch (1806:11): [True: 0, False: 0]
  ------------------
 1807|      0|        return 0;    /* Non-compressible data */
 1808|      0|      }
 1809|      0|      _sw32(dest - 4, vlblocks ? neblock : instr_size);
  ------------------
  |  Branch (1809:23): [True: 0, False: 0]
  ------------------
 1810|      0|      float ctime = (float)blosc_elapsed_secs(last, current);
 1811|      0|      blosc2_instr *desti = (blosc2_instr *)dest;
 1812|      0|      memset(desti, 0, sizeof(blosc2_instr));
 1813|       |      // cratio is computed having into account 1 additional int (csize)
 1814|      0|      desti->cratio = (float)neblock / (float)(cbytes + sizeof(int32_t));
 1815|      0|      desti->cspeed = (float)neblock / ctime;
 1816|      0|      desti->filter_speed = (float) neblock / filter_time;
 1817|      0|      dest += instr_size;
 1818|      0|      continue;
 1819|      0|    }
 1820|       |
 1821|  6.76k|    if (!dict_training) {
  ------------------
  |  Branch (1821:9): [True: 6.76k, False: 0]
  ------------------
 1822|  6.76k|      if (cbytes == neblock) {
  ------------------
  |  Branch (1822:11): [True: 2.19k, False: 4.56k]
  ------------------
 1823|       |        /* The compressor has been unable to compress data at all. */
 1824|       |        /* Before doing the copy, check that we are not running into a
 1825|       |           buffer overflow. */
 1826|  2.19k|        if ((ntbytes + neblock) > destsize) {
  ------------------
  |  Branch (1826:13): [True: 223, False: 1.97k]
  ------------------
 1827|    223|          return 0;    /* Non-compressible data */
 1828|    223|        }
 1829|  1.97k|        memcpy(dest, _src + j * neblock, (unsigned int)neblock);
 1830|  1.97k|        cbytes = neblock;
 1831|  1.97k|      }
 1832|  6.53k|      _sw32(dest - 4, vlblocks ? neblock : cbytes);
  ------------------
  |  Branch (1832:23): [True: 0, False: 6.53k]
  ------------------
 1833|  6.53k|    }
 1834|  6.53k|    dest += cbytes;
 1835|  6.53k|    ntbytes += cbytes;
 1836|  6.53k|    ctbytes += cbytes;
 1837|  6.53k|  }  /* Closes j < nstreams */
 1838|       |
 1839|  7.71k|  return ctbytes;
 1840|  7.95k|}
blosc2.c:get_accel:
  777|  7.95k|static int get_accel(const blosc2_context* context) {
  778|  7.95k|  int clevel = context->clevel;
  779|       |
  780|  7.95k|  if (context->compcode == BLOSC_LZ4) {
  ------------------
  |  Branch (780:7): [True: 329, False: 7.63k]
  ------------------
  781|       |    /* This acceleration setting based on discussions held in:
  782|       |     * https://groups.google.com/forum/#!topic/lz4c/zosy90P8MQw
  783|       |     */
  784|    329|    return (10 - clevel);
  785|    329|  }
  786|  7.63k|  return 1;
  787|  7.95k|}
blosc2.c:get_run:
 1482|  7.95k|static bool get_run(const uint8_t* ip, const uint8_t* ip_bound) {
 1483|  7.95k|  uint8_t x = *ip;
 1484|  7.95k|  int64_t value, value2;
 1485|       |  /* Broadcast the value for every byte in a 64-bit register */
 1486|  7.95k|  memset(&value, x, 8);
 1487|  7.95k|#if defined(BLOSC_RUN_SSE2) || defined(BLOSC_RUN_NEON)
 1488|  7.95k|  if (ip_bound - ip >= 64) {
  ------------------
  |  Branch (1488:7): [True: 7.32k, False: 639]
  ------------------
 1489|       |    /* Streams that are not runs mostly differ in their first bytes */
 1490|  7.32k|    memcpy(&value2, ip, 8);
 1491|  7.32k|    if (value != value2) {
  ------------------
  |  Branch (1491:9): [True: 5.84k, False: 1.48k]
  ------------------
 1492|  5.84k|      return false;
 1493|  5.84k|    }
 1494|  7.32k|  }
 1495|  2.11k|#endif
 1496|  2.11k|#if defined(BLOSCLZ_AVX2_ENABLED)
 1497|  2.11k|  if (ip_bound - ip >= 128 && blosc_cpu_has_avx2()) {
  ------------------
  |  Branch (1497:7): [True: 1.10k, False: 1.01k]
  |  Branch (1497:31): [True: 1.10k, False: 0]
  ------------------
 1498|  1.10k|    return blosc_get_run_avx2(ip, ip_bound);
 1499|  1.10k|  }
 1500|  1.01k|#endif
 1501|  1.01k|#if defined(BLOSC_RUN_SSE2)
 1502|  1.01k|  const __m128i vx = _mm_set1_epi8((char)x);
 1503|  1.26k|  while (ip_bound - ip >= 64) {
  ------------------
  |  Branch (1503:10): [True: 374, False: 888]
  ------------------
 1504|    374|    const __m128i* p = (const __m128i*)ip;
 1505|    374|    __m128i eq01 = _mm_and_si128(_mm_cmpeq_epi8(_mm_loadu_si128(p), vx),
 1506|    374|                                 _mm_cmpeq_epi8(_mm_loadu_si128(p + 1), vx));
 1507|    374|    __m128i eq23 = _mm_and_si128(_mm_cmpeq_epi8(_mm_loadu_si128(p + 2), vx),
 1508|    374|                                 _mm_cmpeq_epi8(_mm_loadu_si128(p + 3), vx));
 1509|    374|    if (_mm_movemask_epi8(_mm_and_si128(eq01, eq23)) != 0xFFFF) {
  ------------------
  |  Branch (1509:9): [True: 125, False: 249]
  ------------------
 1510|    125|      return false;
 1511|    125|    }
 1512|    249|    ip += 64;
 1513|    249|  }
 1514|       |#elif defined(BLOSC_RUN_NEON)
 1515|       |  if (x == 0) {
 1516|       |    while (ip_bound - ip >= 128) {
 1517|       |      uint8x16_t d01 = vorrq_u8(vld1q_u8(ip), vld1q_u8(ip + 16));
 1518|       |      uint8x16_t d23 = vorrq_u8(vld1q_u8(ip + 32), vld1q_u8(ip + 48));
 1519|       |      uint8x16_t d45 = vorrq_u8(vld1q_u8(ip + 64), vld1q_u8(ip + 80));
 1520|       |      uint8x16_t d67 = vorrq_u8(vld1q_u8(ip + 96), vld1q_u8(ip + 112));
 1521|       |      if (vmaxvq_u32(vreinterpretq_u32_u8(vorrq_u8(vorrq_u8(d01, d23),
 1522|       |                                                  vorrq_u8(d45, d67)))) != 0) {
 1523|       |        return false;
 1524|       |      }
 1525|       |      ip += 128;
 1526|       |    }
 1527|       |    if (ip_bound - ip >= 64) {
 1528|       |      uint8x16_t d01 = vorrq_u8(vld1q_u8(ip), vld1q_u8(ip + 16));
 1529|       |      uint8x16_t d23 = vorrq_u8(vld1q_u8(ip + 32), vld1q_u8(ip + 48));
 1530|       |      if (vmaxvq_u32(vreinterpretq_u32_u8(vorrq_u8(d01, d23))) != 0) {
 1531|       |        return false;
 1532|       |      }
 1533|       |      ip += 64;
 1534|       |    }
 1535|       |  }
 1536|       |  else {
 1537|       |    const uint8x16_t vx = vdupq_n_u8(x);
 1538|       |    while (ip_bound - ip >= 128) {
 1539|       |      uint8x16_t d01 = vorrq_u8(veorq_u8(vld1q_u8(ip), vx), veorq_u8(vld1q_u8(ip + 16), vx));
 1540|       |      uint8x16_t d23 = vorrq_u8(veorq_u8(vld1q_u8(ip + 32), vx), veorq_u8(vld1q_u8(ip + 48), vx));
 1541|       |      uint8x16_t d45 = vorrq_u8(veorq_u8(vld1q_u8(ip + 64), vx), veorq_u8(vld1q_u8(ip + 80), vx));
 1542|       |      uint8x16_t d67 = vorrq_u8(veorq_u8(vld1q_u8(ip + 96), vx), veorq_u8(vld1q_u8(ip + 112), vx));
 1543|       |      if (vmaxvq_u32(vreinterpretq_u32_u8(vorrq_u8(vorrq_u8(d01, d23),
 1544|       |                                                  vorrq_u8(d45, d67)))) != 0) {
 1545|       |        return false;
 1546|       |      }
 1547|       |      ip += 128;
 1548|       |    }
 1549|       |    if (ip_bound - ip >= 64) {
 1550|       |      uint8x16_t d01 = vorrq_u8(veorq_u8(vld1q_u8(ip), vx), veorq_u8(vld1q_u8(ip + 16), vx));
 1551|       |      uint8x16_t d23 = vorrq_u8(veorq_u8(vld1q_u8(ip + 32), vx), veorq_u8(vld1q_u8(ip + 48), vx));
 1552|       |      if (vmaxvq_u32(vreinterpretq_u32_u8(vorrq_u8(d01, d23))) != 0) {
 1553|       |        return false;
 1554|       |      }
 1555|       |      ip += 64;
 1556|       |    }
 1557|       |  }
 1558|       |#endif
 1559|  1.93k|  while (ip < (ip_bound - 8)) {
  ------------------
  |  Branch (1559:10): [True: 1.17k, False: 762]
  ------------------
 1560|  1.17k|    memcpy(&value2, ip, 8);
 1561|  1.17k|    if (value != value2) {
  ------------------
  |  Branch (1561:9): [True: 126, False: 1.04k]
  ------------------
 1562|       |      // Values differ.  We don't have a run.
 1563|    126|      return false;
 1564|    126|    }
 1565|  1.04k|    else {
 1566|  1.04k|      ip += 8;
 1567|  1.04k|    }
 1568|  1.17k|  }
 1569|       |  /* Look into the remainder */
 1570|  4.79k|  while ((ip < ip_bound) && (*ip == x)) ip++;
  ------------------
  |  Branch (1570:10): [True: 4.04k, False: 746]
  |  Branch (1570:29): [True: 4.03k, False: 16]
  ------------------
 1571|    762|  return ip == ip_bound ? true : false;
  ------------------
  |  Branch (1571:10): [True: 746, False: 16]
  ------------------
 1572|    888|}
blosc2.c:lz4_wrap_compress:
  592|     82|                             struct thread_context* thread_context) {
  593|     82|  int cbytes;
  594|     82|  blosc2_context* context = thread_context->parent_context;
  595|     82|  if (context->use_dict && context->dict_cdict != NULL) {
  ------------------
  |  Branch (595:7): [True: 0, False: 82]
  |  Branch (595:28): [True: 0, False: 0]
  ------------------
  596|      0|    if (thread_context->lz4_cstream == NULL) {
  ------------------
  |  Branch (596:9): [True: 0, False: 0]
  ------------------
  597|      0|      thread_context->lz4_cstream = LZ4_createStream();
  598|      0|      if (thread_context->lz4_cstream == NULL) {
  ------------------
  |  Branch (598:11): [True: 0, False: 0]
  ------------------
  599|      0|        return BLOSC2_ERROR_MEMORY_ALLOC;
  600|      0|      }
  601|      0|    }
  602|       |    // Reset the thread stream to dict-only context before each block so that
  603|       |    // each compressed block references only the dictionary (not prior blocks).
  604|       |    // This ensures independent decompressibility with LZ4_decompress_safe_usingDict.
  605|      0|    LZ4_loadDict((LZ4_stream_t*)thread_context->lz4_cstream,
  606|      0|                 (const char*)context->dict_buffer, (int)context->dict_size);
  607|      0|    cbytes = LZ4_compress_fast_continue((LZ4_stream_t*)thread_context->lz4_cstream,
  608|      0|                                        input, output, (int)input_length, (int)maxout, accel);
  609|     82|  } else {
  610|     82|#ifdef BLOSC_LZ4_FAST_RESET
  611|     82|    if (thread_context->lz4_cstream == NULL) {
  ------------------
  |  Branch (611:9): [True: 5, False: 77]
  ------------------
  612|      5|      thread_context->lz4_cstream = LZ4_createStream();
  613|      5|      if (thread_context->lz4_cstream == NULL) {
  ------------------
  |  Branch (613:11): [True: 0, False: 5]
  ------------------
  614|      0|        return BLOSC2_ERROR_MEMORY_ALLOC;
  615|      0|      }
  616|      5|    }
  617|       |    // Keep the same independent-block compressor and its small-input table
  618|       |    // selection, but retain worker-local state instead of clearing a new table
  619|       |    // for every stream. The streaming API chooses a different table for small
  620|       |    // inputs, so keep the independent-block entry point here.
  621|     82|    cbytes = LZ4_compress_fast_extState_fastReset(thread_context->lz4_cstream,
  622|     82|        input, output, (int)input_length, (int)maxout, accel);
  623|       |#else
  624|       |    cbytes = LZ4_compress_fast(input, output, (int)input_length, (int)maxout, accel);
  625|       |#endif
  626|     82|  }
  627|     82|  return cbytes;
  628|     82|}
blosc2.c:zstd_wrap_compress:
  720|  4.36k|                              char* output, size_t maxout, int clevel) {
  721|  4.36k|  size_t code;
  722|  4.36k|  blosc2_context* context = thread_context->parent_context;
  723|       |
  724|  4.36k|  clevel = (clevel < 9) ? clevel * 2 - 1 : ZSTD_maxCLevel();
  ------------------
  |  Branch (724:12): [True: 4.04k, False: 320]
  ------------------
  725|       |  /* Make the level 8 close enough to maxCLevel */
  726|  4.36k|  if (clevel == 8) clevel = ZSTD_maxCLevel() - 2;
  ------------------
  |  Branch (726:7): [True: 0, False: 4.36k]
  ------------------
  727|       |
  728|  4.36k|  if (thread_context->zstd_cctx == NULL) {
  ------------------
  |  Branch (728:7): [True: 28, False: 4.33k]
  ------------------
  729|     28|    thread_context->zstd_cctx = ZSTD_createCCtx();
  730|     28|  }
  731|       |
  732|  4.36k|  if (context->use_dict) {
  ------------------
  |  Branch (732:7): [True: 0, False: 4.36k]
  ------------------
  733|      0|    assert(context->dict_cdict != NULL);
  734|      0|    code = ZSTD_compress_usingCDict(
  735|      0|            thread_context->zstd_cctx, (void*)output, maxout, (void*)input,
  736|      0|            input_length, context->dict_cdict);
  737|  4.36k|  } else {
  738|  4.36k|    code = ZSTD_compressCCtx(thread_context->zstd_cctx,
  739|  4.36k|        (void*)output, maxout, (void*)input, input_length, clevel);
  740|  4.36k|  }
  741|  4.36k|  if (ZSTD_isError(code) != ZSTD_error_no_error) {
  ------------------
  |  Branch (741:7): [True: 1.46k, False: 2.90k]
  ------------------
  742|       |    // Blosc will just memcpy this buffer
  743|  1.46k|    return 0;
  744|  1.46k|  }
  745|  2.90k|  return (int)code;
  746|  4.36k|}
blosc2.c:fit_thread_context:
 2764|  5.07k|static int fit_thread_context(struct thread_context* thread_context, blosc2_context* context) {
 2765|  5.07k|  int32_t ebsize = context->blocksize + context->typesize * (int32_t)sizeof(int32_t);
 2766|  5.07k|  if ((size_t)4 * ebsize <= thread_context->tmp_nbytes) {
  ------------------
  |  Branch (2766:7): [True: 5.06k, False: 9]
  ------------------
 2767|  5.06k|    return 0;
 2768|  5.06k|  }
 2769|      9|  my_free(thread_context->tmp);
 2770|      9|  thread_context->tmp = my_malloc((size_t)4 * ebsize);
 2771|      9|  if (thread_context->tmp == NULL) {
  ------------------
  |  Branch (2771:7): [True: 0, False: 9]
  ------------------
 2772|      0|    thread_context->tmp_nbytes = 0;
 2773|      0|    thread_context->tmp_blocksize = 0;
 2774|      0|    return BLOSC2_ERROR_MEMORY_ALLOC;
 2775|      0|  }
 2776|      9|  thread_context->tmp_nbytes = (size_t)4 * ebsize;
 2777|      9|  thread_context->tmp2 = thread_context->tmp + ebsize;
 2778|      9|  thread_context->tmp3 = thread_context->tmp2 + ebsize;
 2779|      9|  thread_context->tmp4 = thread_context->tmp3 + ebsize;
 2780|      9|  thread_context->tmp_blocksize = context->blocksize;
 2781|      9|  return 0;
 2782|      9|}
blosc2.c:read_lazy_chunk_bytes:
 3064|     15|                                 const char* open_error, const char* read_error) {
 3065|     15|  int32_t chunk_cbytes;
 3066|     15|  if (context->src == NULL || context->srcsize < BLOSC_EXTENDED_HEADER_LENGTH ||
  ------------------
  |  Branch (3066:7): [True: 0, False: 15]
  |  Branch (3066:31): [True: 0, False: 15]
  ------------------
 3067|     15|      offset < 0 || nbytes < 0 || context->nblocks <= 0 ||
  ------------------
  |  Branch (3067:7): [True: 0, False: 15]
  |  Branch (3067:21): [True: 0, False: 15]
  |  Branch (3067:35): [True: 0, False: 15]
  ------------------
 3068|     15|      blosc2_cbuffer_sizes(context->src, NULL, &chunk_cbytes, NULL) < 0 ||
  ------------------
  |  Branch (3068:7): [True: 0, False: 15]
  ------------------
 3069|     15|      offset > chunk_cbytes || nbytes > chunk_cbytes - offset) {
  ------------------
  |  Branch (3069:7): [True: 0, False: 15]
  |  Branch (3069:32): [True: 0, False: 15]
  ------------------
 3070|      0|    return BLOSC2_ERROR_INVALID_HEADER;
 3071|      0|  }
 3072|     15|  int64_t trailer_end = BLOSC_EXTENDED_HEADER_LENGTH +
 3073|     15|      (int64_t)context->nblocks * sizeof(int32_t) + sizeof(int32_t) + sizeof(int64_t);
 3074|     15|  if (trailer_end > context->srcsize) return BLOSC2_ERROR_READ_BUFFER;
  ------------------
  |  Branch (3074:7): [True: 14, False: 1]
  ------------------
 3075|      1|  if (context->schunk == NULL || context->schunk->frame == NULL) {
  ------------------
  |  Branch (3075:7): [True: 1, False: 0]
  |  Branch (3075:34): [True: 0, False: 0]
  ------------------
 3076|      1|    BLOSC_TRACE_ERROR("Lazy chunk needs an associated super-chunk with a frame.");
  ------------------
  |  |   93|      1|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      1|    do {                                            \
  |  |  |  |   98|      1|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      1|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 1, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      1|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3077|      1|    return BLOSC2_ERROR_INVALID_PARAM;
 3078|      1|  }
 3079|       |
 3080|      0|  blosc2_frame_s* frame = (blosc2_frame_s*)context->schunk->frame;
 3081|      0|  blosc2_io_cb* io_cb = blosc2_get_io_cb(context->schunk->storage->io->id);
 3082|      0|  if (io_cb == NULL) {
  ------------------
  |  Branch (3082:7): [True: 0, False: 0]
  ------------------
 3083|      0|    BLOSC_TRACE_ERROR("Error getting the input/output API");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3084|      0|    return BLOSC2_ERROR_PLUGIN_IO;
 3085|      0|  }
 3086|       |
 3087|      0|  int32_t trailer_offset = BLOSC_EXTENDED_HEADER_LENGTH +
 3088|      0|                           context->nblocks * (int32_t)sizeof(int32_t);
 3089|      0|  int32_t nchunk_lazy;
 3090|      0|  int64_t chunk_offset;
 3091|      0|  memcpy(&nchunk_lazy, context->src + trailer_offset, sizeof(nchunk_lazy));
 3092|      0|  memcpy(&chunk_offset, context->src + trailer_offset + (int32_t)sizeof(int32_t), sizeof(chunk_offset));
 3093|      0|  if (nchunk_lazy < 0 || chunk_offset < 0 || frame->file_offset < 0 ||
  ------------------
  |  Branch (3093:7): [True: 0, False: 0]
  |  Branch (3093:26): [True: 0, False: 0]
  |  Branch (3093:46): [True: 0, False: 0]
  ------------------
 3094|      0|      (!frame->sframe && (chunk_offset < FRAME_HEADER_MINLEN ||
  ------------------
  |  |   49|      0|#define FRAME_HEADER_MINLEN (FRAME_FILTER_PIPELINE + 1 + 16)  // 87 <- minimum length
  |  |  ------------------
  |  |  |  |   44|      0|#define FRAME_FILTER_PIPELINE (FRAME_HAS_VLMETALAYERS + 1 + 1) // 70
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|      0|#define FRAME_HAS_VLMETALAYERS (FRAME_NTHREADS_D + 2)  // 68
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define FRAME_NTHREADS_D (FRAME_NTHREADS_C + 2 + 1)  // 66
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   41|      0|#define FRAME_NTHREADS_C (FRAME_CHUNKSIZE + 4 + 1)  // 63
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   40|      0|#define FRAME_CHUNKSIZE (FRAME_BLOCKSIZE + 4 + 1)  // 58
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   39|      0|#define FRAME_BLOCKSIZE (FRAME_TYPESIZE + 4 + 1)  // 53
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   38|      0|#define FRAME_TYPESIZE (FRAME_CBYTES + 8 + 1) // 48
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|      0|#define FRAME_CBYTES (FRAME_NBYTES + 8 + 1)  // 39
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   36|      0|#define FRAME_NBYTES (FRAME_FLAGS + 4 + 1)  // 30
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   32|      0|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   31|      0|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   30|      0|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   29|      0|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (3094:8): [True: 0, False: 0]
  |  Branch (3094:27): [True: 0, False: 0]
  ------------------
 3095|      0|       chunk_offset > frame->len || chunk_cbytes > frame->len - chunk_offset))) {
  ------------------
  |  Branch (3095:8): [True: 0, False: 0]
  |  Branch (3095:37): [True: 0, False: 0]
  ------------------
 3096|      0|    return BLOSC2_ERROR_INVALID_HEADER;
 3097|      0|  }
 3098|       |
 3099|      0|  void* fp = NULL;
 3100|      0|  int64_t io_pos;
 3101|      0|  if (frame->sframe) {
  ------------------
  |  Branch (3101:7): [True: 0, False: 0]
  ------------------
 3102|      0|    fp = sframe_open_chunk(frame->urlpath, nchunk_lazy, "rb", context->schunk->storage->io);
 3103|      0|    io_pos = offset;
 3104|      0|  }
 3105|      0|  else {
 3106|      0|    if (chunk_offset < 0 || offset < 0) {
  ------------------
  |  Branch (3106:9): [True: 0, False: 0]
  |  Branch (3106:29): [True: 0, False: 0]
  ------------------
 3107|      0|      BLOSC_TRACE_ERROR("Lazy chunk offset cannot be negative.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3108|      0|      return BLOSC2_ERROR_INVALID_HEADER;
 3109|      0|    }
 3110|      0|    fp = frame_reader_acquire(frame, context->schunk->storage->io);
 3111|      0|    if (!blosc2_checked_add_i64(frame->file_offset, chunk_offset, &io_pos)) {
  ------------------
  |  Branch (3111:9): [True: 0, False: 0]
  ------------------
 3112|      0|      BLOSC_TRACE_ERROR("Lazy chunk offset overflows file position.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3113|      0|      if (fp != NULL) {
  ------------------
  |  Branch (3113:11): [True: 0, False: 0]
  ------------------
 3114|      0|        frame_reader_release(frame, io_cb, fp);
 3115|      0|      }
 3116|      0|      return BLOSC2_ERROR_INVALID_HEADER;
 3117|      0|    }
 3118|      0|    if (!blosc2_checked_add_i64(io_pos, offset, &io_pos)) {
  ------------------
  |  Branch (3118:9): [True: 0, False: 0]
  ------------------
 3119|      0|      BLOSC_TRACE_ERROR("Lazy block offset overflows file position.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3120|      0|      if (fp != NULL) {
  ------------------
  |  Branch (3120:11): [True: 0, False: 0]
  ------------------
 3121|      0|        frame_reader_release(frame, io_cb, fp);
 3122|      0|      }
 3123|      0|      return BLOSC2_ERROR_INVALID_HEADER;
 3124|      0|    }
 3125|      0|  }
 3126|      0|  if (fp == NULL) {
  ------------------
  |  Branch (3126:7): [True: 0, False: 0]
  ------------------
 3127|      0|    BLOSC_TRACE_ERROR("%s", open_error);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3128|      0|    return BLOSC2_ERROR_FILE_OPEN;
 3129|      0|  }
 3130|      0|  if (!blosc2_checked_add_i64(io_pos, nbytes, NULL)) {
  ------------------
  |  Branch (3130:7): [True: 0, False: 0]
  ------------------
 3131|      0|    frame_reader_release(frame, io_cb, fp);
 3132|      0|    return BLOSC2_ERROR_INVALID_HEADER;
 3133|      0|  }
 3134|       |
 3135|      0|  uint8_t* read_buffer = buffer;
 3136|      0|  int64_t rbytes = io_cb->read((void**)&read_buffer, 1, nbytes, io_pos, fp);
 3137|      0|  bool complete = rbytes == nbytes && read_buffer != NULL;
  ------------------
  |  Branch (3137:19): [True: 0, False: 0]
  |  Branch (3137:39): [True: 0, False: 0]
  ------------------
 3138|      0|  if (complete && read_buffer != buffer) {
  ------------------
  |  Branch (3138:7): [True: 0, False: 0]
  |  Branch (3138:19): [True: 0, False: 0]
  ------------------
 3139|       |    // An io that hands out its own memory (mmap) keeps owning it
 3140|      0|    memcpy(buffer, read_buffer, (size_t)nbytes);
 3141|      0|  }
 3142|      0|  frame_reader_release(frame, io_cb, fp);
 3143|      0|  if (!complete) {
  ------------------
  |  Branch (3143:7): [True: 0, False: 0]
  ------------------
 3144|      0|    BLOSC_TRACE_ERROR("%s", read_error);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3145|      0|    return BLOSC2_ERROR_FILE_READ;
 3146|      0|  }
 3147|       |
 3148|      0|  return 0;
 3149|      0|}
blosc2.c:serial_context_get:
 2796|  6.63k|static struct thread_context* serial_context_get(blosc2_context* context) {
 2797|  6.63k|  struct thread_context* thread_context = NULL;
 2798|  6.63k|  if (context->serial_context == NULL) {
  ------------------
  |  Branch (2798:7): [True: 6.63k, False: 0]
  ------------------
 2799|  6.63k|    thread_context = serial_context_take_tls(context);
 2800|  6.63k|  }
 2801|  6.63k|  if (thread_context == NULL) {
  ------------------
  |  Branch (2801:7): [True: 658, False: 5.98k]
  ------------------
 2802|    658|    if (context->serial_context != NULL &&
  ------------------
  |  Branch (2802:9): [True: 0, False: 658]
  ------------------
 2803|      0|        context->serial_context->tmp_blocksize != context->blocksize) {
  ------------------
  |  Branch (2803:9): [True: 0, False: 0]
  ------------------
 2804|      0|      free_thread_context(context->serial_context);
 2805|      0|      context->serial_context = NULL;
 2806|      0|    }
 2807|    658|    if (context->serial_context == NULL) {
  ------------------
  |  Branch (2807:9): [True: 658, False: 0]
  ------------------
 2808|    658|      context->serial_context = create_thread_context(context, 0);
 2809|    658|      if (context->serial_context == NULL) {
  ------------------
  |  Branch (2809:11): [True: 0, False: 658]
  ------------------
 2810|      0|        return NULL;
 2811|      0|      }
 2812|    658|    }
 2813|      0|    else if (fit_thread_context(context->serial_context, context) < 0) {
  ------------------
  |  Branch (2813:14): [True: 0, False: 0]
  ------------------
 2814|      0|      return NULL;
 2815|      0|    }
 2816|    658|    thread_context = context->serial_context;
 2817|    658|  }
 2818|  6.63k|  thread_context->parent_context = context;
 2819|  6.63k|  thread_context->tid = 0;
 2820|       |  thread_context->serial = true;
 2821|  6.63k|  return thread_context;
 2822|  6.63k|}
blosc2.c:serial_context_take_tls:
 6894|  6.63k|static struct thread_context* serial_context_take_tls(blosc2_context* context) {
 6895|  6.63k|#if !defined(_WIN32)
 6896|  6.63k|  int32_t ebsize = context->blocksize + context->typesize * (int32_t)sizeof(int32_t);
 6897|  6.63k|  if ((size_t)4 * ebsize > BLOSC2_SERIAL_TLS_MAX) {
  ------------------
  |  | 6817|  6.63k|#define BLOSC2_SERIAL_TLS_MAX (16 * 1024 * 1024)
  ------------------
  |  Branch (6897:7): [True: 658, False: 5.98k]
  ------------------
 6898|    658|    return NULL;
 6899|    658|  }
 6900|  5.98k|  tmp_cache_t *cache = tmp_cache_get(true);
 6901|  5.98k|  if (cache == NULL || cache->serial_busy) {
  ------------------
  |  Branch (6901:7): [True: 0, False: 5.98k]
  |  Branch (6901:24): [True: 0, False: 5.98k]
  ------------------
 6902|      0|    return NULL;
 6903|      0|  }
 6904|  5.98k|  if (cache->serial == NULL) {
  ------------------
  |  Branch (6904:7): [True: 907, False: 5.07k]
  ------------------
 6905|    907|    cache->serial = create_thread_context(context, 0);
 6906|    907|    if (cache->serial == NULL) {
  ------------------
  |  Branch (6906:9): [True: 0, False: 907]
  ------------------
 6907|      0|      return NULL;
 6908|      0|    }
 6909|    907|  }
 6910|  5.07k|  else if (fit_thread_context(cache->serial, context) < 0) {
  ------------------
  |  Branch (6910:12): [True: 0, False: 5.07k]
  ------------------
 6911|      0|    return NULL;
 6912|      0|  }
 6913|  5.98k|  cache->serial_busy = true;
 6914|  5.98k|  return cache->serial;
 6915|       |#else
 6916|       |  BLOSC_UNUSED_PARAM(context);
 6917|       |  return NULL;
 6918|       |#endif
 6919|  5.98k|}
blosc2.c:create_thread_context:
 2676|  1.56k|create_thread_context(blosc2_context* context, int32_t tid) {
 2677|  1.56k|  struct thread_context* thread_context;
 2678|  1.56k|  thread_context = (struct thread_context*)my_malloc(sizeof(struct thread_context));
 2679|  1.56k|  BLOSC_ERROR_NULL(thread_context, NULL);
  ------------------
  |  |  104|  1.56k|    do {                                            \
  |  |  105|  1.56k|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 1.56k]
  |  |  ------------------
  |  |  106|      0|            BLOSC_TRACE_ERROR("Pointer is null");   \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  107|      0|            return (rc);                            \
  |  |  108|      0|        }                                           \
  |  |  109|  1.56k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 1.56k]
  |  |  ------------------
  ------------------
 2680|  1.56k|  int rc = init_thread_context(thread_context, context, tid);
 2681|  1.56k|  if (rc < 0) {
  ------------------
  |  Branch (2681:7): [True: 0, False: 1.56k]
  ------------------
 2682|      0|    my_free(thread_context);
 2683|      0|    return NULL;
 2684|      0|  }
 2685|  1.56k|  return thread_context;
 2686|  1.56k|}
blosc2.c:init_thread_context:
 2644|  1.56k|{
 2645|  1.56k|  int32_t ebsize;
 2646|       |
 2647|  1.56k|  thread_context->parent_context = context;
 2648|  1.56k|  thread_context->owner_pool = NULL;
 2649|  1.56k|  thread_context->tid = tid;
 2650|  1.56k|  thread_context->serial = false;
 2651|  1.56k|  thread_context->blosclz_state = NULL;
 2652|       |
 2653|  1.56k|  int32_t blocksize = context != NULL ? context->blocksize : 0;
  ------------------
  |  Branch (2653:23): [True: 1.56k, False: 0]
  ------------------
 2654|  1.56k|  int32_t typesize = context != NULL ? context->typesize : 0;
  ------------------
  |  Branch (2654:22): [True: 1.56k, False: 0]
  ------------------
 2655|  1.56k|  ebsize = blocksize + typesize * (signed)sizeof(int32_t);
 2656|  1.56k|  thread_context->tmp_nbytes = (size_t)4 * ebsize;
 2657|  1.56k|  thread_context->tmp = my_malloc(thread_context->tmp_nbytes);
 2658|  1.56k|  BLOSC_ERROR_NULL(thread_context->tmp, BLOSC2_ERROR_MEMORY_ALLOC);
  ------------------
  |  |  104|  1.56k|    do {                                            \
  |  |  105|  1.56k|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 1.56k]
  |  |  ------------------
  |  |  106|      0|            BLOSC_TRACE_ERROR("Pointer is null");   \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  107|      0|            return (rc);                            \
  |  |  108|      0|        }                                           \
  |  |  109|  1.56k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 1.56k]
  |  |  ------------------
  ------------------
 2659|  1.56k|  thread_context->tmp2 = thread_context->tmp + ebsize;
 2660|  1.56k|  thread_context->tmp3 = thread_context->tmp2 + ebsize;
 2661|  1.56k|  thread_context->tmp4 = thread_context->tmp3 + ebsize;
 2662|  1.56k|  thread_context->tmp_blocksize = blocksize;
 2663|  1.56k|  thread_context->zfp_cell_nitems = 0;
 2664|  1.56k|  thread_context->zfp_cell_start = 0;
 2665|  1.56k|  #if defined(HAVE_ZSTD)
 2666|  1.56k|  thread_context->zstd_cctx = NULL;
 2667|  1.56k|  thread_context->zstd_dctx = NULL;
 2668|  1.56k|  #endif
 2669|  1.56k|  thread_context->lz4_cstream = NULL;
 2670|  1.56k|  thread_context->lz4hc_cstream = NULL;
 2671|       |
 2672|  1.56k|  return 0;
 2673|  1.56k|}
blosc2.c:blosc_d:
 2122|  35.4M|    int32_t nblock, uint8_t* dest, int32_t dest_offset, uint8_t* tmp, uint8_t* tmp2) {
 2123|  35.4M|  blosc2_context* context = thread_context->parent_context;
 2124|  35.4M|  uint8_t *tmp3 = thread_context->tmp4;
 2125|  35.4M|  bool vlblocks = (context->blosc2_flags2 & BLOSC2_VL_BLOCKS) != 0;
 2126|  35.4M|  int32_t compformat = (context->header_flags & (uint8_t)0xe0) >> 5u;
 2127|  35.4M|  int dont_split = (context->header_flags & 0x10) >> 4;
 2128|  35.4M|  int32_t chunk_nbytes;
 2129|  35.4M|  int32_t chunk_cbytes;
 2130|  35.4M|  int nstreams;
 2131|  35.4M|  int32_t neblock;
 2132|  35.4M|  int32_t nbytes;                /* number of decompressed bytes in split */
 2133|  35.4M|  int32_t cbytes;                /* number of compressed bytes in split */
 2134|       |  // int32_t ctbytes = 0;           /* number of compressed bytes in block */
 2135|  35.4M|  int32_t ntbytes = 0;           /* number of uncompressed bytes in block */
 2136|  35.4M|  uint8_t* _dest;
 2137|  35.4M|  int32_t typesize = context->typesize;
 2138|  35.4M|  bool instr_codec = context->blosc2_flags & BLOSC2_INSTR_CODEC;
 2139|  35.4M|  const char* compname;
 2140|  35.4M|  int rc;
 2141|       |
 2142|  35.4M|  if (context->block_maskout != NULL && context->block_maskout[nblock]) {
  ------------------
  |  Branch (2142:7): [True: 14.0k, False: 35.3M]
  |  Branch (2142:41): [True: 1.08k, False: 12.9k]
  ------------------
 2143|       |    // Do not decompress, but act as if we successfully decompressed everything
 2144|  1.08k|    return bsize;
 2145|  1.08k|  }
 2146|       |
 2147|  35.4M|  rc = blosc2_cbuffer_sizes(src, &chunk_nbytes, &chunk_cbytes, NULL);
 2148|  35.4M|  if (rc < 0) {
  ------------------
  |  Branch (2148:7): [True: 0, False: 35.4M]
  ------------------
 2149|      0|    return rc;
 2150|      0|  }
 2151|  35.4M|  if (context->special_type == BLOSC2_SPECIAL_VALUE) {
  ------------------
  |  Branch (2151:7): [True: 16.5M, False: 18.8M]
  ------------------
 2152|       |    // We need the actual typesize in this case, but it cannot be encoded in the header, so derive it from cbytes
 2153|  16.5M|    typesize = chunk_cbytes - context->header_overhead;
 2154|  16.5M|  }
 2155|       |
 2156|       |  // In some situations (lazychunks) the context can arrive uninitialized
 2157|       |  // (but BITSHUFFLE needs it for accessing the format of the chunk)
 2158|  35.4M|  if (context->src == NULL) {
  ------------------
  |  Branch (2158:7): [True: 0, False: 35.4M]
  ------------------
 2159|      0|    context->src = src;
 2160|      0|  }
 2161|       |
 2162|       |  // Chunks with special values cannot be lazy
 2163|  35.4M|  bool is_lazy = ((context->header_overhead == BLOSC_EXTENDED_HEADER_LENGTH) &&
  ------------------
  |  Branch (2163:19): [True: 35.4M, False: 1.42k]
  ------------------
 2164|  35.4M|          (context->blosc2_flags & 0x08u) && !context->special_type);
  ------------------
  |  Branch (2164:11): [True: 33.3M, False: 2.05M]
  |  Branch (2164:46): [True: 1, False: 33.3M]
  ------------------
 2165|  35.4M|  if (is_lazy) {
  ------------------
  |  Branch (2165:7): [True: 1, False: 35.4M]
  ------------------
 2166|       |    // The chunk is on disk, so just lazily load the block
 2167|      1|    if (context->schunk == NULL) {
  ------------------
  |  Branch (2167:9): [True: 1, False: 0]
  ------------------
 2168|      1|      BLOSC_TRACE_ERROR("Lazy chunk needs an associated super-chunk.");
  ------------------
  |  |   93|      1|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      1|    do {                                            \
  |  |  |  |   98|      1|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      1|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 1, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      1|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2169|      1|      return BLOSC2_ERROR_INVALID_PARAM;
 2170|      1|    }
 2171|      0|    if (context->schunk->frame == NULL) {
  ------------------
  |  Branch (2171:9): [True: 0, False: 0]
  ------------------
 2172|      0|      BLOSC_TRACE_ERROR("Lazy chunk needs an associated frame.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2173|      0|      return BLOSC2_ERROR_INVALID_PARAM;
 2174|      0|    }
 2175|      0|    blosc2_frame_s* frame = (blosc2_frame_s*)context->schunk->frame;
 2176|      0|    size_t bstarts_nbytes;
 2177|      0|    size_t trailer_offset;
 2178|      0|    size_t block_csizes_nbytes;
 2179|      0|    size_t trailer_meta_nbytes;
 2180|      0|    size_t lazy_trailer_end;
 2181|      0|    if (srcsize < 0 || context->nblocks < 0 ||
  ------------------
  |  Branch (2181:9): [True: 0, False: 0]
  |  Branch (2181:24): [True: 0, False: 0]
  ------------------
 2182|      0|        !blosc2_checked_mul_size((size_t)context->nblocks, sizeof(int32_t), &bstarts_nbytes) ||
  ------------------
  |  Branch (2182:9): [True: 0, False: 0]
  ------------------
 2183|      0|        !blosc2_checked_add_size((size_t)BLOSC_EXTENDED_HEADER_LENGTH, bstarts_nbytes, &trailer_offset) ||
  ------------------
  |  Branch (2183:9): [True: 0, False: 0]
  ------------------
 2184|      0|        !blosc2_checked_mul_size((size_t)context->nblocks, sizeof(int32_t), &block_csizes_nbytes) ||
  ------------------
  |  Branch (2184:9): [True: 0, False: 0]
  ------------------
 2185|      0|        !blosc2_checked_add_size(sizeof(int32_t) + sizeof(int64_t), block_csizes_nbytes, &trailer_meta_nbytes) ||
  ------------------
  |  Branch (2185:9): [True: 0, False: 0]
  ------------------
 2186|      0|        !blosc2_checked_add_size(trailer_offset, trailer_meta_nbytes, &lazy_trailer_end) ||
  ------------------
  |  Branch (2186:9): [True: 0, False: 0]
  ------------------
 2187|      0|        (size_t)srcsize < lazy_trailer_end) {
  ------------------
  |  Branch (2187:9): [True: 0, False: 0]
  ------------------
 2188|      0|      BLOSC_TRACE_ERROR("Lazy trailer exceeds source buffer.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2189|      0|      return BLOSC2_ERROR_READ_BUFFER;
 2190|      0|    }
 2191|      0|    int32_t nchunk;
 2192|      0|    int64_t chunk_offset;
 2193|       |    // The nchunk and the offset of the current chunk are in the trailer
 2194|      0|    memcpy(&nchunk, src + trailer_offset, sizeof(nchunk));
 2195|      0|    memcpy(&chunk_offset, src + trailer_offset + sizeof(int32_t), sizeof(chunk_offset));
 2196|       |    // Get the csize of the nblock
 2197|      0|    if (nblock < 0 || nblock >= context->nblocks) {
  ------------------
  |  Branch (2197:9): [True: 0, False: 0]
  |  Branch (2197:23): [True: 0, False: 0]
  ------------------
 2198|      0|      BLOSC_TRACE_ERROR("Invalid block index in lazy trailer.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2199|      0|      return BLOSC2_ERROR_INVALID_HEADER;
 2200|      0|    }
 2201|      0|    int32_t *block_csizes = (int32_t *)(src + trailer_offset + sizeof(int32_t) + sizeof(int64_t));
 2202|      0|    int32_t block_csize = block_csizes[nblock];
 2203|      0|    int32_t max_lazy_block_csize = context->blocksize + context->typesize * (signed)sizeof(int32_t);
 2204|      0|    if (block_csize <= 0 || block_csize > max_lazy_block_csize) {
  ------------------
  |  Branch (2204:9): [True: 0, False: 0]
  |  Branch (2204:29): [True: 0, False: 0]
  ------------------
 2205|      0|      BLOSC_TRACE_ERROR("Invalid lazy block size in trailer.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2206|      0|      return BLOSC2_ERROR_INVALID_HEADER;
 2207|      0|    }
 2208|      0|    if (vlblocks && block_csize <= (int32_t)sizeof(int32_t)) {
  ------------------
  |  Branch (2208:9): [True: 0, False: 0]
  |  Branch (2208:21): [True: 0, False: 0]
  ------------------
 2209|      0|      BLOSC_TRACE_ERROR("Lazy VL block compressed size is too small.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2210|      0|      return BLOSC2_ERROR_INVALID_HEADER;
 2211|      0|    }
 2212|       |    // Read the lazy block on disk
 2213|      0|    void* fp = NULL;
 2214|      0|    blosc2_io_cb *io_cb = blosc2_get_io_cb(context->schunk->storage->io->id);
 2215|      0|    if (io_cb == NULL) {
  ------------------
  |  Branch (2215:9): [True: 0, False: 0]
  ------------------
 2216|      0|      BLOSC_TRACE_ERROR("Error getting the input/output API");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2217|      0|      return BLOSC2_ERROR_PLUGIN_IO;
 2218|      0|    }
 2219|       |
 2220|      0|    int64_t io_pos = 0;
 2221|      0|    if (frame->sframe) {
  ------------------
  |  Branch (2221:9): [True: 0, False: 0]
  ------------------
 2222|       |      // The chunk is not in the frame
 2223|      0|      fp = sframe_open_chunk(frame->urlpath, nchunk, "rb", context->schunk->storage->io);
 2224|      0|      BLOSC_ERROR_NULL(fp, BLOSC2_ERROR_FILE_OPEN);
  ------------------
  |  |  104|      0|    do {                                            \
  |  |  105|      0|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 0]
  |  |  ------------------
  |  |  106|      0|            BLOSC_TRACE_ERROR("Pointer is null");   \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  107|      0|            return (rc);                            \
  |  |  108|      0|        }                                           \
  |  |  109|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2225|       |      // The offset of the block is src_offset
 2226|      0|      if (src_offset < 0) {
  ------------------
  |  Branch (2226:11): [True: 0, False: 0]
  ------------------
 2227|      0|        frame_reader_release(frame, io_cb, fp);
 2228|      0|        BLOSC_TRACE_ERROR("Lazy block offset cannot be negative.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2229|      0|        return BLOSC2_ERROR_INVALID_HEADER;
 2230|      0|      }
 2231|      0|      io_pos = src_offset;
 2232|      0|    }
 2233|      0|    else {
 2234|      0|      fp = frame_reader_acquire(frame, context->schunk->storage->io);
 2235|      0|      BLOSC_ERROR_NULL(fp, BLOSC2_ERROR_FILE_OPEN);
  ------------------
  |  |  104|      0|    do {                                            \
  |  |  105|      0|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 0]
  |  |  ------------------
  |  |  106|      0|            BLOSC_TRACE_ERROR("Pointer is null");   \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  107|      0|            return (rc);                            \
  |  |  108|      0|        }                                           \
  |  |  109|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2236|       |      // The offset of the block is src_offset
 2237|      0|      if (src_offset < 0) {
  ------------------
  |  Branch (2237:11): [True: 0, False: 0]
  ------------------
 2238|      0|        frame_reader_release(frame, io_cb, fp);
 2239|      0|        BLOSC_TRACE_ERROR("Lazy block offset cannot be negative.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2240|      0|        return BLOSC2_ERROR_INVALID_HEADER;
 2241|      0|      }
 2242|      0|      if (chunk_offset < 0) {
  ------------------
  |  Branch (2242:11): [True: 0, False: 0]
  ------------------
 2243|      0|        frame_reader_release(frame, io_cb, fp);
 2244|      0|        BLOSC_TRACE_ERROR("Lazy chunk offset cannot be negative.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2245|      0|        return BLOSC2_ERROR_INVALID_HEADER;
 2246|      0|      }
 2247|      0|      if (!blosc2_checked_add_i64(frame->file_offset, chunk_offset, &io_pos)) {
  ------------------
  |  Branch (2247:11): [True: 0, False: 0]
  ------------------
 2248|      0|        frame_reader_release(frame, io_cb, fp);
 2249|      0|        BLOSC_TRACE_ERROR("Lazy chunk offset overflows file position.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2250|      0|        return BLOSC2_ERROR_INVALID_HEADER;
 2251|      0|      }
 2252|      0|      if (!blosc2_checked_add_i64(io_pos, src_offset, &io_pos)) {
  ------------------
  |  Branch (2252:11): [True: 0, False: 0]
  ------------------
 2253|      0|        frame_reader_release(frame, io_cb, fp);
 2254|      0|        BLOSC_TRACE_ERROR("Lazy block offset overflows file position.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2255|      0|        return BLOSC2_ERROR_INVALID_HEADER;
 2256|      0|      }
 2257|      0|    }
 2258|       |    // We can make use of tmp3 because it will be used after src is not needed anymore
 2259|      0|    int64_t rbytes = io_cb->read((void**)&tmp3, 1, block_csize, io_pos, fp);
 2260|      0|    frame_reader_release(frame, io_cb, fp);
 2261|      0|    if ((int32_t)rbytes != block_csize) {
  ------------------
  |  Branch (2261:9): [True: 0, False: 0]
  ------------------
 2262|      0|      BLOSC_TRACE_ERROR("Cannot read the (lazy) block out of the fileframe.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2263|      0|      return BLOSC2_ERROR_READ_BUFFER;
 2264|      0|    }
 2265|      0|    src = tmp3;
 2266|      0|    src_offset = 0;
 2267|      0|    srcsize = block_csize;
 2268|      0|  }
 2269|       |
 2270|       |  // If the chunk is memcpyed, we just have to copy the block to dest and return
 2271|  35.4M|  if (memcpyed) {
  ------------------
  |  Branch (2271:7): [True: 35.3M, False: 12.9k]
  ------------------
 2272|  35.3M|    int bsize_ = leftoverblock ? chunk_nbytes % context->blocksize : bsize;
  ------------------
  |  Branch (2272:18): [True: 104, False: 35.3M]
  ------------------
 2273|  35.3M|    if (!context->special_type) {
  ------------------
  |  Branch (2273:9): [True: 4.24k, False: 35.3M]
  ------------------
 2274|  4.24k|      if (chunk_nbytes + context->header_overhead != chunk_cbytes) {
  ------------------
  |  Branch (2274:11): [True: 0, False: 4.24k]
  ------------------
 2275|      0|        return BLOSC2_ERROR_WRITE_BUFFER;
 2276|      0|      }
 2277|  4.24k|      if (chunk_cbytes < context->header_overhead + (nblock * context->blocksize) + bsize_) {
  ------------------
  |  Branch (2277:11): [True: 0, False: 4.24k]
  ------------------
 2278|       |        /* Not enough input to copy block */
 2279|      0|        return BLOSC2_ERROR_READ_BUFFER;
 2280|      0|      }
 2281|  4.24k|    }
 2282|  35.3M|    if (!is_lazy) {
  ------------------
  |  Branch (2282:9): [True: 35.3M, False: 0]
  ------------------
 2283|  35.3M|      src += context->header_overhead + nblock * context->blocksize;
 2284|  35.3M|    }
 2285|  35.3M|    _dest = dest + dest_offset;
 2286|  35.3M|    if (context->postfilter != NULL) {
  ------------------
  |  Branch (2286:9): [True: 3.33k, False: 35.3M]
  ------------------
 2287|       |      // We are making use of a postfilter, so use a temp for destination
 2288|  3.33k|      _dest = tmp;
 2289|  3.33k|    }
 2290|  35.3M|    rc = 0;
 2291|  35.3M|    switch (context->special_type) {
 2292|  16.5M|      case BLOSC2_SPECIAL_VALUE:
  ------------------
  |  Branch (2292:7): [True: 16.5M, False: 18.8M]
  ------------------
 2293|       |        // All repeated values
 2294|  16.5M|        rc = set_values(typesize, context->src, _dest, bsize_);
 2295|  16.5M|        if (rc < 0) {
  ------------------
  |  Branch (2295:13): [True: 4, False: 16.5M]
  ------------------
 2296|      4|          BLOSC_TRACE_ERROR("set_values failed");
  ------------------
  |  |   93|      4|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      4|    do {                                            \
  |  |  |  |   98|      4|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      4|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 4, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      4|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2297|      4|          return BLOSC2_ERROR_DATA;
 2298|      4|        }
 2299|  16.5M|        break;
 2300|  18.5M|      case BLOSC2_SPECIAL_NAN:
  ------------------
  |  Branch (2300:7): [True: 18.5M, False: 16.8M]
  ------------------
 2301|  18.5M|        rc = set_nans(context->typesize, _dest, bsize_);
 2302|  18.5M|        if (rc < 0) {
  ------------------
  |  Branch (2302:13): [True: 8, False: 18.5M]
  ------------------
 2303|      8|          BLOSC_TRACE_ERROR("set_nans failed");
  ------------------
  |  |   93|      8|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      8|    do {                                            \
  |  |  |  |   98|      8|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      8|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 8, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      8|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2304|      8|          return BLOSC2_ERROR_DATA;
 2305|      8|        }
 2306|  18.5M|        break;
 2307|  18.5M|      case BLOSC2_SPECIAL_ZERO:
  ------------------
  |  Branch (2307:7): [True: 5.38k, False: 35.3M]
  ------------------
 2308|  5.38k|        memset(_dest, 0, bsize_);
 2309|  5.38k|        break;
 2310|   281k|      case BLOSC2_SPECIAL_UNINIT:
  ------------------
  |  Branch (2310:7): [True: 281k, False: 35.1M]
  ------------------
 2311|       |        // We do nothing here
 2312|   281k|        break;
 2313|  4.24k|      default:
  ------------------
  |  Branch (2313:7): [True: 4.24k, False: 35.3M]
  ------------------
 2314|  4.24k|        memcpy(_dest, src, bsize_);
 2315|  35.3M|    }
 2316|  35.3M|    if (context->postfilter != NULL) {
  ------------------
  |  Branch (2316:9): [True: 3.33k, False: 35.3M]
  ------------------
 2317|       |      // Create new postfilter parameters for this block (must be private for each thread)
 2318|  3.33k|      blosc2_postfilter_params postparams;
 2319|  3.33k|      memcpy(&postparams, context->postparams, sizeof(postparams));
 2320|  3.33k|      postparams.input = tmp;
 2321|  3.33k|      postparams.output = dest + dest_offset;
 2322|  3.33k|      postparams.size = bsize;
 2323|  3.33k|      postparams.typesize = typesize;
 2324|  3.33k|      postparams.offset = nblock * context->blocksize;
 2325|  3.33k|      postparams.nchunk = context->schunk != NULL ? context->schunk->current_nchunk : -1;
  ------------------
  |  Branch (2325:27): [True: 3.33k, False: 0]
  ------------------
 2326|  3.33k|      postparams.nblock = nblock;
 2327|  3.33k|      postparams.tid = thread_context->tid;
 2328|  3.33k|      postparams.ttmp = thread_context->tmp;
 2329|  3.33k|      postparams.ttmp_nbytes = thread_context->tmp_nbytes;
 2330|  3.33k|      postparams.ctx = context;
 2331|       |
 2332|       |      // Execute the postfilter (the processed block will be copied to dest)
 2333|  3.33k|      if (context->postfilter(&postparams) != 0) {
  ------------------
  |  Branch (2333:11): [True: 0, False: 3.33k]
  ------------------
 2334|      0|        BLOSC_TRACE_ERROR("Execution of postfilter function failed");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2335|      0|        return BLOSC2_ERROR_POSTFILTER;
 2336|      0|      }
 2337|  3.33k|    }
 2338|  35.3M|    thread_context->zfp_cell_nitems = 0;
 2339|       |
 2340|  35.3M|    return bsize_;
 2341|  35.3M|  }
 2342|       |
 2343|  12.9k|  if (!is_lazy && (src_offset <= 0 || src_offset >= srcsize)) {
  ------------------
  |  Branch (2343:7): [True: 12.9k, False: 0]
  |  Branch (2343:20): [True: 39, False: 12.8k]
  |  Branch (2343:39): [True: 45, False: 12.8k]
  ------------------
 2344|       |    /* Invalid block src offset encountered */
 2345|     84|    return BLOSC2_ERROR_DATA;
 2346|     84|  }
 2347|       |
 2348|  12.8k|  src += src_offset;
 2349|  12.8k|  if (vlblocks) {
  ------------------
  |  Branch (2349:7): [True: 0, False: 12.8k]
  ------------------
 2350|      0|    if (context->blockcbytes == NULL || nblock >= context->nblocks ||
  ------------------
  |  Branch (2350:9): [True: 0, False: 0]
  |  Branch (2350:41): [True: 0, False: 0]
  ------------------
 2351|      0|        context->blockcbytes[nblock] <= (int32_t)sizeof(int32_t) ||
  ------------------
  |  Branch (2351:9): [True: 0, False: 0]
  ------------------
 2352|      0|        src_offset > srcsize - context->blockcbytes[nblock]) {
  ------------------
  |  Branch (2352:9): [True: 0, False: 0]
  ------------------
 2353|      0|      return BLOSC2_ERROR_DATA;
 2354|      0|    }
 2355|      0|    srcsize = context->blockcbytes[nblock];
 2356|      0|  }
 2357|  12.8k|  else {
 2358|  12.8k|    srcsize -= src_offset;
 2359|  12.8k|  }
 2360|       |
 2361|  12.8k|  int last_filter_index = last_filter(context, 'd');
 2362|  12.8k|  if (instr_codec) {
  ------------------
  |  Branch (2362:7): [True: 1, False: 12.8k]
  ------------------
 2363|       |    // If instrumented, we don't want to run the filters
 2364|      1|    _dest = dest + dest_offset;
 2365|      1|  }
 2366|  12.8k|  else if (((last_filter_index >= 0) &&
  ------------------
  |  Branch (2366:13): [True: 12.2k, False: 621]
  ------------------
 2367|  12.2k|       (next_filter(context, BLOSC2_MAX_FILTERS, 'd') != BLOSC_DELTA)) ||
  ------------------
  |  Branch (2367:8): [True: 10.7k, False: 1.49k]
  ------------------
 2368|  11.2k|    context->postfilter != NULL) {
  ------------------
  |  Branch (2368:5): [True: 530, False: 1.58k]
  ------------------
 2369|       |    // We are making use of some filter, so use a temp for destination
 2370|  11.2k|    _dest = tmp;
 2371|  11.2k|  }
 2372|  1.58k|  else {
 2373|       |    // If no filters, or only DELTA in pipeline
 2374|  1.58k|    _dest = dest + dest_offset;
 2375|  1.58k|  }
 2376|       |
 2377|       |  /* The number of compressed data streams for this block */
 2378|  12.8k|  if (vlblocks) {
  ------------------
  |  Branch (2378:7): [True: 0, False: 12.8k]
  ------------------
 2379|      0|    nstreams = 1;
 2380|      0|  }
 2381|  12.8k|  else if (!dont_split && !leftoverblock) {
  ------------------
  |  Branch (2381:12): [True: 60, False: 12.7k]
  |  Branch (2381:27): [True: 59, False: 1]
  ------------------
 2382|     59|    nstreams = context->typesize;
 2383|     59|  }
 2384|  12.7k|  else {
 2385|  12.7k|    nstreams = 1;
 2386|  12.7k|  }
 2387|       |
 2388|  12.8k|  neblock = bsize / nstreams;
 2389|  12.8k|  if (neblock == 0) {
  ------------------
  |  Branch (2389:7): [True: 0, False: 12.8k]
  ------------------
 2390|       |    /* Not enough space to output bytes */
 2391|      0|    BLOSC_ERROR(BLOSC2_ERROR_WRITE_BUFFER);
  ------------------
  |  |  111|      0|    do {                                            \
  |  |  112|      0|        int rc_ = (rc);                             \
  |  |  113|      0|        if (rc_ < BLOSC2_ERROR_SUCCESS) {           \
  |  |  ------------------
  |  |  |  Branch (113:13): [True: 0, False: 0]
  |  |  ------------------
  |  |  114|      0|            char *error_msg = print_error(rc_);     \
  |  |  115|      0|            BLOSC_TRACE_ERROR("%s", error_msg);     \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  116|      0|            return rc_;                             \
  |  |  117|      0|        }                                           \
  |  |  118|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (118:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2392|      0|  }
 2393|       |  /* The splits must cover the whole block, or part of tmp is left unwritten */
 2394|  12.8k|  if (neblock * nstreams != bsize) {
  ------------------
  |  Branch (2394:7): [True: 3, False: 12.8k]
  ------------------
 2395|      3|    BLOSC_ERROR(BLOSC2_ERROR_DATA);
  ------------------
  |  |  111|      3|    do {                                            \
  |  |  112|      3|        int rc_ = (rc);                             \
  |  |  113|      3|        if (rc_ < BLOSC2_ERROR_SUCCESS) {           \
  |  |  ------------------
  |  |  |  Branch (113:13): [True: 3, False: 0]
  |  |  ------------------
  |  |  114|      3|            char *error_msg = print_error(rc_);     \
  |  |  115|      3|            BLOSC_TRACE_ERROR("%s", error_msg);     \
  |  |  ------------------
  |  |  |  |   93|      3|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      3|    do {                                            \
  |  |  |  |  |  |   98|      3|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      3|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 3, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      3|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  116|      3|            return rc_;                             \
  |  |  117|      3|        }                                           \
  |  |  118|      3|    } while (0)
  |  |  ------------------
  |  |  |  Branch (118:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2396|      3|  }
 2397|  24.9k|  for (int j = 0; j < nstreams; j++) {
  ------------------
  |  Branch (2397:19): [True: 12.8k, False: 12.1k]
  ------------------
 2398|  12.8k|    if (vlblocks) {
  ------------------
  |  Branch (2398:9): [True: 0, False: 12.8k]
  ------------------
 2399|      0|      if (srcsize < (signed)sizeof(int32_t)) {
  ------------------
  |  Branch (2399:11): [True: 0, False: 0]
  ------------------
 2400|       |        /* Not enough input to read compressed bytes */
 2401|      0|        return BLOSC2_ERROR_READ_BUFFER;
 2402|      0|      }
 2403|      0|      neblock = sw32_(src);
 2404|      0|      if (neblock != bsize) {
  ------------------
  |  Branch (2404:11): [True: 0, False: 0]
  ------------------
 2405|      0|        return BLOSC2_ERROR_DATA;
 2406|      0|      }
 2407|      0|      src += sizeof(int32_t);
 2408|      0|      cbytes = srcsize - (int32_t)sizeof(int32_t);
 2409|      0|      srcsize = 0;
 2410|      0|    }
 2411|  12.8k|    else {
 2412|  12.8k|      if (srcsize < (signed)sizeof(int32_t)) {
  ------------------
  |  Branch (2412:11): [True: 0, False: 12.8k]
  ------------------
 2413|       |        /* Not enough input to read compressed size */
 2414|      0|        return BLOSC2_ERROR_READ_BUFFER;
 2415|      0|      }
 2416|  12.8k|      srcsize -= sizeof(int32_t);
 2417|  12.8k|      cbytes = sw32_(src);      /* amount of compressed bytes */
 2418|  12.8k|      if (cbytes > 0) {
  ------------------
  |  Branch (2418:11): [True: 11.3k, False: 1.50k]
  ------------------
 2419|  11.3k|        if (srcsize < cbytes) {
  ------------------
  |  Branch (2419:13): [True: 8, False: 11.3k]
  ------------------
 2420|       |          /* Not enough input to read compressed bytes */
 2421|      8|          return BLOSC2_ERROR_READ_BUFFER;
 2422|      8|        }
 2423|  11.3k|        srcsize -= cbytes;
 2424|  11.3k|      }
 2425|  12.8k|      src += sizeof(int32_t);
 2426|  12.8k|    }
 2427|       |    // ctbytes += (signed)sizeof(int32_t);
 2428|       |
 2429|       |    /* Uncompress */
 2430|  12.8k|    if (!vlblocks && cbytes == 0) {
  ------------------
  |  Branch (2430:9): [True: 12.8k, False: 0]
  |  Branch (2430:22): [True: 1.26k, False: 11.5k]
  ------------------
 2431|       |      // A run of 0's
 2432|  1.26k|      memset(_dest, 0, (unsigned int)neblock);
 2433|  1.26k|      nbytes = neblock;
 2434|  1.26k|    }
 2435|  11.5k|    else if (!vlblocks && cbytes < 0) {
  ------------------
  |  Branch (2435:14): [True: 11.5k, False: 0]
  |  Branch (2435:27): [True: 235, False: 11.3k]
  ------------------
 2436|       |      // A negative number means some encoding depending on the token that comes next
 2437|    235|      uint8_t token;
 2438|       |
 2439|    235|      if (srcsize < (signed)sizeof(uint8_t)) {
  ------------------
  |  Branch (2439:11): [True: 0, False: 235]
  ------------------
 2440|       |        // Not enough input to read token */
 2441|      0|        return BLOSC2_ERROR_READ_BUFFER;
 2442|      0|      }
 2443|    235|      srcsize -= sizeof(uint8_t);
 2444|       |
 2445|    235|      token = src[0];
 2446|    235|      src += 1;
 2447|       |      // ctbytes += 1;
 2448|       |
 2449|    235|      if (token & 0x1) {
  ------------------
  |  Branch (2449:11): [True: 230, False: 5]
  ------------------
 2450|       |        // A run of bytes that are different than 0
 2451|    230|        if (cbytes < -255) {
  ------------------
  |  Branch (2451:13): [True: 22, False: 208]
  ------------------
 2452|       |          // Runs can only encode a byte
 2453|     22|          return BLOSC2_ERROR_RUN_LENGTH;
 2454|     22|        }
 2455|    208|        uint8_t value = -cbytes;
 2456|    208|        memset(_dest, value, (unsigned int)neblock);
 2457|    208|      } else {
 2458|      5|        BLOSC_TRACE_ERROR("Invalid or unsupported compressed stream token value - %d", token);
  ------------------
  |  |   93|      5|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      5|    do {                                            \
  |  |  |  |   98|      5|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      5|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 5, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      5|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2459|      5|        return BLOSC2_ERROR_RUN_LENGTH;
 2460|      5|      }
 2461|    208|      nbytes = neblock;
 2462|    208|      cbytes = 0;  // everything is encoded in the cbytes token
 2463|    208|    }
 2464|  11.3k|    else if (cbytes == neblock) {
  ------------------
  |  Branch (2464:14): [True: 1.29k, False: 10.0k]
  ------------------
 2465|  1.29k|      memcpy(_dest, src, (unsigned int)neblock);
 2466|  1.29k|      nbytes = (int32_t)neblock;
 2467|  1.29k|    }
 2468|  10.0k|    else {
 2469|  10.0k|      if (compformat == BLOSC_BLOSCLZ_FORMAT) {
  ------------------
  |  Branch (2469:11): [True: 4.35k, False: 5.69k]
  ------------------
 2470|  4.35k|        nbytes = blosclz_decompress(src, cbytes, _dest, (int)neblock);
 2471|  4.35k|      }
 2472|  5.69k|      else if (compformat == BLOSC_LZ4_FORMAT) {
  ------------------
  |  Branch (2472:16): [True: 120, False: 5.57k]
  ------------------
 2473|    120|        nbytes = lz4_wrap_decompress((char*)src, (size_t)cbytes,
 2474|    120|                                     (char*)_dest, (size_t)neblock,
 2475|    120|                                     thread_context);
 2476|    120|      }
 2477|  5.57k|  #if defined(HAVE_ZLIB)
 2478|  5.57k|      else if (compformat == BLOSC_ZLIB_FORMAT) {
  ------------------
  |  Branch (2478:16): [True: 149, False: 5.42k]
  ------------------
 2479|    149|        nbytes = zlib_wrap_decompress((char*)src, (size_t)cbytes,
 2480|    149|                                      (char*)_dest, (size_t)neblock);
 2481|    149|      }
 2482|  5.42k|  #endif /*  HAVE_ZLIB */
 2483|  5.42k|  #if defined(HAVE_ZSTD)
 2484|  5.42k|      else if (compformat == BLOSC_ZSTD_FORMAT) {
  ------------------
  |  Branch (2484:16): [True: 5.15k, False: 269]
  ------------------
 2485|  5.15k|        nbytes = zstd_wrap_decompress(thread_context,
 2486|  5.15k|                                      (char*)src, (size_t)cbytes,
 2487|  5.15k|                                      (char*)_dest, (size_t)neblock);
 2488|  5.15k|      }
 2489|    269|  #endif /*  HAVE_ZSTD */
 2490|    269|      else if (compformat == BLOSC_UDCODEC_FORMAT) {
  ------------------
  |  Branch (2490:16): [True: 269, False: 0]
  ------------------
 2491|    269|        bool getcell = false;
 2492|       |
 2493|    269|#if defined(HAVE_ZFP)
 2494|    269|        if ((context->compcode == BLOSC_CODEC_ZFP_FIXED_RATE) &&
  ------------------
  |  Branch (2494:13): [True: 99, False: 170]
  ------------------
 2495|     99|            (thread_context->zfp_cell_nitems > 0)) {
  ------------------
  |  Branch (2495:13): [True: 0, False: 99]
  ------------------
 2496|      0|          nbytes = zfp_getcell(thread_context, src, cbytes, _dest, neblock);
 2497|      0|          if (nbytes < 0) {
  ------------------
  |  Branch (2497:15): [True: 0, False: 0]
  ------------------
 2498|      0|            return BLOSC2_ERROR_DATA;
 2499|      0|          }
 2500|      0|          if (nbytes == thread_context->zfp_cell_nitems * typesize) {
  ------------------
  |  Branch (2500:15): [True: 0, False: 0]
  ------------------
 2501|      0|            getcell = true;
 2502|      0|          }
 2503|      0|        }
 2504|    269|#endif /* HAVE_ZFP */
 2505|    269|        if (!getcell) {
  ------------------
  |  Branch (2505:13): [True: 269, False: 0]
  ------------------
 2506|    269|          thread_context->zfp_cell_nitems = 0;
 2507|    896|          for (int i = 0; i < g_ncodecs; ++i) {
  ------------------
  |  Branch (2507:27): [True: 895, False: 1]
  ------------------
 2508|    895|            if (g_codecs[i].compcode == context->compcode) {
  ------------------
  |  Branch (2508:17): [True: 268, False: 627]
  ------------------
 2509|    268|              if (load_acquire_ptr(&g_codecs[i].decoder) == NULL) {
  ------------------
  |  |  144|    268|#define load_acquire_ptr(p) __atomic_load_n((p), __ATOMIC_ACQUIRE)
  ------------------
  |  Branch (2509:19): [True: 4, False: 264]
  ------------------
 2510|       |                // Dynamically load codec plugin
 2511|      4|                if (fill_codec(&g_codecs[i]) < 0) {
  ------------------
  |  Branch (2511:21): [True: 4, False: 0]
  ------------------
 2512|      4|                  BLOSC_TRACE_ERROR("Could not load codec %d.", g_codecs[i].compcode);
  ------------------
  |  |   93|      4|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      4|    do {                                            \
  |  |  |  |   98|      4|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      4|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 4, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      4|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2513|      4|                  return BLOSC2_ERROR_CODEC_SUPPORT;
 2514|      4|                }
 2515|      4|              }
 2516|    264|              blosc2_dparams dparams;
 2517|    264|              blosc2_ctx_get_dparams(context, &dparams);
 2518|    264|              nbytes = g_codecs[i].decoder(src,
 2519|    264|                                           cbytes,
 2520|    264|                                           _dest,
 2521|    264|                                           neblock,
 2522|    264|                                           context->compcode_meta,
 2523|    264|                                           &dparams,
 2524|    264|                                           context->src);
 2525|    264|              goto urcodecsuccess;
 2526|    268|            }
 2527|    895|          }
 2528|      1|          BLOSC_TRACE_ERROR("User-defined compressor codec %d not found during decompression", context->compcode);
  ------------------
  |  |   93|      1|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      1|    do {                                            \
  |  |  |  |   98|      1|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      1|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 1, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      1|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2529|      1|          return BLOSC2_ERROR_CODEC_SUPPORT;
 2530|    269|        }
 2531|    264|      urcodecsuccess:
 2532|    264|        ;
 2533|    264|      }
 2534|      0|      else {
 2535|      0|        compname = clibcode_to_clibname(compformat);
 2536|      0|        BLOSC_TRACE_ERROR(
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2537|      0|                "Blosc has not been compiled with decompression "
 2538|      0|                "support for '%s' format.  "
 2539|      0|                "Please recompile for adding this support.", compname);
 2540|      0|        return BLOSC2_ERROR_CODEC_SUPPORT;
 2541|      0|      }
 2542|       |
 2543|       |      /* Check that decompressed bytes number is correct */
 2544|  10.0k|      if ((nbytes != neblock) && (thread_context->zfp_cell_nitems == 0)) {
  ------------------
  |  Branch (2544:11): [True: 658, False: 9.38k]
  |  Branch (2544:34): [True: 658, False: 0]
  ------------------
 2545|    658|        return BLOSC2_ERROR_DATA;
 2546|    658|      }
 2547|       |
 2548|  10.0k|    }
 2549|  12.1k|    src += cbytes;
 2550|       |    // ctbytes += cbytes;
 2551|  12.1k|    _dest += nbytes;
 2552|  12.1k|    ntbytes += nbytes;
 2553|  12.1k|  } /* Closes j < nstreams */
 2554|       |
 2555|  12.1k|  if (!instr_codec) {
  ------------------
  |  Branch (2555:7): [True: 12.1k, False: 1]
  ------------------
 2556|  12.1k|    if (last_filter_index >= 0 || context->postfilter != NULL) {
  ------------------
  |  Branch (2556:9): [True: 11.5k, False: 555]
  |  Branch (2556:35): [True: 530, False: 25]
  ------------------
 2557|       |      /* Apply regular filter pipeline */
 2558|  12.1k|      int errcode = pipeline_backward(thread_context, bsize, dest, dest_offset, tmp, tmp2, tmp3,
 2559|  12.1k|                                      last_filter_index, nblock);
 2560|  12.1k|      if (errcode < 0)
  ------------------
  |  Branch (2560:11): [True: 79, False: 12.0k]
  ------------------
 2561|     79|        return errcode;
 2562|  12.1k|    }
 2563|  12.1k|  }
 2564|       |
 2565|       |  /* Return the number of uncompressed bytes */
 2566|  12.0k|  return (int)ntbytes;
 2567|  12.1k|}
blosc2.c:lz4_wrap_decompress:
  659|    120|                               struct thread_context* thread_context) {
  660|    120|  int nbytes;
  661|    120|  blosc2_context* context = thread_context->parent_context;
  662|    120|  if (context->use_dict && context->dict_buffer != NULL && context->dict_size > 0) {
  ------------------
  |  Branch (662:7): [True: 0, False: 120]
  |  Branch (662:28): [True: 0, False: 0]
  |  Branch (662:60): [True: 0, False: 0]
  ------------------
  663|      0|    nbytes = LZ4_decompress_safe_usingDict(input, output,
  664|      0|                                           (int)compressed_length, (int)maxout,
  665|      0|                                           (const char*)context->dict_buffer,
  666|      0|                                           (int)context->dict_size);
  667|    120|  } else {
  668|    120|    nbytes = LZ4_decompress_safe(input, output, (int)compressed_length, (int)maxout);
  669|    120|  }
  670|    120|  if (nbytes != (int)maxout) {
  ------------------
  |  Branch (670:7): [True: 49, False: 71]
  ------------------
  671|     49|    return 0;
  672|     49|  }
  673|     71|  return (int)maxout;
  674|    120|}
blosc2.c:zlib_wrap_decompress:
  698|    149|                                char* output, size_t maxout) {
  699|    149|  int status;
  700|    149|#if defined(HAVE_ZLIB_NG) && ! defined(ZLIB_COMPAT)
  701|    149|  size_t ul = maxout;
  702|    149|  status = zng_uncompress(
  703|    149|      (uint8_t*)output, &ul, (uint8_t*)input, compressed_length);
  704|       |#else
  705|       |  uLongf ul = (uLongf)maxout;
  706|       |  status = uncompress(
  707|       |      (Bytef*)output, &ul, (Bytef*)input, (uLong)compressed_length);
  708|       |#endif
  709|    149|  if (status != Z_OK) {
  ------------------
  |  |  180|    149|#define Z_OK            0
  ------------------
  |  Branch (709:7): [True: 148, False: 1]
  ------------------
  710|    148|    return 0;
  711|    148|  }
  712|      1|  return (int)ul;
  713|    149|}
blosc2.c:zstd_wrap_decompress:
  750|  5.15k|                                char* output, size_t maxout) {
  751|  5.15k|  size_t code;
  752|  5.15k|  blosc2_context* context = thread_context->parent_context;
  753|       |
  754|  5.15k|  if (thread_context->zstd_dctx == NULL) {
  ------------------
  |  Branch (754:7): [True: 404, False: 4.75k]
  ------------------
  755|    404|    thread_context->zstd_dctx = ZSTD_createDCtx();
  756|    404|  }
  757|       |
  758|  5.15k|  if (context->use_dict) {
  ------------------
  |  Branch (758:7): [True: 0, False: 5.15k]
  ------------------
  759|      0|    assert(context->dict_ddict != NULL);
  760|      0|    code = ZSTD_decompress_usingDDict(
  761|      0|            thread_context->zstd_dctx, (void*)output, maxout, (void*)input,
  762|      0|            compressed_length, context->dict_ddict);
  763|  5.15k|  } else {
  764|  5.15k|    code = ZSTD_decompressDCtx(thread_context->zstd_dctx,
  765|  5.15k|        (void*)output, maxout, (void*)input, compressed_length);
  766|  5.15k|  }
  767|  5.15k|  if (ZSTD_isError(code) != ZSTD_error_no_error) {
  ------------------
  |  Branch (767:7): [True: 379, False: 4.77k]
  ------------------
  768|    379|    BLOSC_TRACE_ERROR("Error in ZSTD decompression: '%s'.  Giving up.",
  ------------------
  |  |   93|    379|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|    379|    do {                                            \
  |  |  |  |   98|    379|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|    379|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 379, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|    379|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  769|    379|                      ZDICT_getErrorName(code));
  770|    379|    return 0;
  771|    379|  }
  772|  4.77k|  return (int)code;
  773|  5.15k|}
blosc2.c:set_values:
 2053|  16.5M|static int32_t set_values(int32_t typesize, const uint8_t* src, uint8_t* dest, int32_t destsize) {
 2054|       |#if defined(BLOSC_STRICT_ALIGN)
 2055|       |  if (destsize % typesize != 0) {
 2056|       |    BLOSC_ERROR(BLOSC2_ERROR_FAILURE);
 2057|       |  }
 2058|       |  int32_t nitems = destsize / typesize;
 2059|       |  if (nitems == 0) {
 2060|       |    return 0;
 2061|       |  }
 2062|       |  for (int i = 0; i < nitems; i++) {
 2063|       |    memcpy(dest + i * typesize, src + BLOSC_EXTENDED_HEADER_LENGTH, typesize);
 2064|       |  }
 2065|       |#else
 2066|  16.5M|  if (destsize % typesize != 0) {
  ------------------
  |  Branch (2066:7): [True: 12, False: 16.5M]
  ------------------
 2067|     12|    BLOSC_ERROR(BLOSC2_ERROR_FAILURE);
  ------------------
  |  |  111|     12|    do {                                            \
  |  |  112|     12|        int rc_ = (rc);                             \
  |  |  113|     12|        if (rc_ < BLOSC2_ERROR_SUCCESS) {           \
  |  |  ------------------
  |  |  |  Branch (113:13): [True: 12, False: 0]
  |  |  ------------------
  |  |  114|     12|            char *error_msg = print_error(rc_);     \
  |  |  115|     12|            BLOSC_TRACE_ERROR("%s", error_msg);     \
  |  |  ------------------
  |  |  |  |   93|     12|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|     12|    do {                                            \
  |  |  |  |  |  |   98|     12|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|     12|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 12, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|     12|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  116|     12|            return rc_;                             \
  |  |  117|     12|        }                                           \
  |  |  118|     12|    } while (0)
  |  |  ------------------
  |  |  |  Branch (118:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2068|     12|  }
 2069|  16.5M|  int32_t nitems = destsize / typesize;
 2070|  16.5M|  if (nitems == 0) {
  ------------------
  |  Branch (2070:7): [True: 0, False: 16.5M]
  ------------------
 2071|      0|    return 0;
 2072|      0|  }
 2073|       |
 2074|  16.5M|  switch (typesize) {
 2075|   232k|    case 8: {
  ------------------
  |  Branch (2075:5): [True: 232k, False: 16.3M]
  ------------------
 2076|   232k|      int64_t val8 = ((int64_t*)(src + BLOSC_EXTENDED_HEADER_LENGTH))[0];
 2077|   232k|      int64_t* dest8 = (int64_t*)dest;
 2078|  1.31G|      for (int i = 0; i < nitems; i++) {
  ------------------
  |  Branch (2078:23): [True: 1.31G, False: 232k]
  ------------------
 2079|  1.31G|        dest8[i] = val8;
 2080|  1.31G|      }
 2081|   232k|      break;
 2082|      0|    }
 2083|  81.0k|    case 4: {
  ------------------
  |  Branch (2083:5): [True: 81.0k, False: 16.4M]
  ------------------
 2084|  81.0k|      int32_t val4 = ((int32_t*)(src + BLOSC_EXTENDED_HEADER_LENGTH))[0];
 2085|  81.0k|      int32_t* dest4 = (int32_t*)dest;
 2086|   595M|      for (int i = 0; i < nitems; i++) {
  ------------------
  |  Branch (2086:23): [True: 595M, False: 81.0k]
  ------------------
 2087|   595M|        dest4[i] = val4;
 2088|   595M|      }
 2089|  81.0k|      break;
 2090|      0|    }
 2091|  11.8M|    case 2: {
  ------------------
  |  Branch (2091:5): [True: 11.8M, False: 4.74M]
  ------------------
 2092|  11.8M|      int16_t val2 = ((int16_t*)(src + BLOSC_EXTENDED_HEADER_LENGTH))[0];
 2093|  11.8M|      int16_t* dest2 = (int16_t*)dest;
 2094|  3.92G|      for (int i = 0; i < nitems; i++) {
  ------------------
  |  Branch (2094:23): [True: 3.90G, False: 11.8M]
  ------------------
 2095|  3.90G|        dest2[i] = val2;
 2096|  3.90G|      }
 2097|  11.8M|      break;
 2098|      0|    }
 2099|  4.17M|    case 1: {
  ------------------
  |  Branch (2099:5): [True: 4.17M, False: 12.4M]
  ------------------
 2100|  4.17M|      int8_t val1 = ((int8_t*)(src + BLOSC_EXTENDED_HEADER_LENGTH))[0];
 2101|  4.17M|      int8_t* dest1 = (int8_t*)dest;
 2102|  5.25G|      for (int i = 0; i < nitems; i++) {
  ------------------
  |  Branch (2102:23): [True: 5.25G, False: 4.17M]
  ------------------
 2103|  5.25G|        dest1[i] = val1;
 2104|  5.25G|      }
 2105|  4.17M|      break;
 2106|      0|    }
 2107|   260k|    default:
  ------------------
  |  Branch (2107:5): [True: 260k, False: 16.3M]
  ------------------
 2108|   913M|      for (int i = 0; i < nitems; i++) {
  ------------------
  |  Branch (2108:23): [True: 913M, False: 260k]
  ------------------
 2109|   913M|        memcpy(dest + i * typesize, src + BLOSC_EXTENDED_HEADER_LENGTH, typesize);
 2110|   913M|      }
 2111|  16.5M|  }
 2112|  16.5M|#endif
 2113|       |
 2114|  16.5M|  return nitems;
 2115|  16.5M|}
blosc2.c:set_nans:
 2021|  18.5M|static int32_t set_nans(int32_t typesize, uint8_t* dest, int32_t destsize) {
 2022|  18.5M|  if (destsize % typesize != 0) {
  ------------------
  |  Branch (2022:7): [True: 5, False: 18.5M]
  ------------------
 2023|      5|    BLOSC_TRACE_ERROR("destsize can only be a multiple of typesize");
  ------------------
  |  |   93|      5|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      5|    do {                                            \
  |  |  |  |   98|      5|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      5|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 5, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      5|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2024|      5|    BLOSC_ERROR(BLOSC2_ERROR_FAILURE);
  ------------------
  |  |  111|      5|    do {                                            \
  |  |  112|      5|        int rc_ = (rc);                             \
  |  |  113|      5|        if (rc_ < BLOSC2_ERROR_SUCCESS) {           \
  |  |  ------------------
  |  |  |  Branch (113:13): [True: 5, False: 0]
  |  |  ------------------
  |  |  114|      5|            char *error_msg = print_error(rc_);     \
  |  |  115|      5|            BLOSC_TRACE_ERROR("%s", error_msg);     \
  |  |  ------------------
  |  |  |  |   93|      5|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      5|    do {                                            \
  |  |  |  |  |  |   98|      5|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      5|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 5, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      5|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  116|      5|            return rc_;                             \
  |  |  117|      5|        }                                           \
  |  |  118|      5|    } while (0)
  |  |  ------------------
  |  |  |  Branch (118:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2025|      5|  }
 2026|  18.5M|  int32_t nitems = destsize / typesize;
 2027|  18.5M|  if (nitems == 0) {
  ------------------
  |  Branch (2027:7): [True: 0, False: 18.5M]
  ------------------
 2028|      0|    return 0;
 2029|      0|  }
 2030|       |
 2031|  18.5M|  if (typesize == 4) {
  ------------------
  |  Branch (2031:7): [True: 16.9M, False: 1.57M]
  ------------------
 2032|  16.9M|    float* dest_ = (float*)dest;
 2033|  16.9M|    float val = nanf("");
 2034|  1.18G|    for (int i = 0; i < nitems; i++) {
  ------------------
  |  Branch (2034:21): [True: 1.16G, False: 16.9M]
  ------------------
 2035|  1.16G|      dest_[i] = val;
 2036|  1.16G|    }
 2037|  16.9M|    return nitems;
 2038|  16.9M|  }
 2039|  1.57M|  else if (typesize == 8) {
  ------------------
  |  Branch (2039:12): [True: 1.57M, False: 3]
  ------------------
 2040|  1.57M|    double* dest_ = (double*)dest;
 2041|  1.57M|    double val = nan("");
 2042|   708M|    for (int i = 0; i < nitems; i++) {
  ------------------
  |  Branch (2042:21): [True: 707M, False: 1.57M]
  ------------------
 2043|   707M|      dest_[i] = val;
 2044|   707M|    }
 2045|  1.57M|    return nitems;
 2046|  1.57M|  }
 2047|       |
 2048|      3|  BLOSC_TRACE_ERROR("Unsupported typesize for NaN");
  ------------------
  |  |   93|      3|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      3|    do {                                            \
  |  |  |  |   98|      3|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      3|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 3, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      3|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2049|      3|  return BLOSC2_ERROR_DATA;
 2050|  18.5M|}
blosc2.c:getitem_read_header:
 5177|  2.69k|static int getitem_read_header(const void* src, int32_t srcsize, blosc_header* header) {
 5178|  2.69k|  int result = read_chunk_header((uint8_t *) src, srcsize, true, header);
 5179|  2.69k|  if (result < 0) {
  ------------------
  |  Branch (5179:7): [True: 0, False: 2.69k]
  ------------------
 5180|      0|    return result;
 5181|      0|  }
 5182|  2.69k|  if (header->blosc2_flags2 & BLOSC2_VL_BLOCKS) {
  ------------------
  |  Branch (5182:7): [True: 0, False: 2.69k]
  ------------------
 5183|      0|    BLOSC_TRACE_ERROR("getitem is not supported for VL-block chunks.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 5184|      0|    return BLOSC2_ERROR_INVALID_PARAM;
 5185|      0|  }
 5186|  2.69k|  return 0;
 5187|  2.69k|}
blosc2.c:getitem_with_header:
 5193|  2.69k|                               int start, int nitems, void* dest, int32_t destsize) {
 5194|       |  /* Minimally populate the context */
 5195|  2.69k|  context->src = src;
 5196|  2.69k|  context->srcsize = srcsize;
 5197|  2.69k|  context->dest = dest;
 5198|  2.69k|  context->destsize = destsize;
 5199|       |
 5200|  2.69k|  int result = blosc2_initialize_context_from_header(context, header);
 5201|  2.69k|  if (result < 0) {
  ------------------
  |  Branch (5201:7): [True: 0, False: 2.69k]
  ------------------
 5202|      0|    return result;
 5203|      0|  }
 5204|       |
 5205|       |  /* Call the actual getitem function */
 5206|  2.69k|  return _blosc_getitem(context, header, src, srcsize, start, nitems, dest, destsize);
 5207|  2.69k|}
blosc2.c:blosc2_initialize_context_from_header:
 1050|  6.16k|static int blosc2_initialize_context_from_header(blosc2_context* context, blosc_header* header) {
 1051|  6.16k|  context->header_flags = header->flags;
 1052|  6.16k|  context->typesize = header->typesize;
 1053|  6.16k|  context->sourcesize = header->nbytes;
 1054|  6.16k|  context->header_blocksize = header->blocksize;
 1055|  6.16k|  context->blocksize = header->blocksize;
 1056|  6.16k|  context->blosc2_flags2 = header->blosc2_flags2;
 1057|  6.16k|  context->blosc2_flags = header->blosc2_flags;
 1058|  6.16k|  context->compcode = header->flags >> 5;
 1059|  6.16k|  if (context->compcode == BLOSC_UDCODEC_FORMAT) {
  ------------------
  |  Branch (1059:7): [True: 337, False: 5.82k]
  ------------------
 1060|    337|    context->compcode = header->udcompcode;
 1061|    337|  }
 1062|  6.16k|  if (context->blosc2_flags2 & BLOSC2_VL_BLOCKS) {
  ------------------
  |  Branch (1062:7): [True: 50, False: 6.11k]
  ------------------
 1063|     50|    context->nblocks = header->blocksize;
 1064|     50|    context->leftover = 0;
 1065|     50|    context->blocksize = 0;
 1066|     50|  }
 1067|  6.11k|  else {
 1068|  6.11k|    blosc2_calculate_blocks(context);
 1069|  6.11k|  }
 1070|       |
 1071|  6.16k|  bool is_lazy = false;
 1072|  6.16k|  if ((context->header_flags & BLOSC_DOSHUFFLE) &&
  ------------------
  |  Branch (1072:7): [True: 5.13k, False: 1.02k]
  ------------------
 1073|  5.13k|      (context->header_flags & BLOSC_DOBITSHUFFLE)) {
  ------------------
  |  Branch (1073:7): [True: 4.99k, False: 141]
  ------------------
 1074|       |    /* Extended header */
 1075|  4.99k|    context->header_overhead = BLOSC_EXTENDED_HEADER_LENGTH;
 1076|       |
 1077|  4.99k|    memcpy(context->filters, header->filters, BLOSC2_MAX_FILTERS);
 1078|  4.99k|    memcpy(context->filters_meta, header->filters_meta, BLOSC2_MAX_FILTERS);
 1079|  4.99k|    context->compcode_meta = header->compcode_meta;
 1080|       |
 1081|  4.99k|    context->filter_flags = filters_to_flags(header->filters);
 1082|  4.99k|    context->special_type = (header->blosc2_flags >> 4) & BLOSC2_SPECIAL_MASK;
 1083|       |
 1084|       |    // Chunks with special values cannot be lazy (as in blosc_d()), and their
 1085|       |    // value is read from the buffer, so the cbytes check below must apply
 1086|  4.99k|    is_lazy = (context->blosc2_flags & 0x08u) && !context->special_type;
  ------------------
  |  Branch (1086:15): [True: 127, False: 4.87k]
  |  Branch (1086:50): [True: 4, False: 123]
  ------------------
 1087|  4.99k|  }
 1088|  1.16k|  else {
 1089|  1.16k|    context->header_overhead = BLOSC_MIN_HEADER_LENGTH;
 1090|  1.16k|    context->filter_flags = get_filter_flags(context->header_flags, context->typesize);
 1091|  1.16k|    flags_to_filters(context->header_flags, context->filters);
 1092|  1.16k|  }
 1093|       |
 1094|       |  // Some checks for malformed headers
 1095|  6.16k|  if (!is_lazy && header->cbytes > context->srcsize) {
  ------------------
  |  Branch (1095:7): [True: 6.16k, False: 4]
  |  Branch (1095:19): [True: 0, False: 6.16k]
  ------------------
 1096|      0|    return BLOSC2_ERROR_INVALID_HEADER;
 1097|      0|  }
 1098|       |
 1099|  6.16k|  return 0;
 1100|  6.16k|}
blosc2.c:get_filter_flags:
  890|  1.16k|                                const int32_t typesize) {
  891|  1.16k|  uint8_t flags = 0;
  892|       |
  893|  1.16k|  if ((header_flags & BLOSC_DOSHUFFLE) && (typesize > 1)) {
  ------------------
  |  Branch (893:7): [True: 141, False: 1.02k]
  |  Branch (893:43): [True: 123, False: 18]
  ------------------
  894|    123|    flags |= BLOSC_DOSHUFFLE;
  895|    123|  }
  896|  1.16k|  if (header_flags & BLOSC_DOBITSHUFFLE) {
  ------------------
  |  Branch (896:7): [True: 380, False: 787]
  ------------------
  897|    380|    flags |= BLOSC_DOBITSHUFFLE;
  898|    380|  }
  899|  1.16k|  if (header_flags & BLOSC_DODELTA) {
  ------------------
  |  Branch (899:7): [True: 865, False: 302]
  ------------------
  900|    865|    flags |= BLOSC_DODELTA;
  901|    865|  }
  902|  1.16k|  if (header_flags & BLOSC_MEMCPYED) {
  ------------------
  |  Branch (902:7): [True: 121, False: 1.04k]
  ------------------
  903|    121|    flags |= BLOSC_MEMCPYED;
  904|    121|  }
  905|  1.16k|  return flags;
  906|  1.16k|}
blosc2.c:clear_context_decompression_dict:
 3049|  3.47k|static void clear_context_decompression_dict(blosc2_context* context) {
 3050|  3.47k|  context->use_dict = 0;
 3051|  3.47k|  release_context_dict_buffer(context);
 3052|  3.47k|#if defined(HAVE_ZSTD)
 3053|  3.47k|  if (context->dict_ddict != NULL) {
  ------------------
  |  Branch (3053:7): [True: 0, False: 3.47k]
  ------------------
 3054|      0|    ZSTD_freeDDict(context->dict_ddict);
 3055|      0|    context->dict_ddict = NULL;
 3056|      0|  }
 3057|       |#else
 3058|       |  context->dict_ddict = NULL;
 3059|       |#endif
 3060|  3.47k|}
blosc2.c:check_nthreads:
 2714|  4.78k|static int check_nthreads(blosc2_context* context, bool start_backend) {
 2715|  4.78k|  if (context->new_nthreads != context->nthreads && context->new_nthreads <= 0) {
  ------------------
  |  Branch (2715:7): [True: 4, False: 4.77k]
  |  Branch (2715:53): [True: 4, False: 0]
  ------------------
 2716|      4|    BLOSC_TRACE_ERROR("nthreads must be >= 1 and <= %d", INT16_MAX);
  ------------------
  |  |   93|      4|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      4|    do {                                            \
  |  |  |  |   98|      4|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      4|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 4, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      4|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  ------------------
  |  |  |  |  |  | 2716|      0|    BLOSC_TRACE_ERROR("nthreads must be >= 1 and <= %d", INT16_MAX);
  |  |  |  |  ------------------
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2717|      4|    return BLOSC2_ERROR_INVALID_PARAM;
 2718|      4|  }
 2719|  4.77k|  if (context->nthreads <= 0) {
  ------------------
  |  Branch (2719:7): [True: 0, False: 4.77k]
  ------------------
 2720|      0|    BLOSC_TRACE_ERROR("nthreads must be >= 1 and <= %d", INT16_MAX);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  ------------------
  |  |  |  |  |  | 2720|      0|    BLOSC_TRACE_ERROR("nthreads must be >= 1 and <= %d", INT16_MAX);
  |  |  |  |  ------------------
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2721|      0|    return BLOSC2_ERROR_INVALID_PARAM;
 2722|      0|  }
 2723|       |
 2724|       |  /* Detect a pool that was torn down by blosc2_destroy() while this context
 2725|       |   * was still alive, or that belongs to the parent of a forked process.  The
 2726|       |   * epoch mismatch tells us the pool pointer is dangling or has no threads;
 2727|       |   * clear it so the re-attach logic below creates a fresh one. */
 2728|  4.77k|  if (context->thread_backend == BLOSC_BACKEND_SHARED_POOL &&
  ------------------
  |  |   34|  9.55k|#define BLOSC_BACKEND_SHARED_POOL 1
  ------------------
  |  Branch (2728:7): [True: 0, False: 4.77k]
  ------------------
 2729|      0|      context->pool_epoch != load_acquire_int(&g_destroy_count)) {
  ------------------
  |  |  142|      0|#define load_acquire_int(p) __atomic_load_n((p), __ATOMIC_ACQUIRE)
  ------------------
  |  Branch (2729:7): [True: 0, False: 0]
  ------------------
 2730|      0|    context->thread_pool = NULL;
 2731|      0|    context->threads_started = 0;
 2732|      0|    context->thread_backend = BLOSC_BACKEND_SERIAL;
  ------------------
  |  |   33|      0|#define BLOSC_BACKEND_SERIAL 0
  ------------------
 2733|      0|  }
 2734|       |
 2735|  4.77k|  if (context->new_nthreads != context->nthreads) {
  ------------------
  |  Branch (2735:7): [True: 0, False: 4.77k]
  ------------------
 2736|      0|    release_thread_backend(context);
 2737|      0|    context->nthreads = context->new_nthreads;
 2738|      0|  }
 2739|  4.77k|  if (start_backend && context->nthreads > 1 && context->threads_started == 0) {
  ------------------
  |  Branch (2739:7): [True: 0, False: 4.77k]
  |  Branch (2739:24): [True: 0, False: 0]
  |  Branch (2739:49): [True: 0, False: 0]
  ------------------
 2740|      0|    int rc;
 2741|      0|    if (threads_callback) {
  ------------------
  |  Branch (2741:9): [True: 0, False: 0]
  ------------------
 2742|      0|      rc = init_callback_threads(context);
 2743|      0|    }
 2744|      0|    else {
 2745|       |#if defined(_WIN32)
 2746|       |      rc = init_threadpool(context);
 2747|       |#else
 2748|      0|      rc = attach_shared_pool(context);
 2749|      0|#endif
 2750|      0|    }
 2751|      0|    if (rc < 0) {
  ------------------
  |  Branch (2751:9): [True: 0, False: 0]
  ------------------
 2752|      0|      return rc;
 2753|      0|    }
 2754|      0|  }
 2755|  4.77k|  if (context->nthreads <= 1) {
  ------------------
  |  Branch (2755:7): [True: 4.04k, False: 730]
  ------------------
 2756|  4.04k|    context->thread_backend = BLOSC_BACKEND_SERIAL;
  ------------------
  |  |   33|  4.04k|#define BLOSC_BACKEND_SERIAL 0
  ------------------
 2757|  4.04k|  }
 2758|       |
 2759|  4.77k|  return context->nthreads;
 2760|  4.77k|}
blosc2.c:register_atfork:
  311|      1|static void register_atfork(void) {
  312|      1|  if (pthread_atfork(atfork_prepare, atfork_parent, atfork_child) != 0) {
  ------------------
  |  Branch (312:7): [True: 0, False: 1]
  ------------------
  313|       |    BLOSC_TRACE_WARNING("pthread_atfork() failed: a fork()ed child may hang or crash with more than one thread");
  ------------------
  |  |   94|      0|#define BLOSC_TRACE_WARNING(msg, ...) BLOSC_TRACE(warning, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  314|      0|  }
  315|      1|}
blosc2.c:blosc2_init_locked:
 6696|  1.96k|static void blosc2_init_locked(void) {
 6697|  1.96k|  BLOSC2_IO_CB_DEFAULTS.id = BLOSC2_IO_FILESYSTEM;
 6698|  1.96k|  BLOSC2_IO_CB_DEFAULTS.name = "filesystem";
 6699|  1.96k|  BLOSC2_IO_CB_DEFAULTS.is_allocation_necessary = true;
 6700|  1.96k|  BLOSC2_IO_CB_DEFAULTS.open = (blosc2_open_cb) blosc2_stdio_open;
 6701|  1.96k|  BLOSC2_IO_CB_DEFAULTS.close = (blosc2_close_cb) blosc2_stdio_close;
 6702|  1.96k|  BLOSC2_IO_CB_DEFAULTS.size = (blosc2_size_cb) blosc2_stdio_size;
 6703|  1.96k|  BLOSC2_IO_CB_DEFAULTS.write = (blosc2_write_cb) blosc2_stdio_write;
 6704|  1.96k|  BLOSC2_IO_CB_DEFAULTS.read = (blosc2_read_cb) blosc2_stdio_read;
 6705|  1.96k|  BLOSC2_IO_CB_DEFAULTS.truncate = (blosc2_truncate_cb) blosc2_stdio_truncate;
 6706|  1.96k|  BLOSC2_IO_CB_DEFAULTS.destroy = (blosc2_destroy_cb) blosc2_stdio_destroy;
 6707|       |
 6708|  1.96k|  _blosc2_register_io_cb(&BLOSC2_IO_CB_DEFAULTS);
 6709|       |
 6710|  1.96k|  BLOSC2_IO_CB_MMAP.id = BLOSC2_IO_FILESYSTEM_MMAP;
 6711|  1.96k|  BLOSC2_IO_CB_MMAP.name = "filesystem_mmap";
 6712|  1.96k|  BLOSC2_IO_CB_MMAP.is_allocation_necessary = false;
 6713|  1.96k|  BLOSC2_IO_CB_MMAP.open = (blosc2_open_cb) blosc2_stdio_mmap_open;
 6714|  1.96k|  BLOSC2_IO_CB_MMAP.close = (blosc2_close_cb) blosc2_stdio_mmap_close;
 6715|  1.96k|  BLOSC2_IO_CB_MMAP.read = (blosc2_read_cb) blosc2_stdio_mmap_read;
 6716|  1.96k|  BLOSC2_IO_CB_MMAP.size = (blosc2_size_cb) blosc2_stdio_mmap_size;
 6717|  1.96k|  BLOSC2_IO_CB_MMAP.write = (blosc2_write_cb) blosc2_stdio_mmap_write;
 6718|  1.96k|  BLOSC2_IO_CB_MMAP.truncate = (blosc2_truncate_cb) blosc2_stdio_mmap_truncate;
 6719|  1.96k|  BLOSC2_IO_CB_MMAP.destroy = (blosc2_destroy_cb) blosc2_stdio_mmap_destroy;
 6720|       |
 6721|  1.96k|  _blosc2_register_io_cb(&BLOSC2_IO_CB_MMAP);
 6722|       |
 6723|       |  // BLOSC_PREFETCH=<nthreads> turns read-ahead on without touching the sources (see blosc2_set_prefetch())
 6724|  1.96k|  const char *prefetch_env = getenv("BLOSC_PREFETCH");
 6725|  1.96k|  if (prefetch_env != NULL && prefetch_env[0] != '\0') {
  ------------------
  |  Branch (6725:7): [True: 0, False: 1.96k]
  |  Branch (6725:31): [True: 0, False: 0]
  ------------------
 6726|      0|    long nthreads = strtol(prefetch_env, NULL, 10);
 6727|      0|    if (nthreads > 0 && nthreads <= BLOSC2_PREFETCH_MAX_NTHREADS) {
  ------------------
  |  |  786|      0|#define BLOSC2_PREFETCH_MAX_NTHREADS 256
  ------------------
  |  Branch (6727:9): [True: 0, False: 0]
  |  Branch (6727:25): [True: 0, False: 0]
  ------------------
 6728|      0|      blosc2_set_prefetch((int) nthreads, 0, 0);
 6729|      0|    }
 6730|      0|  }
 6731|       |  // BLOSC_PREFETCH_POPULATE: of which memory-mapped frames read-ahead populates the mapping: of all (1), of none (0),
 6732|       |  // or, if unset or empty, of those on GPFS
 6733|  1.96k|  const char *populate_env = getenv("BLOSC_PREFETCH_POPULATE");
 6734|  1.96k|  prefetch_set_populate(populate_env != NULL && populate_env[0] != '\0' ? strtol(populate_env, NULL, 10) != 0 : -1);
  ------------------
  |  Branch (6734:25): [True: 0, False: 1.96k]
  |  Branch (6734:49): [True: 0, False: 0]
  ------------------
 6735|       |
 6736|  1.96k|  g_ncodecs = 0;
 6737|  1.96k|  g_nfilters = 0;
 6738|  1.96k|  g_ntuners = 0;
 6739|       |
 6740|  1.96k|#if defined(HAVE_PLUGINS)
 6741|  1.96k|  #include "blosc2/blosc2-common.h"
 6742|  1.96k|  #include "blosc2/blosc2-stdio.h"
 6743|  1.96k|  register_codecs();
 6744|  1.96k|  register_filters();
 6745|  1.96k|  register_tuners();
 6746|  1.96k|#endif
 6747|  1.96k|  blosc2_pthread_mutex_init(&global_comp_mutex, NULL);
  ------------------
  |  |   90|  1.96k|#define blosc2_pthread_mutex_init(a, b) pthread_mutex_init((a), (b))
  ------------------
 6748|       |  /* Create a global context */
 6749|  1.96k|  g_global_context = (blosc2_context*)my_malloc(sizeof(blosc2_context));
 6750|  1.96k|  memset(g_global_context, 0, sizeof(blosc2_context));
 6751|  1.96k|  g_global_context->nthreads = g_nthreads;
 6752|  1.96k|  g_global_context->new_nthreads = g_nthreads;
 6753|  1.96k|  blosc2_pthread_mutex_init(&g_global_context->nchunk_mutex, NULL);
  ------------------
  |  |   90|  1.96k|#define blosc2_pthread_mutex_init(a, b) pthread_mutex_init((a), (b))
  ------------------
 6754|  1.96k|  store_release_int(&g_initlib, BLOSC_STATE_INITIALIZED);
  ------------------
  |  |  143|  1.96k|#define store_release_int(p, v) __atomic_store_n((p), (v), __ATOMIC_RELEASE)
  ------------------
 6755|  1.96k|}
blosc2.c:blosc2_free_resources_locked:
 6784|  1.96k|static int blosc2_free_resources_locked(void) {
 6785|       |  /* The calling thread's temporaries (other threads free theirs at exit) */
 6786|  1.96k|  blosc2_tmp_cache_clear();
 6787|  1.96k|  int rc = release_thread_backend(g_global_context);
 6788|       |  /* The thread pools that no context uses (kept for reuse) */
 6789|  1.96k|  static_lock(&pool_registry_mutex);
  ------------------
  |  |  132|  1.96k|#define static_lock(l) pthread_mutex_lock(l)
  ------------------
 6790|  1.96k|  struct blosc_shared_pool *unused = unlink_unused_pools_locked(0);
 6791|  1.96k|  static_unlock(&pool_registry_mutex);
  ------------------
  |  |  133|  1.96k|#define static_unlock(l) pthread_mutex_unlock(l)
  ------------------
 6792|  1.96k|  destroy_shared_pools(unused);
 6793|  1.96k|  return rc;
 6794|  1.96k|}
blosc2.c:unlink_unused_pools_locked:
 6013|  1.96k|static struct blosc_shared_pool *unlink_unused_pools_locked(int keep) {
 6014|  1.96k|  struct blosc_shared_pool *unused = NULL;
 6015|  1.96k|  struct blosc_shared_pool **prev = &shared_pools;
 6016|  1.96k|  while (*prev != NULL) {
  ------------------
  |  Branch (6016:10): [True: 0, False: 1.96k]
  ------------------
 6017|      0|    struct blosc_shared_pool *pool = *prev;
 6018|      0|    if (pool->context_refs == 0) {
  ------------------
  |  Branch (6018:9): [True: 0, False: 0]
  ------------------
 6019|      0|      if (keep == 0) {
  ------------------
  |  Branch (6019:11): [True: 0, False: 0]
  ------------------
 6020|      0|        *prev = pool->next;
 6021|      0|        pool->next = unused;
 6022|      0|        unused = pool;
 6023|      0|        continue;
 6024|      0|      }
 6025|      0|      keep--;
 6026|      0|    }
 6027|      0|    prev = &pool->next;
 6028|      0|  }
 6029|  1.96k|  return unused;
 6030|  1.96k|}
blosc2.c:destroy_shared_pools:
 6000|  3.93k|static void destroy_shared_pools(struct blosc_shared_pool *pool) {
 6001|  3.93k|  while (pool != NULL) {
  ------------------
  |  Branch (6001:10): [True: 0, False: 3.93k]
  ------------------
 6002|      0|    struct blosc_shared_pool *next = pool->next;
 6003|      0|    destroy_shared_pool(pool);
 6004|      0|    pool = next;
 6005|      0|  }
 6006|  3.93k|}
blosc2.c:serial_context_put:
 6921|  6.63k|static void serial_context_put(struct thread_context* thread_context) {
 6922|  6.63k|#if !defined(_WIN32)
 6923|  6.63k|  tmp_cache_t *cache = tmp_cache_get(false);
 6924|  6.63k|  if (cache != NULL && cache->serial == thread_context) {
  ------------------
  |  Branch (6924:7): [True: 6.63k, False: 0]
  |  Branch (6924:24): [True: 5.98k, False: 658]
  ------------------
 6925|  5.98k|    blosc2_context* context = thread_context->parent_context;
 6926|  5.98k|    if (context->serial_context == NULL &&
  ------------------
  |  Branch (6926:9): [True: 5.98k, False: 0]
  ------------------
 6927|  5.98k|        thread_context_nbytes(thread_context) > BLOSC2_SERIAL_TLS_MAX) {
  ------------------
  |  | 6817|  5.98k|#define BLOSC2_SERIAL_TLS_MAX (16 * 1024 * 1024)
  ------------------
  |  Branch (6927:9): [True: 1, False: 5.98k]
  ------------------
 6928|       |      /* Grown too large to keep per thread (e.g. ZSTD compression state for
 6929|       |         large blocks at high levels): the context that needed it keeps it, as
 6930|       |         if it had always been its own, and the thread starts a new one */
 6931|      1|      thread_context->tmp_blocksize = context->blocksize;
 6932|      1|      context->serial_context = thread_context;
 6933|      1|      cache->serial = NULL;
 6934|      1|    }
 6935|  5.98k|    else {
 6936|  5.98k|      thread_context->parent_context = NULL;
 6937|  5.98k|    }
 6938|  5.98k|    cache->serial_busy = false;
 6939|  5.98k|  }
 6940|       |#else
 6941|       |  BLOSC_UNUSED_PARAM(thread_context);
 6942|       |#endif
 6943|  6.63k|}
blosc2.c:thread_context_nbytes:
 6867|  5.98k|static size_t thread_context_nbytes(const struct thread_context* thread_context) {
 6868|  5.98k|  size_t nbytes = thread_context->tmp_nbytes +
 6869|  5.98k|                  (thread_context->blosclz_state != NULL ? sizeof(blosclz_state) : 0);
  ------------------
  |  Branch (6869:20): [True: 4.87k, False: 1.10k]
  ------------------
 6870|  5.98k|#if defined(HAVE_ZSTD)
 6871|  5.98k|  if (thread_context->zstd_cctx != NULL) {
  ------------------
  |  Branch (6871:7): [True: 2.89k, False: 3.08k]
  ------------------
 6872|  2.89k|    nbytes += ZSTD_sizeof_CCtx(thread_context->zstd_cctx);
 6873|  2.89k|  }
 6874|  5.98k|  if (thread_context->zstd_dctx != NULL) {
  ------------------
  |  Branch (6874:7): [True: 1.30k, False: 4.67k]
  ------------------
 6875|  1.30k|    nbytes += ZSTD_sizeof_DCtx(thread_context->zstd_dctx);
 6876|  1.30k|  }
 6877|  5.98k|#endif
 6878|  5.98k|  if (thread_context->lz4_cstream != NULL) {
  ------------------
  |  Branch (6878:7): [True: 156, False: 5.82k]
  ------------------
 6879|    156|    nbytes += sizeof(LZ4_stream_t);
 6880|    156|  }
 6881|  5.98k|  if (thread_context->lz4hc_cstream != NULL) {
  ------------------
  |  Branch (6881:7): [True: 0, False: 5.98k]
  ------------------
 6882|      0|    nbytes += sizeof(LZ4_streamHC_t);
 6883|      0|  }
 6884|  5.98k|  return nbytes;
 6885|  5.98k|}
blosc2.c:tmp_cache_get:
 6848|  16.5k|static tmp_cache_t *tmp_cache_get(bool create) {
 6849|  16.5k|  pthread_once(&tmp_cache_once, tmp_cache_init);
 6850|  16.5k|  if (!tmp_cache_ready) {
  ------------------
  |  Branch (6850:7): [True: 0, False: 16.5k]
  ------------------
 6851|      0|    return NULL;
 6852|      0|  }
 6853|  16.5k|  tmp_cache_t *cache = pthread_getspecific(tmp_cache_key);
 6854|  16.5k|  if (cache == NULL && create) {
  ------------------
  |  Branch (6854:7): [True: 1, False: 16.5k]
  |  Branch (6854:24): [True: 1, False: 0]
  ------------------
 6855|      1|    cache = calloc(1, sizeof(tmp_cache_t));
 6856|      1|    if (cache != NULL && pthread_setspecific(tmp_cache_key, cache) != 0) {
  ------------------
  |  Branch (6856:9): [True: 1, False: 0]
  |  Branch (6856:26): [True: 0, False: 1]
  ------------------
 6857|      0|      free(cache);
 6858|       |      cache = NULL;
 6859|      0|    }
 6860|      1|  }
 6861|  16.5k|  return cache;
 6862|  16.5k|}
blosc2.c:tmp_cache_init:
 6844|      1|static void tmp_cache_init(void) {
 6845|      1|  tmp_cache_ready = pthread_key_create(&tmp_cache_key, tmp_cache_release) == 0;
 6846|      1|}
blosc2.c:blosc2_destroy_locked:
 7045|  1.96k|static void blosc2_destroy_locked(void) {
 7046|  1.96k|  blosc2_free_resources_locked();
 7047|  1.96k|  blosc2_free_ctx(g_global_context);
 7048|  1.96k|  blosc2_tmp_cache_clear();
 7049|       |
 7050|       |  /* Atomically invalidate outstanding context pointers and detach the registry.
 7051|       |   * A release either finishes its refcount update before this, or observes the
 7052|       |   * new epoch without dereferencing its stale pool.  Join outside the lock. */
 7053|  1.96k|  static_lock(&pool_registry_mutex);
  ------------------
  |  |  132|  1.96k|#define static_lock(l) pthread_mutex_lock(l)
  ------------------
 7054|  1.96k|  store_release_int(&g_destroy_count, load_acquire_int(&g_destroy_count) + 1);
  ------------------
  |  |  143|  1.96k|#define store_release_int(p, v) __atomic_store_n((p), (v), __ATOMIC_RELEASE)
  ------------------
 7055|  1.96k|  struct blosc_shared_pool *pools = shared_pools;
 7056|  1.96k|  shared_pools = NULL;
 7057|  1.96k|  static_unlock(&pool_registry_mutex);
  ------------------
  |  |  133|  1.96k|#define static_unlock(l) pthread_mutex_unlock(l)
  ------------------
 7058|  1.96k|  destroy_shared_pools(pools);
 7059|       |
 7060|  1.96k|  blosc2_pthread_mutex_destroy(&global_comp_mutex);
  ------------------
  |  |   91|  1.96k|#define blosc2_pthread_mutex_destroy(a) pthread_mutex_destroy((a))
  ------------------
 7061|  1.96k|}
blosc2.c:my_malloc:
  383|  12.7k|static uint8_t* my_malloc(size_t size) {
  384|  12.7k|  void* block = NULL;
  385|  12.7k|  int res = 0;
  386|       |  /* Keep aligned allocations valid under Valgrind and POSIX wrappers. */
  387|  12.7k|  if (size == 0) {
  ------------------
  |  Branch (387:7): [True: 0, False: 12.7k]
  ------------------
  388|      0|    size = 1;
  389|      0|  }
  390|       |
  391|       |/* Do an alignment to 32 bytes because AVX2 is supported */
  392|       |#if defined(_WIN32)
  393|       |  /* A (void *) cast needed for avoiding a warning with MINGW :-/ */
  394|       |  block = (void *)_aligned_malloc(size, 32);
  395|       |#elif _POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600
  396|       |  /* Platform does have an implementation of posix_memalign */
  397|  12.7k|  res = posix_memalign(&block, 32, size);
  398|       |#else
  399|       |  block = malloc(size);
  400|       |#endif  /* _WIN32 */
  401|       |
  402|  12.7k|  if (block == NULL || res != 0) {
  ------------------
  |  Branch (402:7): [True: 0, False: 12.7k]
  |  Branch (402:24): [True: 0, False: 12.7k]
  ------------------
  403|      0|    BLOSC_TRACE_ERROR("Error allocating memory!");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  404|      0|    return NULL;
  405|      0|  }
  406|       |
  407|  12.7k|  return (uint8_t*)block;
  408|  12.7k|}
blosc2.c:release_thread_backend:
 6178|  9.57k|static int release_thread_backend(blosc2_context *context) {
 6179|  9.57k|  if (context->thread_backend == BLOSC_BACKEND_CALLBACK && context->threads_started > 0) {
  ------------------
  |  |   35|  19.1k|#define BLOSC_BACKEND_CALLBACK 2
  ------------------
  |  Branch (6179:7): [True: 0, False: 9.57k]
  |  Branch (6179:60): [True: 0, False: 0]
  ------------------
 6180|      0|    for (int32_t t = 0; t < context->threads_started; t++) {
  ------------------
  |  Branch (6180:25): [True: 0, False: 0]
  ------------------
 6181|      0|      destroy_thread_context(context->thread_contexts + t);
 6182|      0|    }
 6183|      0|    my_free(context->thread_contexts);
 6184|      0|    context->thread_contexts = NULL;
 6185|      0|    blosc2_pthread_mutex_destroy(&context->count_mutex);
  ------------------
  |  |   91|      0|#define blosc2_pthread_mutex_destroy(a) pthread_mutex_destroy((a))
  ------------------
 6186|      0|    blosc2_pthread_mutex_destroy(&context->delta_mutex);
  ------------------
  |  |   91|      0|#define blosc2_pthread_mutex_destroy(a) pthread_mutex_destroy((a))
  ------------------
 6187|      0|    blosc2_pthread_cond_destroy(&context->delta_cv);
  ------------------
  |  |   97|      0|#define blosc2_pthread_cond_destroy(a) pthread_cond_destroy((a))
  ------------------
 6188|      0|  }
 6189|       |#if defined(_WIN32)
 6190|       |  else if (context->thread_backend == BLOSC_BACKEND_PER_CONTEXT && context->threads_started > 0) {
 6191|       |    /* Signal all workers to exit. */
 6192|       |    blosc2_pthread_mutex_lock(&context->jobs_mutex);
 6193|       |    context->end_threads = 1;
 6194|       |    blosc2_pthread_cond_broadcast(&context->jobs_ready);
 6195|       |    blosc2_pthread_mutex_unlock(&context->jobs_mutex);
 6196|       |
 6197|       |    for (int32_t t = 0; t < context->threads_started; t++) {
 6198|       |      blosc2_pthread_join(context->threads[t], NULL);
 6199|       |    }
 6200|       |    my_free(context->threads);
 6201|       |    context->threads = NULL;
 6202|       |    blosc2_pthread_cond_destroy(&context->jobs_done);
 6203|       |    blosc2_pthread_cond_destroy(&context->jobs_ready);
 6204|       |    blosc2_pthread_mutex_destroy(&context->jobs_mutex);
 6205|       |    blosc2_pthread_cond_destroy(&context->delta_cv);
 6206|       |    blosc2_pthread_mutex_destroy(&context->delta_mutex);
 6207|       |    blosc2_pthread_mutex_destroy(&context->count_mutex);
 6208|       |  }
 6209|       |#endif  /* _WIN32 */
 6210|  9.57k|  else if (context->thread_backend == BLOSC_BACKEND_SHARED_POOL && context->thread_pool != NULL) {
  ------------------
  |  |   34|  19.1k|#define BLOSC_BACKEND_SHARED_POOL 1
  ------------------
  |  Branch (6210:12): [True: 0, False: 9.57k]
  |  Branch (6210:68): [True: 0, False: 0]
  ------------------
 6211|      0|    struct blosc_shared_pool *pool = context->thread_pool;
 6212|       |
 6213|      0|    static_lock(&pool_registry_mutex);
  ------------------
  |  |  132|      0|#define static_lock(l) pthread_mutex_lock(l)
  ------------------
 6214|      0|    if (context->pool_epoch != load_acquire_int(&g_destroy_count)) {
  ------------------
  |  |  142|      0|#define load_acquire_int(p) __atomic_load_n((p), __ATOMIC_ACQUIRE)
  ------------------
  |  Branch (6214:9): [True: 0, False: 0]
  ------------------
 6215|       |      /* Check under the process-lifetime registry lock: destruction cannot
 6216|       |       * invalidate the pool between this check and the refcount update. */
 6217|      0|      static_unlock(&pool_registry_mutex);
  ------------------
  |  |  133|      0|#define static_unlock(l) pthread_mutex_unlock(l)
  ------------------
 6218|      0|      context->thread_pool = NULL;
 6219|      0|      context->threads_started = 0;
 6220|      0|      context->thread_backend = BLOSC_BACKEND_SERIAL;
  ------------------
  |  |   33|      0|#define BLOSC_BACKEND_SERIAL 0
  ------------------
 6221|      0|      return 0;
 6222|      0|    }
 6223|       |
 6224|       |    /* A pool that no context uses any more stays registered for the next
 6225|       |     * contexts with the same nthreads: contexts that live for one call
 6226|       |     * (python-blosc2's compress2()/decompress2(), BLOSC_NOLOCK) would otherwise
 6227|       |     * start and join all of its threads every time.  The most recently
 6228|       |     * released unused pools are kept, the others destroyed (the pool moves to
 6229|       |     * the front of the registry); blosc2_free_resources() destroys all. */
 6230|      0|    struct blosc_shared_pool *unused = NULL;
 6231|      0|    pool->context_refs--;
 6232|      0|    if (pool->context_refs == 0) {
  ------------------
  |  Branch (6232:9): [True: 0, False: 0]
  ------------------
 6233|      0|      struct blosc_shared_pool **prev = &shared_pools;
 6234|      0|      while (*prev != NULL && *prev != pool) {
  ------------------
  |  Branch (6234:14): [True: 0, False: 0]
  |  Branch (6234:31): [True: 0, False: 0]
  ------------------
 6235|      0|        prev = &(*prev)->next;
 6236|      0|      }
 6237|      0|      if (*prev == pool) {
  ------------------
  |  Branch (6237:11): [True: 0, False: 0]
  ------------------
 6238|      0|        *prev = pool->next;
 6239|      0|        pool->next = shared_pools;
 6240|      0|        shared_pools = pool;
 6241|      0|      }
 6242|      0|      unused = unlink_unused_pools_locked(BLOSC2_UNUSED_POOLS_MAX);
  ------------------
  |  |  197|      0|#define BLOSC2_UNUSED_POOLS_MAX 2
  ------------------
 6243|      0|    }
 6244|      0|    static_unlock(&pool_registry_mutex);
  ------------------
  |  |  133|      0|#define static_unlock(l) pthread_mutex_unlock(l)
  ------------------
 6245|      0|    destroy_shared_pools(unused);
 6246|      0|    context->thread_pool = NULL;
 6247|      0|  }
 6248|       |
 6249|  9.57k|  context->threads_started = 0;
 6250|  9.57k|  context->thread_backend = BLOSC_BACKEND_SERIAL;
  ------------------
  |  |   33|  9.57k|#define BLOSC_BACKEND_SERIAL 0
  ------------------
 6251|  9.57k|  return 0;
 6252|  9.57k|}
blosc2.c:release_context_dict_buffer:
 3039|  13.0k|static void release_context_dict_buffer(blosc2_context* context) {
 3040|  13.0k|  if (context->dict_buffer_owned && context->dict_buffer != NULL) {
  ------------------
  |  Branch (3040:7): [True: 0, False: 13.0k]
  |  Branch (3040:37): [True: 0, False: 0]
  ------------------
 3041|      0|    free(context->dict_buffer);
 3042|      0|  }
 3043|  13.0k|  context->dict_buffer = NULL;
 3044|       |  context->dict_buffer_owned = false;
 3045|  13.0k|  context->dict_size = 0;
 3046|  13.0k|}

blosclz_compress_state:
 2108|  2.18k|                           void* output, int maxout, blosclz_state* state) {
 2109|  2.18k|#if defined(BLOSCLZ_AVX2_ENABLED) && !defined(__AVX2__)
 2110|  2.18k|  if (blosc_cpu_has_avx2()) {
  ------------------
  |  Branch (2110:7): [True: 2.18k, False: 0]
  ------------------
 2111|  2.18k|    return blosclz_compress_state_avx2(clevel, input, length, output, maxout, state);
 2112|  2.18k|  }
 2113|      0|#endif
 2114|      0|  if (state->tagged) {
  ------------------
  |  Branch (2114:7): [True: 0, False: 0]
  ------------------
 2115|      0|    return compress_impl(clevel, input, length, output, maxout, state->htab, state, 1);
 2116|      0|  }
 2117|      0|  return compress_impl(clevel, input, length, output, maxout, state->htab, state, 0);
 2118|      0|}
blosclz_decompress:
 2120|  4.35k|int blosclz_decompress(const void* input, int length, void* output, int maxout) {
 2121|  4.35k|#if defined(BLOSCLZ_AVX2_ENABLED) && !defined(__AVX2__)
 2122|  4.35k|  if (blosc_cpu_has_avx2()) {
  ------------------
  |  Branch (2122:7): [True: 4.35k, False: 0]
  ------------------
 2123|  4.35k|    return blosclz_decompress_avx2(input, length, output, maxout);
 2124|  4.35k|  }
 2125|      0|#endif
 2126|      0|  return blosclz_decompress_impl(input, length, output, maxout);
 2127|  4.35k|}
blosclz_compress_state_avx2:
 1266|  2.18k|                                void* output, int maxout, blosclz_state* state) {
 1267|  2.18k|  if (state->tagged) {
  ------------------
  |  Branch (1267:7): [True: 1.51k, False: 671]
  ------------------
 1268|  1.51k|    return compress_impl(clevel, input, length, output, maxout, state->htab, state, 1);
 1269|  1.51k|  }
 1270|    671|  return compress_impl(clevel, input, length, output, maxout, state->htab, state, 0);
 1271|  2.18k|}
blosc_get_run_avx2:
 1274|  1.10k|bool blosc_get_run_avx2(const uint8_t* ip, const uint8_t* ip_bound) {
 1275|  1.10k|  uint8_t x = *ip;
 1276|       |  /* Broadcast the reference byte across all 32 lanes */
 1277|  1.10k|  const __m256i vx = _mm256_set1_epi8((char)x);
 1278|  1.73k|  while (ip_bound - ip >= 128) {
  ------------------
  |  Branch (1278:10): [True: 1.30k, False: 431]
  ------------------
 1279|  1.30k|    const __m256i* p = (const __m256i*)ip;
 1280|  1.30k|    __m256i eq01 = _mm256_and_si256(_mm256_cmpeq_epi8(_mm256_loadu_si256(p), vx),
 1281|  1.30k|                                    _mm256_cmpeq_epi8(_mm256_loadu_si256(p + 1), vx));
 1282|  1.30k|    __m256i eq23 = _mm256_and_si256(_mm256_cmpeq_epi8(_mm256_loadu_si256(p + 2), vx),
 1283|  1.30k|                                    _mm256_cmpeq_epi8(_mm256_loadu_si256(p + 3), vx));
 1284|  1.30k|    if ((uint32_t)_mm256_movemask_epi8(_mm256_and_si256(eq01, eq23)) != 0xFFFFFFFFU) {
  ------------------
  |  Branch (1284:9): [True: 675, False: 630]
  ------------------
 1285|    675|      return false;
 1286|    675|    }
 1287|    630|    ip += 128;
 1288|    630|  }
 1289|       |  /* Check remaining 32-byte vectors and scalar tail */
 1290|    431|  while (ip_bound - ip >= 32) {
  ------------------
  |  Branch (1290:10): [True: 0, False: 431]
  ------------------
 1291|      0|    if ((uint32_t)_mm256_movemask_epi8(_mm256_cmpeq_epi8(_mm256_loadu_si256((const __m256i*)ip), vx)) != 0xFFFFFFFFU) {
  ------------------
  |  Branch (1291:9): [True: 0, False: 0]
  ------------------
 1292|      0|      return false;
 1293|      0|    }
 1294|      0|    ip += 32;
 1295|      0|  }
 1296|    431|  while (ip < ip_bound) {
  ------------------
  |  Branch (1296:10): [True: 0, False: 431]
  ------------------
 1297|      0|    if (*ip != x) {
  ------------------
  |  Branch (1297:9): [True: 0, False: 0]
  ------------------
 1298|      0|      return false;
 1299|      0|    }
 1300|      0|    ip++;
 1301|      0|  }
 1302|    431|  return true;
 1303|    431|}
blosclz_decompress_avx2:
 2089|  4.35k|int blosclz_decompress_avx2(const void* input, int length, void* output, int maxout) {
 2090|  4.35k|  return blosclz_decompress_impl(input, length, output, maxout);
 2091|  4.35k|}
blosclz-avx2.c:compress_impl:
  978|  2.18k|                                        int maxout, uint32_t htab[], blosclz_state* state, const int tagged) {
  979|       |  /* input and output buffer cannot be less than 16 and 66 bytes or we can get into trouble */
  980|  2.18k|  if (length < 16 || maxout < 66) {
  ------------------
  |  Branch (980:7): [True: 0, False: 2.18k]
  |  Branch (980:22): [True: 138, False: 2.04k]
  ------------------
  981|    138|    return 0;
  982|    138|  }
  983|       |
  984|  2.04k|  uint8_t* ibase = (uint8_t*)input;
  985|       |
  986|       |  /* Keep match coverage and boundary positioning consistent across levels.
  987|       |   * A shift of 4 truncates matches further and can disrupt periodic byte deltas,
  988|       |   * reducing both compression ratio and speed on floating-point ramps. */
  989|  2.04k|  const unsigned ipshift = 3;
  990|       |  /* Use a uniform 6-byte minimum match (len >= 4) paired with 6-byte hashing.
  991|       |   * Matching hash width to minlen eliminates short-match rejection thrashing
  992|       |   * on low-cardinality shuffled streams and keeps clevel cratio monotonic. */
  993|  2.04k|  const unsigned minlen = 4;
  994|       |
  995|       |  /* Keep at least an 8 KB (2048-entry) hash table at low levels so periodic
  996|       |   * shuffled byte streams (periods > 256 B) do not collapse, growing to 64 KB
  997|       |   * at level 7. */
  998|  2.04k|  static const uint8_t hashlog_[10] = {0, HASH_LOG - 3, HASH_LOG - 3, HASH_LOG - 3, HASH_LOG - 3,
  ------------------
  |  |   74|  2.04k|#define HASH_LOG (14U)
  ------------------
                static const uint8_t hashlog_[10] = {0, HASH_LOG - 3, HASH_LOG - 3, HASH_LOG - 3, HASH_LOG - 3,
  ------------------
  |  |   74|  2.04k|#define HASH_LOG (14U)
  ------------------
                static const uint8_t hashlog_[10] = {0, HASH_LOG - 3, HASH_LOG - 3, HASH_LOG - 3, HASH_LOG - 3,
  ------------------
  |  |   74|  2.04k|#define HASH_LOG (14U)
  ------------------
                static const uint8_t hashlog_[10] = {0, HASH_LOG - 3, HASH_LOG - 3, HASH_LOG - 3, HASH_LOG - 3,
  ------------------
  |  |   74|  2.04k|#define HASH_LOG (14U)
  ------------------
  999|  2.04k|                                       HASH_LOG - 2, HASH_LOG - 1, HASH_LOG, HASH_LOG, HASH_LOG};
  ------------------
  |  |   74|  2.04k|#define HASH_LOG (14U)
  ------------------
                                                     HASH_LOG - 2, HASH_LOG - 1, HASH_LOG, HASH_LOG, HASH_LOG};
  ------------------
  |  |   74|  2.04k|#define HASH_LOG (14U)
  ------------------
                                                     HASH_LOG - 2, HASH_LOG - 1, HASH_LOG, HASH_LOG, HASH_LOG};
  ------------------
  |  |   74|  2.04k|#define HASH_LOG (14U)
  ------------------
                                                     HASH_LOG - 2, HASH_LOG - 1, HASH_LOG, HASH_LOG, HASH_LOG};
  ------------------
  |  |   74|  2.04k|#define HASH_LOG (14U)
  ------------------
                                                     HASH_LOG - 2, HASH_LOG - 1, HASH_LOG, HASH_LOG, HASH_LOG};
  ------------------
  |  |   74|  2.04k|#define HASH_LOG (14U)
  ------------------
 1000|  2.04k|  uint8_t hashlog = hashlog_[clevel];
 1001|       |
 1002|       |  /* Miss skip acceleration:
 1003|       |   * - clevel 1..3 (fast): capped exponential ramp (misses += step up to max_step)
 1004|       |   *   so random spans inside mixed-entropy blocks (e.g. BITSHUFFLE LSB planes)
 1005|       |   *   are crossed quickly.
 1006|       |   * - clevel 4..9 (balanced/high-ratio): gentle linear ramp (misses++, max_step=0)
 1007|       |   *   preserving full compression ratio while backward match extension recovers
 1008|       |   *   any overshot prefix. */
 1009|  2.04k|  static const uint8_t skip_shift_[10] = {0, 4, 5, 5, 6, 6, 6, 6, 6, 6};
 1010|  2.04k|  static const uint16_t max_step_[10] = {0, 256, 256, 128, 0, 0, 0, 0, 0, 0};
 1011|  2.04k|  const unsigned skip_shift = skip_shift_[clevel];
 1012|  2.04k|  const unsigned max_step = max_step_[clevel];
 1013|       |
 1014|       |  /* Discard probes with small compression ratios (too expensive). */
 1015|  2.04k|  static const double cratio_[10] = {0, 1.3, 1.25, 1.2, 1.2, 1.2, 1.2, 1.15, 1.1, 1.0};
 1016|  2.04k|  const double min_cratio = cratio_[clevel];
 1017|       |
 1018|       |  /* Bounded head + tail entropy probing (up to 2 KB at head, plus 1 KB at tail
 1019|       |   * only if the head falls short).  Capping the probe avoids compressing half
 1020|       |   * of every stream twice at high levels, while checking the tail preserves
 1021|       |   * BITSHUFFLE blocks whose compressible MSB planes sit at the end.
 1022|       |   * Cap the probe table at 2048 entries (8 KB) so it fits in L1 cache and
 1023|       |   * keeps untagged resets cheap. */
 1024|  2.04k|  int head_len = length < 2048 ? length : 2048;
  ------------------
  |  Branch (1024:18): [True: 2.04k, False: 0]
  ------------------
 1025|  2.04k|  uint8_t probe_hashlog = hashlog > 11 ? 11 : hashlog;
  ------------------
  |  Branch (1025:27): [True: 1.57k, False: 475]
  ------------------
 1026|  2.04k|  uint32_t base = htab_reset(htab, probe_hashlog, state, head_len, tagged);
 1027|  2.04k|  double cratio = get_cratio(ibase, head_len, (int)minlen, (int)ipshift, htab, probe_hashlog, base, tagged);
 1028|  2.04k|  if (cratio < min_cratio && length > 4096) {
  ------------------
  |  Branch (1028:7): [True: 512, False: 1.53k]
  |  Branch (1028:30): [True: 0, False: 512]
  ------------------
 1029|      0|    int tail_len = 1024;
 1030|      0|    base = htab_reset(htab, probe_hashlog, state, tail_len, tagged);
 1031|      0|    double tail_cratio = get_cratio(ibase + (length - tail_len), tail_len, (int)minlen, (int)ipshift,
 1032|      0|                                    htab, probe_hashlog, base, tagged);
 1033|      0|    if (tail_cratio > cratio) {
  ------------------
  |  Branch (1033:9): [True: 0, False: 0]
  ------------------
 1034|      0|      cratio = tail_cratio;
 1035|      0|    }
 1036|      0|  }
 1037|  2.04k|  if (state != NULL) {
  ------------------
  |  Branch (1037:7): [True: 2.04k, False: 0]
  ------------------
 1038|       |    /* Tagged lookups skip clearing the >= 8 KB table between compressible streams. */
 1039|  2.04k|    state->tagged = hashlog >= 11 && cratio >= min_cratio;
  ------------------
  |  Branch (1039:21): [True: 2.04k, False: 0]
  |  Branch (1039:38): [True: 1.53k, False: 512]
  ------------------
 1040|  2.04k|  }
 1041|  2.04k|  if (cratio < min_cratio) {
  ------------------
  |  Branch (1041:7): [True: 512, False: 1.53k]
  ------------------
 1042|    512|    goto out;
 1043|    512|  }
 1044|       |
 1045|  1.53k|  uint8_t* ip = ibase + 4;
 1046|  1.53k|  uint8_t* lit_start = ibase;
 1047|  1.53k|  uint8_t* ip_bound = ibase + length - 1;
 1048|  1.53k|  uint8_t* ip_limit = ibase + length - 12;
 1049|  1.53k|  uint8_t* op = (uint8_t*)output;
 1050|  1.53k|  const uint8_t* op_limit = op + maxout;
 1051|  1.53k|  bool after_match = false;
 1052|       |
 1053|       |  /* Initialize the hash table for the full pass */
 1054|  1.53k|  base = htab_reset(htab, hashlog, state, length, tagged);
 1055|       |
 1056|       |  /* main loop */
 1057|  8.82k|  while (BLOSCLZ_LIKELY(ip < ip_limit)) {
  ------------------
  |  |   51|  8.82k|#define BLOSCLZ_LIKELY(c)    (c)
  |  |  ------------------
  |  |  |  Branch (51:30): [True: 7.59k, False: 1.22k]
  |  |  ------------------
  ------------------
 1058|  7.59k|    const uint8_t* ref;
 1059|  7.59k|    unsigned distance;
 1060|  7.59k|    uint8_t* anchor;
 1061|  7.59k|    unsigned len;
 1062|       |
 1063|       |    /* Immediately after a match (no pending literals), try the position
 1064|       |     * following the previous occurrence of the prefix at ip - 1. Hoisted out
 1065|       |     * of the miss loop so steady-state literal scans do not test after_match. */
 1066|  7.59k|    if (after_match) {
  ------------------
  |  Branch (1066:9): [True: 6.05k, False: 1.53k]
  ------------------
 1067|  6.05k|      after_match = false;
 1068|  6.05k|      anchor = ip;
 1069|  6.05k|      uint32_t hval = blosclz_hash6(ip, hashlog);
 1070|  6.05k|      uint32_t prevhash = blosclz_hash6(ip - 1, hashlog);
 1071|  6.05k|      const uint8_t *candidate = ibase + HTAB_GET(htab[prevhash], base) + 1;
  ------------------
  |  |  845|  6.05k|#define HTAB_GET(entry, base) (tagged ? blosclz_htab_get_tagged((entry), (base)) : (entry))
  |  |  ------------------
  |  |  |  Branch (845:32): [True: 4.51k, False: 1.54k]
  |  |  ------------------
  ------------------
 1072|  6.05k|      htab[prevhash] = (uint32_t)(ip - 1 - ibase) + base;
 1073|  6.05k|      const uint8_t *preferred = NULL;
 1074|  6.05k|      if (candidate < ip && ip - candidate < MAX_FARDISTANCE &&
  ------------------
  |  |   64|  12.1k|#define MAX_FARDISTANCE (65535 + MAX_DISTANCE - 1)
  |  |  ------------------
  |  |  |  |   63|  6.05k|#define MAX_DISTANCE 8191
  |  |  ------------------
  ------------------
  |  Branch (1074:11): [True: 6.05k, False: 0]
  |  Branch (1074:29): [True: 6.05k, False: 0]
  ------------------
 1075|  6.05k|          memcmp(candidate, ip, 8) == 0) {
  ------------------
  |  Branch (1075:11): [True: 1.20k, False: 4.85k]
  ------------------
 1076|  1.20k|        preferred = candidate;
 1077|  1.20k|      }
 1078|  6.05k|      ref = preferred ? preferred : ibase + HTAB_GET(htab[hval], base);
  ------------------
  |  |  845|  10.9k|#define HTAB_GET(entry, base) (tagged ? blosclz_htab_get_tagged((entry), (base)) : (entry))
  |  |  ------------------
  |  |  |  Branch (845:32): [True: 3.48k, False: 1.37k]
  |  |  ------------------
  ------------------
  |  Branch (1078:13): [True: 1.20k, False: 4.85k]
  ------------------
 1079|  6.05k|      distance = (unsigned int)(anchor - ref);
 1080|  6.05k|      htab[hval] = (uint32_t)(anchor - ibase) + base;
 1081|  6.05k|      if (distance != 0 && distance < MAX_FARDISTANCE) {
  ------------------
  |  |   64|  6.05k|#define MAX_FARDISTANCE (65535 + MAX_DISTANCE - 1)
  |  |  ------------------
  |  |  |  |   63|  6.05k|#define MAX_DISTANCE 8191
  |  |  ------------------
  ------------------
  |  Branch (1081:11): [True: 6.05k, False: 0]
  |  Branch (1081:28): [True: 6.05k, False: 0]
  ------------------
 1082|       |        /* The preferred candidate already matched all eight bytes. */
 1083|  6.05k|        uint64_t diff = preferred ? 0 : blosclz_readu64(anchor) ^ blosclz_readu64(ref);
  ------------------
  |  Branch (1083:25): [True: 1.20k, False: 4.85k]
  ------------------
 1084|  6.05k|        if ((diff & BLOSCLZ_PREFIX6_MASK) == 0) {
  ------------------
  |  |   82|  6.05k|#define BLOSCLZ_PREFIX6_MASK 0x0000FFFFFFFFFFFFULL
  ------------------
  |  Branch (1084:13): [True: 2.23k, False: 3.82k]
  ------------------
 1085|  2.23k|          distance--;
 1086|  2.23k|          if (BLOSCLZ_UNLIKELY(!distance)) {
  ------------------
  |  |   52|  2.23k|#define BLOSCLZ_UNLIKELY(c)  (c)
  |  |  ------------------
  |  |  |  Branch (52:30): [True: 309, False: 1.92k]
  |  |  ------------------
  ------------------
 1087|    309|            ip = get_run_fast(anchor + 4, ip_bound, ref + 4);
 1088|    309|          }
 1089|  1.92k|#if !BLOSCLZ_BIG_ENDIAN && defined(BLOSCLZ_HAVE_CTZ64)
 1090|  1.92k|          else if (diff != 0) {
  ------------------
  |  Branch (1090:20): [True: 428, False: 1.50k]
  ------------------
 1091|    428|            ip = anchor + (blosclz_ctz64(diff) >> 3) + 1;
 1092|    428|          }
 1093|  1.50k|          else {
 1094|  1.50k|            ip = get_match_fast(anchor + 8, ip_bound, ref + 8);
 1095|  1.50k|          }
 1096|       |#else
 1097|       |          else {
 1098|       |            ip = get_match_fast(anchor + 6, ip_bound, ref + 6);
 1099|       |          }
 1100|       |#endif
 1101|  2.23k|          ip -= ipshift;
 1102|  2.23k|          len = (unsigned)(ip - anchor);
 1103|  2.23k|          if (len >= minlen && !(len <= 5 && distance >= MAX_DISTANCE)) {
  ------------------
  |  |   63|    479|#define MAX_DISTANCE 8191
  ------------------
  |  Branch (1103:15): [True: 2.23k, False: 0]
  |  Branch (1103:34): [True: 479, False: 1.75k]
  |  Branch (1103:46): [True: 0, False: 479]
  ------------------
 1104|  2.23k|            goto emit_match;
 1105|  2.23k|          }
 1106|  2.23k|        }
 1107|  6.05k|      }
 1108|  3.82k|      ip = anchor + 1;
 1109|  3.82k|    }
 1110|       |
 1111|  5.35k|    {
 1112|  5.35k|      unsigned misses = 1U << skip_shift;
 1113|       |      /* Keep at least 4 leading literals so output[0] is always a literal token. */
 1114|  5.35k|      const uint8_t *back_limit = (lit_start > ibase) ? lit_start : (ibase + 4);
  ------------------
  |  Branch (1114:35): [True: 3.82k, False: 1.53k]
  ------------------
 1115|       |
 1116|       |      /* Tight match-finding loop: defer literal copies until a match is found. */
 1117|  42.5k|      for (;;) {
 1118|  42.5k|        if (BLOSCLZ_UNLIKELY(ip >= ip_limit)) {
  ------------------
  |  |   52|  42.5k|#define BLOSCLZ_UNLIKELY(c)  (c)
  |  |  ------------------
  |  |  |  Branch (52:30): [True: 307, False: 42.2k]
  |  |  ------------------
  ------------------
 1119|    307|          goto tail;
 1120|    307|        }
 1121|  42.2k|        anchor = ip;
 1122|       |
 1123|       |        /* find potential match */
 1124|  42.2k|        uint32_t hval = blosclz_hash6(ip, hashlog);
 1125|  42.2k|        ref = ibase + HTAB_GET(htab[hval], base);
  ------------------
  |  |  845|  42.2k|#define HTAB_GET(entry, base) (tagged ? blosclz_htab_get_tagged((entry), (base)) : (entry))
  |  |  ------------------
  |  |  |  Branch (845:32): [True: 31.9k, False: 10.2k]
  |  |  ------------------
  ------------------
 1126|       |
 1127|       |        /* calculate distance to the match */
 1128|  42.2k|        distance = (unsigned int)(anchor - ref);
 1129|       |
 1130|       |        /* update hash table */
 1131|  42.2k|        htab[hval] = (uint32_t)(anchor - ibase) + base;
 1132|       |
 1133|  42.2k|        if (distance != 0 && distance < MAX_FARDISTANCE) {
  ------------------
  |  |   64|  42.2k|#define MAX_FARDISTANCE (65535 + MAX_DISTANCE - 1)
  |  |  ------------------
  |  |  |  |   63|  42.2k|#define MAX_DISTANCE 8191
  |  |  ------------------
  ------------------
  |  Branch (1133:13): [True: 42.2k, False: 0]
  |  Branch (1133:30): [True: 42.2k, False: 0]
  ------------------
 1134|       |          /* Verify all 6 bytes (minlen == 4) in one 64-bit XOR before match scan */
 1135|  42.2k|          uint64_t diff = blosclz_readu64(anchor) ^ blosclz_readu64(ref);
 1136|  42.2k|          if ((diff & BLOSCLZ_PREFIX6_MASK) == 0) {
  ------------------
  |  |   82|  42.2k|#define BLOSCLZ_PREFIX6_MASK 0x0000FFFFFFFFFFFFULL
  ------------------
  |  Branch (1136:15): [True: 5.04k, False: 37.1k]
  ------------------
 1137|  5.04k|            uint8_t *orig_anchor = anchor;
 1138|       |            /* Recover bytes skipped when a larger step lands inside a match. */
 1139|  5.04k|            if (BLOSCLZ_UNLIKELY(anchor > back_limit && ref > ibase && anchor[-1] == ref[-1])) {
  ------------------
  |  |   52|  19.2k|#define BLOSCLZ_UNLIKELY(c)  (c)
  |  |  ------------------
  |  |  |  Branch (52:31): [True: 4.75k, False: 299]
  |  |  |  Branch (52:31): [True: 4.41k, False: 338]
  |  |  |  Branch (52:31): [True: 878, False: 3.53k]
  |  |  ------------------
  ------------------
 1140|  2.41k|              do {
 1141|  2.41k|                anchor--;
 1142|  2.41k|                ref--;
 1143|  2.41k|              } while (anchor > back_limit && ref > ibase && anchor[-1] == ref[-1]);
  ------------------
  |  Branch (1143:24): [True: 2.15k, False: 262]
  |  Branch (1143:47): [True: 2.15k, False: 0]
  |  Branch (1143:62): [True: 1.53k, False: 616]
  ------------------
 1144|    878|              distance--;
 1145|    878|              if (BLOSCLZ_UNLIKELY(!distance)) {
  ------------------
  |  |   52|    878|#define BLOSCLZ_UNLIKELY(c)  (c)
  |  |  ------------------
  |  |  |  Branch (52:30): [True: 68, False: 810]
  |  |  ------------------
  ------------------
 1146|     68|                ip = get_run_fast(anchor + 4, ip_bound, ref + 4);
 1147|    810|              } else {
 1148|    810|                ip = get_match_fast(anchor + 6, ip_bound, ref + 6);
 1149|    810|              }
 1150|  4.17k|            } else {
 1151|       |              /* distance is biased */
 1152|  4.17k|              distance--;
 1153|       |
 1154|       |              /* get runs or matches; zero distance means a run */
 1155|  4.17k|              if (BLOSCLZ_UNLIKELY(!distance)) {
  ------------------
  |  |   52|  4.17k|#define BLOSCLZ_UNLIKELY(c)  (c)
  |  |  ------------------
  |  |  |  Branch (52:30): [True: 1.23k, False: 2.93k]
  |  |  ------------------
  ------------------
 1156|  1.23k|                ip = get_run_fast(anchor + 4, ip_bound, ref + 4);
 1157|  1.23k|              }
 1158|  2.93k|#if !BLOSCLZ_BIG_ENDIAN && defined(BLOSCLZ_HAVE_CTZ64)
 1159|  2.93k|              else if (diff != 0) {
  ------------------
  |  Branch (1159:24): [True: 1.40k, False: 1.52k]
  ------------------
 1160|  1.40k|                ip = anchor + (blosclz_ctz64(diff) >> 3) + 1;
 1161|  1.40k|              }
 1162|  1.52k|              else {
 1163|  1.52k|                ip = get_match_fast(anchor + 8, ip_bound, ref + 8);
 1164|  1.52k|              }
 1165|       |#else
 1166|       |              else {
 1167|       |                ip = get_match_fast(anchor + 6, ip_bound, ref + 6);
 1168|       |              }
 1169|       |#endif
 1170|  4.17k|            }
 1171|       |
 1172|       |            /* length is biased, '1' means a match of 3 bytes */
 1173|  5.04k|            ip -= ipshift;
 1174|  5.04k|            len = (unsigned)(ip - anchor);
 1175|       |
 1176|  5.04k|            if (len >= minlen && !(len <= 5 && distance >= MAX_DISTANCE)) {
  ------------------
  |  |   63|  1.93k|#define MAX_DISTANCE 8191
  ------------------
  |  Branch (1176:17): [True: 5.04k, False: 0]
  |  Branch (1176:36): [True: 1.93k, False: 3.11k]
  |  Branch (1176:48): [True: 0, False: 1.93k]
  ------------------
 1177|  5.04k|              break;
 1178|  5.04k|            }
 1179|      0|            ip = orig_anchor + 1;
 1180|      0|            continue;
 1181|  5.04k|          }
 1182|  42.2k|        }
 1183|       |
 1184|  37.1k|        unsigned step = misses >> skip_shift;
 1185|  37.1k|        if (max_step != 0) {
  ------------------
  |  Branch (1185:13): [True: 9.33k, False: 27.8k]
  ------------------
 1186|  9.33k|          if (step >= max_step) {
  ------------------
  |  Branch (1186:15): [True: 0, False: 9.33k]
  ------------------
 1187|      0|            step = max_step;
 1188|  9.33k|          } else {
 1189|  9.33k|            misses += step;
 1190|  9.33k|          }
 1191|  27.8k|        } else {
 1192|  27.8k|          misses++;
 1193|  27.8k|        }
 1194|  37.1k|        ip = anchor + step;
 1195|  37.1k|      }
 1196|  5.35k|    }
 1197|       |
 1198|  7.28k|emit_match:
 1199|       |    /* Emit pending literals in bulk */
 1200|  7.28k|    {
 1201|  7.28k|      size_t lit_len = (size_t)(anchor - lit_start);
 1202|  7.28k|      if (lit_len > 0) {
  ------------------
  |  Branch (1202:11): [True: 4.87k, False: 2.41k]
  ------------------
 1203|  4.87k|        op = emit_literals(op, op_limit, lit_start, lit_len);
 1204|  4.87k|        if (BLOSCLZ_UNLIKELY(op == NULL)) {
  ------------------
  |  |   52|  4.87k|#define BLOSCLZ_UNLIKELY(c)  (c)
  |  |  ------------------
  |  |  |  Branch (52:30): [True: 0, False: 4.87k]
  |  |  ------------------
  ------------------
 1205|      0|          goto out;
 1206|      0|        }
 1207|  4.87k|      }
 1208|  7.28k|    }
 1209|       |
 1210|       |    /* encode the match */
 1211|  7.28k|    if (distance < MAX_DISTANCE) {
  ------------------
  |  |   63|  7.28k|#define MAX_DISTANCE 8191
  ------------------
  |  Branch (1211:9): [True: 7.28k, False: 0]
  ------------------
 1212|  7.28k|      if (len < 7) {
  ------------------
  |  Branch (1212:11): [True: 2.88k, False: 4.40k]
  ------------------
 1213|  2.88k|        MATCH_SHORT(op, op_limit, len, distance)
  ------------------
  |  |  788|  2.88k|#define MATCH_SHORT(op, op_limit, len, distance) {        \
  |  |  789|  2.88k|  if (BLOSCLZ_UNLIKELY((op_limit) - (op) < 2))            \
  |  |  ------------------
  |  |  |  |   52|  2.88k|#define BLOSCLZ_UNLIKELY(c)  (c)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (52:30): [True: 0, False: 2.88k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  790|  2.88k|    goto out;                                             \
  |  |  791|  2.88k|  *(op)++ = (uint8_t)(((len) << 5U) + ((distance) >> 8U));\
  |  |  792|  2.88k|  *(op)++ = (uint8_t)(((distance) & 255U));               \
  |  |  793|  2.88k|}
  ------------------
 1214|  4.40k|      } else {
 1215|  13.2k|        MATCH_LONG(op, op_limit, len, distance)
  ------------------
  |  |  795|  4.40k|#define MATCH_LONG(op, op_limit, len, distance) {       \
  |  |  796|  4.40k|  if (BLOSCLZ_UNLIKELY((op_limit) - (op) < 1))          \
  |  |  ------------------
  |  |  |  |   52|  4.40k|#define BLOSCLZ_UNLIKELY(c)  (c)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (52:30): [True: 0, False: 4.40k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  797|  4.40k|    goto out;                                           \
  |  |  798|  4.40k|  *(op)++ = (uint8_t)((7U << 5U) + ((distance) >> 8U)); \
  |  |  799|  4.40k|  for ((len) -= 7; (len) >= 255; (len) -= 255) {        \
  |  |  ------------------
  |  |  |  Branch (799:20): [True: 0, False: 4.40k]
  |  |  ------------------
  |  |  800|      0|    if (BLOSCLZ_UNLIKELY((op_limit) - (op) < 1))        \
  |  |  ------------------
  |  |  |  |   52|      0|#define BLOSCLZ_UNLIKELY(c)  (c)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (52:30): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  801|      0|      goto out;                                         \
  |  |  802|      0|    *(op)++ = 255;                                      \
  |  |  803|      0|  }                                                     \
  |  |  804|  4.40k|  if (BLOSCLZ_UNLIKELY((op_limit) - (op) < 2))          \
  |  |  ------------------
  |  |  |  |   52|  4.40k|#define BLOSCLZ_UNLIKELY(c)  (c)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (52:30): [True: 0, False: 4.40k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  805|  4.40k|    goto out;                                           \
  |  |  806|  4.40k|  *(op)++ = (uint8_t)(len);                             \
  |  |  807|  4.40k|  *(op)++ = (uint8_t)(((distance) & 255U));             \
  |  |  808|  4.40k|}
  ------------------
 1216|  13.2k|      }
 1217|  7.28k|    } else {
 1218|       |      /* far away, but not yet in the another galaxy... */
 1219|      0|      distance -= MAX_DISTANCE;
  ------------------
  |  |   63|      0|#define MAX_DISTANCE 8191
  ------------------
 1220|      0|      if (len < 7) {
  ------------------
  |  Branch (1220:11): [True: 0, False: 0]
  ------------------
 1221|      0|        MATCH_SHORT_FAR(op, op_limit, len, distance)
  ------------------
  |  |  810|      0|#define MATCH_SHORT_FAR(op, op_limit, len, distance) {      \
  |  |  811|      0|  if (BLOSCLZ_UNLIKELY((op_limit) - (op) < 4))              \
  |  |  ------------------
  |  |  |  |   52|      0|#define BLOSCLZ_UNLIKELY(c)  (c)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (52:30): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  812|      0|    goto out;                                               \
  |  |  813|      0|  *(op)++ = (uint8_t)(((len) << 5U) + 31);                  \
  |  |  814|      0|  *(op)++ = 255;                                            \
  |  |  815|      0|  *(op)++ = (uint8_t)((distance) >> 8U);                    \
  |  |  816|      0|  *(op)++ = (uint8_t)((distance) & 255U);                   \
  |  |  817|      0|}
  ------------------
 1222|      0|      } else {
 1223|      0|        MATCH_LONG_FAR(op, op_limit, len, distance)
  ------------------
  |  |  819|      0|#define MATCH_LONG_FAR(op, op_limit, len, distance) {       \
  |  |  820|      0|  if (BLOSCLZ_UNLIKELY((op_limit) - (op) < 1))              \
  |  |  ------------------
  |  |  |  |   52|      0|#define BLOSCLZ_UNLIKELY(c)  (c)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (52:30): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  821|      0|    goto out;                                               \
  |  |  822|      0|  *(op)++ = (7U << 5U) + 31;                                \
  |  |  823|      0|  for ((len) -= 7; (len) >= 255; (len) -= 255) {            \
  |  |  ------------------
  |  |  |  Branch (823:20): [True: 0, False: 0]
  |  |  ------------------
  |  |  824|      0|    if (BLOSCLZ_UNLIKELY((op_limit) - (op) < 1))            \
  |  |  ------------------
  |  |  |  |   52|      0|#define BLOSCLZ_UNLIKELY(c)  (c)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (52:30): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  825|      0|      goto out;                                             \
  |  |  826|      0|    *(op)++ = 255;                                          \
  |  |  827|      0|  }                                                         \
  |  |  828|      0|  if (BLOSCLZ_UNLIKELY((op_limit) - (op) < 4))              \
  |  |  ------------------
  |  |  |  |   52|      0|#define BLOSCLZ_UNLIKELY(c)  (c)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (52:30): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  829|      0|    goto out;                                               \
  |  |  830|      0|  *(op)++ = (uint8_t)(len);                                 \
  |  |  831|      0|  *(op)++ = 255;                                            \
  |  |  832|      0|  *(op)++ = (uint8_t)((distance) >> 8U);                    \
  |  |  833|      0|  *(op)++ = (uint8_t)((distance) & 255U);                   \
  |  |  834|      0|}
  ------------------
 1224|      0|      }
 1225|      0|    }
 1226|       |
 1227|       |    /* Advance past the biased match length.  Update the boundary hashes on
 1228|       |     * the next iteration, preserving the old ip-1 entry for the extra candidate. */
 1229|  7.28k|    ip += 2;
 1230|  7.28k|    lit_start = ip;
 1231|  7.28k|    after_match = true;
 1232|  7.28k|  }
 1233|       |
 1234|  1.53k|tail:
 1235|       |  /* Emit left-over bytes as literals */
 1236|  1.53k|  {
 1237|  1.53k|    size_t lit_len = (size_t)(ip_bound - lit_start + 1);
 1238|  1.53k|    if (lit_len > 0) {
  ------------------
  |  Branch (1238:9): [True: 1.53k, False: 0]
  ------------------
 1239|  1.53k|      op = emit_literals(op, op_limit, lit_start, lit_len);
 1240|  1.53k|      if (BLOSCLZ_UNLIKELY(op == NULL)) {
  ------------------
  |  |   52|  1.53k|#define BLOSCLZ_UNLIKELY(c)  (c)
  |  |  ------------------
  |  |  |  Branch (52:30): [True: 32, False: 1.50k]
  |  |  ------------------
  ------------------
 1241|     32|        goto out;
 1242|     32|      }
 1243|  1.53k|    }
 1244|  1.53k|  }
 1245|       |
 1246|       |  /* marker for blosclz */
 1247|  1.50k|  *(uint8_t*)output |= (1U << 5U);
 1248|       |
 1249|  1.50k|  return (int)(op - (uint8_t*)output);
 1250|       |
 1251|    544|out:
 1252|    544|  return 0;
 1253|  1.53k|}
blosclz-avx2.c:htab_reset:
  959|  3.58k|                                          const int tagged) {
  960|  3.58k|  if (!tagged) {
  ------------------
  |  Branch (960:7): [True: 819, False: 2.76k]
  ------------------
  961|    819|    memset(htab, 0, (1U << hashlog) * sizeof(uint32_t));
  962|       |    /* untagged entries (< span) must look stale to the next tagged pass */
  963|    819|    if (state != NULL && state->base < (uint32_t)span) {
  ------------------
  |  Branch (963:9): [True: 819, False: 0]
  |  Branch (963:26): [True: 30, False: 789]
  ------------------
  964|     30|      state->base = (uint32_t)span;
  965|     30|    }
  966|    819|    return 0;
  967|    819|  }
  968|  2.76k|  if (state->base > UINT32_MAX - (uint32_t)span) {
  ------------------
  |  Branch (968:7): [True: 0, False: 2.76k]
  ------------------
  969|      0|    memset(state->htab, 0, sizeof(state->htab));
  970|      0|    state->base = 0;
  971|      0|  }
  972|  2.76k|  uint32_t base = state->base;
  973|  2.76k|  state->base += (uint32_t)span;
  974|  2.76k|  return base;
  975|  3.58k|}
blosclz-avx2.c:get_cratio:
  849|  2.04k|                                        uint8_t hashlog, uint32_t base, const int tagged) {
  850|  2.04k|  if (maxlen < 16) {
  ------------------
  |  Branch (850:7): [True: 0, False: 2.04k]
  ------------------
  851|      0|    return 0.0;
  852|      0|  }
  853|  2.04k|  uint8_t* ip = ibase + 4;
  854|  2.04k|  int32_t oc = 5;
  855|  2.04k|  uint8_t copy = 4;
  856|  2.04k|  const uint16_t hashlen = (1U << hashlog);
  857|  2.04k|  uint16_t limit = (maxlen > hashlen) ? hashlen : (uint16_t)maxlen;
  ------------------
  |  Branch (857:20): [True: 0, False: 2.04k]
  ------------------
  858|  2.04k|  uint8_t* ip_end = ibase + limit;
  859|  2.04k|  uint8_t* ip_bound = ip_end - 1;
  860|  2.04k|  uint8_t* ip_limit = ip_end - 12;
  861|       |
  862|       |  /* main loop */
  863|   105k|  while (BLOSCLZ_LIKELY(ip < ip_limit)) {
  ------------------
  |  |   51|   105k|#define BLOSCLZ_LIKELY(c)    (c)
  |  |  ------------------
  |  |  |  Branch (51:30): [True: 103k, False: 2.04k]
  |  |  ------------------
  ------------------
  864|   103k|    uint8_t* anchor = ip;    /* comparison starting-point */
  865|       |
  866|       |    /* find potential match */
  867|   103k|    uint32_t hval = blosclz_hash6(ip, hashlog);
  868|   103k|    const uint8_t* ref = ibase + HTAB_GET(htab[hval], base);
  ------------------
  |  |  845|   103k|#define HTAB_GET(entry, base) (tagged ? blosclz_htab_get_tagged((entry), (base)) : (entry))
  |  |  ------------------
  |  |  |  Branch (845:32): [True: 63.7k, False: 39.9k]
  |  |  ------------------
  ------------------
  869|       |
  870|       |    /* calculate distance to the match */
  871|   103k|    unsigned distance = (unsigned int)(anchor - ref);
  872|       |
  873|       |    /* update hash table */
  874|   103k|    htab[hval] = (uint32_t)(anchor - ibase) + base;
  875|       |
  876|   103k|    if (distance == 0 || distance >= MAX_FARDISTANCE) {
  ------------------
  |  |   64|   103k|#define MAX_FARDISTANCE (65535 + MAX_DISTANCE - 1)
  |  |  ------------------
  |  |  |  |   63|   103k|#define MAX_DISTANCE 8191
  |  |  ------------------
  ------------------
  |  Branch (876:9): [True: 0, False: 103k]
  |  Branch (876:26): [True: 0, False: 103k]
  ------------------
  877|      0|      LITERAL2(ip, anchor, copy)
  ------------------
  |  |  778|      0|#define LITERAL2(ip, anchor, copy) {                    \
  |  |  779|      0|  oc++; (anchor)++;                                     \
  |  |  780|      0|  (ip) = (anchor);                                      \
  |  |  781|      0|  (copy)++;                                             \
  |  |  782|      0|  if (BLOSCLZ_UNLIKELY((copy) == MAX_COPY)) {           \
  |  |  ------------------
  |  |  |  |   52|      0|#define BLOSCLZ_UNLIKELY(c)  (c)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (52:30): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  783|      0|    (copy) = 0;                                         \
  |  |  784|      0|    oc++;                                               \
  |  |  785|      0|  }                                                     \
  |  |  786|      0|}
  ------------------
  878|      0|      continue;
  879|      0|    }
  880|       |
  881|       |    /* Check the full 6-byte prefix (matching minlen == 4) in one 64-bit op */
  882|   103k|    uint64_t a64 = blosclz_readu64(anchor);
  883|   103k|    uint64_t b64 = blosclz_readu64(ref);
  884|   103k|    uint64_t diff = a64 ^ b64;
  885|   103k|    if ((diff & BLOSCLZ_PREFIX6_MASK) != 0) {
  ------------------
  |  |   82|   103k|#define BLOSCLZ_PREFIX6_MASK 0x0000FFFFFFFFFFFFULL
  ------------------
  |  Branch (885:9): [True: 96.0k, False: 7.69k]
  ------------------
  886|  96.0k|      LITERAL2(ip, anchor, copy)
  ------------------
  |  |  778|  96.0k|#define LITERAL2(ip, anchor, copy) {                    \
  |  |  779|  96.0k|  oc++; (anchor)++;                                     \
  |  |  780|  96.0k|  (ip) = (anchor);                                      \
  |  |  781|  96.0k|  (copy)++;                                             \
  |  |  782|  96.0k|  if (BLOSCLZ_UNLIKELY((copy) == MAX_COPY)) {           \
  |  |  ------------------
  |  |  |  |   52|  96.0k|#define BLOSCLZ_UNLIKELY(c)  (c)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (52:30): [True: 1.69k, False: 94.3k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  783|  1.69k|    (copy) = 0;                                         \
  |  |  784|  1.69k|    oc++;                                               \
  |  |  785|  1.69k|  }                                                     \
  |  |  786|  96.0k|}
  ------------------
  887|  96.0k|      continue;
  888|  96.0k|    }
  889|       |
  890|       |    /* distance is biased */
  891|  7.69k|    distance--;
  892|       |
  893|       |    /* get runs or matches; zero distance means a run */
  894|  7.69k|    if (BLOSCLZ_UNLIKELY(!distance)) {
  ------------------
  |  |   52|  7.69k|#define BLOSCLZ_UNLIKELY(c)  (c)
  |  |  ------------------
  |  |  |  Branch (52:30): [True: 1.54k, False: 6.15k]
  |  |  ------------------
  ------------------
  895|  1.54k|      ip = get_run_fast(anchor + 4, ip_bound, ref + 4);
  896|  1.54k|    }
  897|  6.15k|#if !BLOSCLZ_BIG_ENDIAN && defined(BLOSCLZ_HAVE_CTZ64)
  898|  6.15k|    else if (diff != 0) {
  ------------------
  |  Branch (898:14): [True: 2.07k, False: 4.07k]
  ------------------
  899|  2.07k|      ip = anchor + (blosclz_ctz64(diff) >> 3) + 1;
  900|  2.07k|    }
  901|  4.07k|    else {
  902|  4.07k|      ip = get_match_fast(anchor + 8, ip_bound, ref + 8);
  903|  4.07k|    }
  904|       |#else
  905|       |    else {
  906|       |      ip = get_match_fast(anchor + 6, ip_bound, ref + 6);
  907|       |    }
  908|       |#endif
  909|       |
  910|  7.69k|    ip -= ipshift;
  911|  7.69k|    int len = (int)(ip - anchor);
  912|  7.69k|    if (len < minlen) {
  ------------------
  |  Branch (912:9): [True: 0, False: 7.69k]
  ------------------
  913|      0|      LITERAL2(ip, anchor, copy)
  ------------------
  |  |  778|      0|#define LITERAL2(ip, anchor, copy) {                    \
  |  |  779|      0|  oc++; (anchor)++;                                     \
  |  |  780|      0|  (ip) = (anchor);                                      \
  |  |  781|      0|  (copy)++;                                             \
  |  |  782|      0|  if (BLOSCLZ_UNLIKELY((copy) == MAX_COPY)) {           \
  |  |  ------------------
  |  |  |  |   52|      0|#define BLOSCLZ_UNLIKELY(c)  (c)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (52:30): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  783|      0|    (copy) = 0;                                         \
  |  |  784|      0|    oc++;                                               \
  |  |  785|      0|  }                                                     \
  |  |  786|      0|}
  ------------------
  914|      0|      continue;
  915|      0|    }
  916|       |
  917|       |    /* if we haven't copied anything, adjust the output counter */
  918|  7.69k|    if (!copy)
  ------------------
  |  Branch (918:9): [True: 2.17k, False: 5.51k]
  ------------------
  919|  2.17k|      oc--;
  920|       |    /* reset literal counter */
  921|  7.69k|    copy = 0;
  922|       |
  923|       |    /* encode the match */
  924|  7.69k|    if (distance < MAX_DISTANCE) {
  ------------------
  |  |   63|  7.69k|#define MAX_DISTANCE 8191
  ------------------
  |  Branch (924:9): [True: 7.69k, False: 0]
  ------------------
  925|  7.69k|      if (len >= 7) {
  ------------------
  |  Branch (925:11): [True: 4.53k, False: 3.15k]
  ------------------
  926|  4.53k|        oc += ((len - 7) / 255) + 1;
  927|  4.53k|      }
  928|  7.69k|      oc += 2;
  929|  7.69k|    }
  930|      0|    else {
  931|       |      /* far away, but not yet in the another galaxy... */
  932|      0|      if (len >= 7) {
  ------------------
  |  Branch (932:11): [True: 0, False: 0]
  ------------------
  933|      0|        oc += ((len - 7) / 255) + 1;
  934|      0|      }
  935|      0|      oc += 4;
  936|      0|    }
  937|       |
  938|       |    /* update the hash at match boundary (guard 8-byte read against window end) */
  939|  7.69k|    if (ip + 8 <= ip_end) {
  ------------------
  |  Branch (939:9): [True: 6.91k, False: 773]
  ------------------
  940|  6.91k|      hval = blosclz_hash6(ip, hashlog);
  941|  6.91k|      htab[hval] = (uint32_t)(ip - ibase) + base;
  942|  6.91k|    }
  943|  7.69k|    ip += 2;
  944|       |    /* assuming literal copy */
  945|  7.69k|    oc++;
  946|       |    /* Stop probing early once a 256-byte prefix already confirms compressibility
  947|       |     * well above the highest level threshold (1.5x at clevel 1). */
  948|  7.69k|    if (ip - ibase >= 256 && (ip - ibase) * 5 >= (ptrdiff_t)oc * 8) {
  ------------------
  |  Branch (948:9): [True: 0, False: 7.69k]
  |  Branch (948:30): [True: 0, False: 0]
  ------------------
  949|      0|      break;
  950|      0|    }
  951|  7.69k|  }
  952|       |
  953|  2.04k|  double ic = (double)(ip - ibase);
  954|  2.04k|  return ic / (double)oc;
  955|  2.04k|}
blosclz-avx2.c:blosclz_hash6:
  100|   164k|BLOSCLZ_ALWAYS_INLINE uint32_t blosclz_hash6(const uint8_t *p, uint8_t hashlog) {
  101|   164k|  uint64_t s = blosclz_readu64(p) & BLOSCLZ_PREFIX6_MASK;
  ------------------
  |  |   82|   164k|#define BLOSCLZ_PREFIX6_MASK 0x0000FFFFFFFFFFFFULL
  ------------------
  102|   164k|  return (uint32_t)((s * 11400714819323198485ULL) >> (64U - hashlog));
  103|   164k|}
blosclz-avx2.c:blosclz_htab_get_tagged:
  841|   103k|BLOSCLZ_ALWAYS_INLINE uint32_t blosclz_htab_get_tagged(uint32_t entry, uint32_t base) {
  842|   103k|  uint32_t valid = 0U - (uint32_t)(entry >= base);
  843|   103k|  return (entry - base) & valid;
  844|   103k|}
blosclz-avx2.c:blosclz_readu64:
   91|   469k|BLOSCLZ_ALWAYS_INLINE uint64_t blosclz_readu64(const uint8_t *p) {
   92|   469k|  uint64_t v;
   93|   469k|  memcpy(&v, p, sizeof(v));
   94|   469k|  return v;
   95|   469k|}
blosclz-avx2.c:get_run_fast:
  731|  3.15k|BLOSCLZ_ALWAYS_INLINE uint8_t* get_run_fast(uint8_t* ip, const uint8_t* ip_bound, const uint8_t* ref) {
  732|  3.15k|#if defined(__AVX2__)
  733|  3.15k|  return get_run_32(ip, ip_bound, ref);
  734|       |#elif defined(__SSE2__)
  735|       |  return get_run_16(ip, ip_bound, ref);
  736|       |#elif defined(__aarch64__) || defined(_M_ARM64)
  737|       |  return get_run_neon(ip, ip_bound, ref);
  738|       |#else
  739|       |  return get_run(ip, ip_bound, ref);
  740|       |#endif
  741|  3.15k|}
blosclz-avx2.c:get_run_32:
  146|  3.15k|BLOSCLZ_ALWAYS_INLINE uint8_t *get_run_32(uint8_t *ip, const uint8_t *ip_bound, const uint8_t *ref) {
  147|  3.15k|  uint8_t x = ip[-1];
  148|       |  /* Most runs in shuffled floating-point streams are short; check 8 bytes in a
  149|       |   * GPR before broadcasting into YMM registers and loading 128 bytes. */
  150|  3.15k|  if (ip_bound - ip >= 8) {
  ------------------
  |  Branch (150:7): [True: 3.15k, False: 0]
  ------------------
  151|  3.15k|    uint64_t val = (uint64_t)x * 0x0101010101010101ULL;
  152|  3.15k|    uint64_t r = blosclz_readu64(ref);
  153|  3.15k|    uint64_t diff = val ^ r;
  154|  3.15k|    if (diff) {
  ------------------
  |  Branch (154:9): [True: 1.42k, False: 1.73k]
  ------------------
  155|  1.42k|#if defined(BLOSCLZ_HAVE_CTZ64)
  156|  1.42k|      return ip + (blosclz_ctz64(diff) >> 3);
  157|       |#else
  158|       |      while (*ref++ == x) ip++;
  159|       |      return ip;
  160|       |#endif
  161|  1.42k|    }
  162|  1.73k|    ip += 8;
  163|  1.73k|    ref += 8;
  164|  1.73k|  }
  165|       |  /* Broadcast the run byte across all 32 lanes once outside the loop */
  166|  1.73k|  const __m256i value = _mm256_set1_epi8((char)x);
  167|       |  /* Scan long runs in 128-byte (4x32B) groups with a single reduction */
  168|  1.73k|  while (ip_bound - ip >= 128) {
  ------------------
  |  Branch (168:10): [True: 0, False: 1.73k]
  ------------------
  169|      0|    __m256i cmp0 = _mm256_cmpeq_epi8(value, _mm256_loadu_si256((const __m256i *)ref));
  170|      0|    __m256i cmp1 = _mm256_cmpeq_epi8(value, _mm256_loadu_si256((const __m256i *)(ref + 32)));
  171|      0|    __m256i cmp2 = _mm256_cmpeq_epi8(value, _mm256_loadu_si256((const __m256i *)(ref + 64)));
  172|      0|    __m256i cmp3 = _mm256_cmpeq_epi8(value, _mm256_loadu_si256((const __m256i *)(ref + 96)));
  173|      0|    __m256i eq01 = _mm256_and_si256(cmp0, cmp1);
  174|      0|    __m256i eq23 = _mm256_and_si256(cmp2, cmp3);
  175|      0|    if ((uint32_t)_mm256_movemask_epi8(_mm256_and_si256(eq01, eq23)) != 0xFFFFFFFFU) {
  ------------------
  |  Branch (175:9): [True: 0, False: 0]
  ------------------
  176|       |      /* Pinpoint the first differing byte directly from the compare vectors */
  177|      0|      if ((uint32_t)_mm256_movemask_epi8(eq01) != 0xFFFFFFFFU) {
  ------------------
  |  Branch (177:11): [True: 0, False: 0]
  ------------------
  178|      0|        uint32_t m0 = (uint32_t)_mm256_movemask_epi8(cmp0);
  179|      0|        if (m0 != 0xFFFFFFFFU) {
  ------------------
  |  Branch (179:13): [True: 0, False: 0]
  ------------------
  180|      0|#if defined(BLOSCLZ_HAVE_CTZ32)
  181|      0|          return ip + blosclz_ctz32(~m0);
  182|       |#else
  183|       |          while (*ref++ == x) ip++;
  184|       |          return ip;
  185|       |#endif
  186|      0|        }
  187|      0|        uint32_t m1 = (uint32_t)_mm256_movemask_epi8(cmp1);
  188|      0|#if defined(BLOSCLZ_HAVE_CTZ32)
  189|      0|        return ip + 32 + blosclz_ctz32(~m1);
  190|       |#else
  191|       |        ip += 32;
  192|       |        ref += 32;
  193|       |        while (*ref++ == x) ip++;
  194|       |        return ip;
  195|       |#endif
  196|      0|      }
  197|      0|      uint32_t m2 = (uint32_t)_mm256_movemask_epi8(cmp2);
  198|      0|      if (m2 != 0xFFFFFFFFU) {
  ------------------
  |  Branch (198:11): [True: 0, False: 0]
  ------------------
  199|      0|#if defined(BLOSCLZ_HAVE_CTZ32)
  200|      0|        return ip + 64 + blosclz_ctz32(~m2);
  201|       |#else
  202|       |        ip += 64;
  203|       |        ref += 64;
  204|       |        while (*ref++ == x) ip++;
  205|       |        return ip;
  206|       |#endif
  207|      0|      }
  208|      0|      uint32_t m3 = (uint32_t)_mm256_movemask_epi8(cmp3);
  209|      0|#if defined(BLOSCLZ_HAVE_CTZ32)
  210|      0|      return ip + 96 + blosclz_ctz32(~m3);
  211|       |#else
  212|       |      ip += 96;
  213|       |      ref += 96;
  214|       |      while (*ref++ == x) ip++;
  215|       |      return ip;
  216|       |#endif
  217|      0|    }
  218|      0|    ip += 128;
  219|      0|    ref += 128;
  220|      0|  }
  221|       |  /* Narrow 32-byte and 16-byte vector tails */
  222|  2.48k|  while (ip_bound - ip >= 32) {
  ------------------
  |  Branch (222:10): [True: 1.63k, False: 849]
  ------------------
  223|  1.63k|    __m256i cmp = _mm256_cmpeq_epi8(value, _mm256_loadu_si256((const __m256i *)ref));
  224|  1.63k|    uint32_t mask = (uint32_t)_mm256_movemask_epi8(cmp);
  225|  1.63k|    if (mask != 0xFFFFFFFFU) {
  ------------------
  |  Branch (225:9): [True: 881, False: 757]
  ------------------
  226|    881|#if defined(BLOSCLZ_HAVE_CTZ32)
  227|    881|      return ip + blosclz_ctz32(~mask);
  228|       |#else
  229|       |      while (*ref++ == x) ip++;
  230|       |      return ip;
  231|       |#endif
  232|    881|    }
  233|    757|    ip += 32;
  234|    757|    ref += 32;
  235|    757|  }
  236|    849|  if (ip_bound - ip >= 16) {
  ------------------
  |  Branch (236:7): [True: 417, False: 432]
  ------------------
  237|    417|    __m128i cmp = _mm_cmpeq_epi8(_mm256_castsi256_si128(value),
  238|    417|                                 _mm_loadu_si128((const __m128i *)ref));
  239|    417|    uint32_t mask = (uint32_t)_mm_movemask_epi8(cmp);
  240|    417|    if (mask != 0xFFFFU) {
  ------------------
  |  Branch (240:9): [True: 34, False: 383]
  ------------------
  241|     34|#if defined(BLOSCLZ_HAVE_CTZ32)
  242|     34|      return ip + blosclz_ctz32(~mask);
  243|       |#else
  244|       |      while (*ref++ == x) ip++;
  245|       |      return ip;
  246|       |#endif
  247|     34|    }
  248|    383|    ip += 16;
  249|    383|    ref += 16;
  250|    383|  }
  251|       |  /* Keep the original run byte: ref trails ip by one byte, so ip[-1] has
  252|       |   * not necessarily been checked when a vector iteration ends. */
  253|  2.39k|  while ((ip < ip_bound) && (*ref++ == x)) ip++;
  ------------------
  |  Branch (253:10): [True: 1.68k, False: 707]
  |  Branch (253:29): [True: 1.57k, False: 108]
  ------------------
  254|    815|  return ip;
  255|    849|}
blosclz-avx2.c:blosclz_ctz32:
  108|  3.98k|static inline unsigned blosclz_ctz32(uint32_t v) {
  109|  3.98k|  return (unsigned)__builtin_ctz(v);
  110|  3.98k|}
blosclz-avx2.c:blosclz_ctz64:
  113|  8.95k|static inline unsigned blosclz_ctz64(uint64_t v) {
  114|  8.95k|  return (unsigned)__builtin_ctzll(v);
  115|  8.95k|}
blosclz-avx2.c:get_match_fast:
  743|  7.90k|BLOSCLZ_ALWAYS_INLINE uint8_t* get_match_fast(uint8_t* ip, const uint8_t* ip_bound, const uint8_t* ref) {
  744|  7.90k|#if defined(__AVX2__)
  745|  7.90k|  return get_match_32(ip, ip_bound, ref);
  746|       |#elif defined(__SSE2__)
  747|       |  return get_match_16(ip, ip_bound, ref);
  748|       |#elif defined(__aarch64__) || defined(_M_ARM64)
  749|       |  return get_match_neon(ip, ip_bound, ref);
  750|       |#else
  751|       |  return get_match(ip, ip_bound, ref);
  752|       |#endif
  753|  7.90k|}
blosclz-avx2.c:get_match_32:
  257|  7.90k|BLOSCLZ_ALWAYS_INLINE uint8_t *get_match_32(uint8_t *ip, const uint8_t *ip_bound, const uint8_t *ref) {
  258|       |  /* Most matches in floating-point byte deltas are short. Avoid wide vector
  259|       |   * comparisons for these; a little-endian 64-bit scan locates a mismatch
  260|       |   * without a byte-at-a-time loop. */
  261|  7.90k|  if (ip_bound - ip >= 8) {
  ------------------
  |  Branch (261:7): [True: 7.64k, False: 263]
  ------------------
  262|  7.64k|    uint64_t a, b;
  263|  7.64k|    memcpy(&a, ip, sizeof(a));
  264|  7.64k|    memcpy(&b, ref, sizeof(b));
  265|  7.64k|    uint64_t diff = a ^ b;
  266|  7.64k|    if (diff) {
  ------------------
  |  Branch (266:9): [True: 3.61k, False: 4.03k]
  ------------------
  267|  3.61k|#if defined(BLOSCLZ_HAVE_CTZ64)
  268|  3.61k|      return ip + (blosclz_ctz64(diff) >> 3) + 1;
  269|       |#else
  270|       |      while (*ref++ == *ip++) {}
  271|       |      return ip;
  272|       |#endif
  273|  3.61k|    }
  274|  4.03k|    ip += 8;
  275|  4.03k|    ref += 8;
  276|  4.03k|  }
  277|       |  /* Scan long matches in 128-byte (4x32B) groups with a single reduction */
  278|  4.29k|  while (ip_bound - ip >= 128) {
  ------------------
  |  Branch (278:10): [True: 0, False: 4.29k]
  ------------------
  279|      0|    __m256i cmp0 = _mm256_cmpeq_epi8(_mm256_loadu_si256((const __m256i *)ip),
  280|      0|                                     _mm256_loadu_si256((const __m256i *)ref));
  281|      0|    __m256i cmp1 = _mm256_cmpeq_epi8(_mm256_loadu_si256((const __m256i *)(ip + 32)),
  282|      0|                                     _mm256_loadu_si256((const __m256i *)(ref + 32)));
  283|      0|    __m256i cmp2 = _mm256_cmpeq_epi8(_mm256_loadu_si256((const __m256i *)(ip + 64)),
  284|      0|                                     _mm256_loadu_si256((const __m256i *)(ref + 64)));
  285|      0|    __m256i cmp3 = _mm256_cmpeq_epi8(_mm256_loadu_si256((const __m256i *)(ip + 96)),
  286|      0|                                     _mm256_loadu_si256((const __m256i *)(ref + 96)));
  287|      0|    __m256i eq01 = _mm256_and_si256(cmp0, cmp1);
  288|      0|    __m256i eq23 = _mm256_and_si256(cmp2, cmp3);
  289|      0|    if ((uint32_t)_mm256_movemask_epi8(_mm256_and_si256(eq01, eq23)) != 0xFFFFFFFFU) {
  ------------------
  |  Branch (289:9): [True: 0, False: 0]
  ------------------
  290|       |      /* Pinpoint the first mismatch (+1 matches the scalar post-increment contract) */
  291|      0|      if ((uint32_t)_mm256_movemask_epi8(eq01) != 0xFFFFFFFFU) {
  ------------------
  |  Branch (291:11): [True: 0, False: 0]
  ------------------
  292|      0|        uint32_t m0 = (uint32_t)_mm256_movemask_epi8(cmp0);
  293|      0|        if (m0 != 0xFFFFFFFFU) {
  ------------------
  |  Branch (293:13): [True: 0, False: 0]
  ------------------
  294|      0|#if defined(BLOSCLZ_HAVE_CTZ32)
  295|      0|          return ip + blosclz_ctz32(~m0) + 1;
  296|       |#else
  297|       |          while (*ref++ == *ip++) {}
  298|       |          return ip;
  299|       |#endif
  300|      0|        }
  301|      0|        uint32_t m1 = (uint32_t)_mm256_movemask_epi8(cmp1);
  302|      0|#if defined(BLOSCLZ_HAVE_CTZ32)
  303|      0|        return ip + 32 + blosclz_ctz32(~m1) + 1;
  304|       |#else
  305|       |        ip += 32;
  306|       |        ref += 32;
  307|       |        while (*ref++ == *ip++) {}
  308|       |        return ip;
  309|       |#endif
  310|      0|      }
  311|      0|      uint32_t m2 = (uint32_t)_mm256_movemask_epi8(cmp2);
  312|      0|      if (m2 != 0xFFFFFFFFU) {
  ------------------
  |  Branch (312:11): [True: 0, False: 0]
  ------------------
  313|      0|#if defined(BLOSCLZ_HAVE_CTZ32)
  314|      0|        return ip + 64 + blosclz_ctz32(~m2) + 1;
  315|       |#else
  316|       |        ip += 64;
  317|       |        ref += 64;
  318|       |        while (*ref++ == *ip++) {}
  319|       |        return ip;
  320|       |#endif
  321|      0|      }
  322|      0|      uint32_t m3 = (uint32_t)_mm256_movemask_epi8(cmp3);
  323|      0|#if defined(BLOSCLZ_HAVE_CTZ32)
  324|      0|      return ip + 96 + blosclz_ctz32(~m3) + 1;
  325|       |#else
  326|       |      ip += 96;
  327|       |      ref += 96;
  328|       |      while (*ref++ == *ip++) {}
  329|       |      return ip;
  330|       |#endif
  331|      0|    }
  332|      0|    ip += 128;
  333|      0|    ref += 128;
  334|      0|  }
  335|       |  /* Narrow 32-byte, 16-byte, and scalar tails */
  336|  5.85k|  while (ip_bound - ip >= 32) {
  ------------------
  |  Branch (336:10): [True: 4.33k, False: 1.52k]
  ------------------
  337|  4.33k|    __m256i cmp = _mm256_cmpeq_epi8(_mm256_loadu_si256((const __m256i *)ip),
  338|  4.33k|                                    _mm256_loadu_si256((const __m256i *)ref));
  339|  4.33k|    uint32_t mask = (uint32_t)_mm256_movemask_epi8(cmp);
  340|  4.33k|    if (mask != 0xFFFFFFFFU) {
  ------------------
  |  Branch (340:9): [True: 2.77k, False: 1.55k]
  ------------------
  341|  2.77k|#if defined(BLOSCLZ_HAVE_CTZ32)
  342|  2.77k|      return ip + blosclz_ctz32(~mask) + 1;
  343|       |#else
  344|       |      while (*ref++ == *ip++) {}
  345|       |      return ip;
  346|       |#endif
  347|  2.77k|    }
  348|  1.55k|    ip += 32;
  349|  1.55k|    ref += 32;
  350|  1.55k|  }
  351|  1.52k|  if (ip_bound - ip >= 16) {
  ------------------
  |  Branch (351:7): [True: 494, False: 1.03k]
  ------------------
  352|    494|    __m128i cmp = _mm_cmpeq_epi8(_mm_loadu_si128((const __m128i *)ip),
  353|    494|                                 _mm_loadu_si128((const __m128i *)ref));
  354|    494|    uint32_t mask = (uint32_t)_mm_movemask_epi8(cmp);
  355|    494|    if (mask != 0xFFFFU) {
  ------------------
  |  Branch (355:9): [True: 296, False: 198]
  ------------------
  356|    296|#if defined(BLOSCLZ_HAVE_CTZ32)
  357|    296|      return ip + blosclz_ctz32(~mask) + 1;
  358|       |#else
  359|       |      while (*ref++ == *ip++) {}
  360|       |      return ip;
  361|       |#endif
  362|    296|    }
  363|    198|    ip += 16;
  364|    198|    ref += 16;
  365|    198|  }
  366|  9.80k|  while ((ip < ip_bound) && (*ref++ == *ip++)) {}
  ------------------
  |  Branch (366:10): [True: 9.22k, False: 583]
  |  Branch (366:29): [True: 8.57k, False: 648]
  ------------------
  367|  1.23k|  return ip;
  368|  1.52k|}
blosclz-avx2.c:emit_literals:
  756|  6.40k|                                             const uint8_t* lit_start, size_t lit_len) {
  757|  6.76k|  while (lit_len >= MAX_COPY) {
  ------------------
  |  |   62|  6.76k|#define MAX_COPY 32U
  ------------------
  |  Branch (757:10): [True: 386, False: 6.37k]
  ------------------
  758|    386|    if (BLOSCLZ_UNLIKELY((size_t)(op_limit - op) < MAX_COPY + 1)) {
  ------------------
  |  |   52|    386|#define BLOSCLZ_UNLIKELY(c)  (c)
  |  |  ------------------
  |  |  |  Branch (52:30): [True: 30, False: 356]
  |  |  ------------------
  ------------------
  759|     30|      return NULL;
  760|     30|    }
  761|    356|    *op++ = MAX_COPY - 1;
  ------------------
  |  |   62|    356|#define MAX_COPY 32U
  ------------------
  762|    356|    memcpy(op, lit_start, MAX_COPY);
  ------------------
  |  |   62|    356|#define MAX_COPY 32U
  ------------------
  763|    356|    op += MAX_COPY;
  ------------------
  |  |   62|    356|#define MAX_COPY 32U
  ------------------
  764|    356|    lit_start += MAX_COPY;
  ------------------
  |  |   62|    356|#define MAX_COPY 32U
  ------------------
  765|    356|    lit_len -= MAX_COPY;
  ------------------
  |  |   62|    356|#define MAX_COPY 32U
  ------------------
  766|    356|  }
  767|  6.37k|  if (lit_len > 0) {
  ------------------
  |  Branch (767:7): [True: 6.33k, False: 42]
  ------------------
  768|  6.33k|    if (BLOSCLZ_UNLIKELY((size_t)(op_limit - op) < lit_len + 1)) {
  ------------------
  |  |   52|  6.33k|#define BLOSCLZ_UNLIKELY(c)  (c)
  |  |  ------------------
  |  |  |  Branch (52:30): [True: 2, False: 6.33k]
  |  |  ------------------
  ------------------
  769|      2|      return NULL;
  770|      2|    }
  771|  6.33k|    *op++ = (uint8_t)(lit_len - 1);
  772|  6.33k|    memcpy(op, lit_start, lit_len);
  773|  6.33k|    op += lit_len;
  774|  6.33k|  }
  775|  6.37k|  return op;
  776|  6.37k|}
blosclz-avx2.c:blosclz_decompress_impl:
 1949|  4.35k|static inline int blosclz_decompress_impl(const void* input, int length, void* output, int maxout) {
 1950|  4.35k|  const uint8_t* ip = (const uint8_t*)input;
 1951|  4.35k|  const uint8_t* ip_limit = ip + length;
 1952|  4.35k|  uint8_t* op = (uint8_t*)output;
 1953|  4.35k|  uint32_t ctrl;
 1954|  4.35k|  uint8_t* op_limit = op + maxout;
 1955|  4.35k|  if (BLOSCLZ_UNLIKELY(length == 0)) {
  ------------------
  |  |   52|  4.35k|#define BLOSCLZ_UNLIKELY(c)  (c)
  |  |  ------------------
  |  |  |  Branch (52:30): [True: 0, False: 4.35k]
  |  |  ------------------
  ------------------
 1956|      0|    return 0;
 1957|      0|  }
 1958|  4.35k|  ctrl = (*ip++) & 31U;
 1959|       |
 1960|  33.5k|  while (1) {
  ------------------
  |  Branch (1960:10): [True: 33.5k, Folded]
  ------------------
 1961|  33.5k|    if (ctrl >= 32) {
  ------------------
  |  Branch (1961:9): [True: 16.6k, False: 16.8k]
  ------------------
 1962|       |      // match
 1963|  16.6k|      int32_t len = (int32_t)(ctrl >> 5U) - 1 ;
 1964|  16.6k|      int32_t ofs = (int32_t)(ctrl & 31U) << 8U;
 1965|  16.6k|      uint8_t code;
 1966|  16.6k|      const uint8_t* ref;
 1967|       |
 1968|  16.6k|      if (len == 7 - 1) {
  ------------------
  |  Branch (1968:11): [True: 10.8k, False: 5.79k]
  ------------------
 1969|  10.8k|#ifdef BLOSCLZ_WIDE_DECODE
 1970|       |        /* Long runs encode their lengths as consecutive 255-byte extensions.
 1971|       |         * Consume eight together, keeping an offset byte in reserve. */
 1972|  10.8k|        while (ip_limit - ip >= 9) {
  ------------------
  |  Branch (1972:16): [True: 8.04k, False: 2.80k]
  ------------------
 1973|  8.04k|          uint64_t extensions;
 1974|  8.04k|          memcpy(&extensions, ip, sizeof(extensions));
 1975|  8.04k|          if (extensions != UINT64_MAX) {
  ------------------
  |  Branch (1975:15): [True: 8.03k, False: 2]
  ------------------
 1976|  8.03k|            break;
 1977|  8.03k|          }
 1978|      2|          if (BLOSCLZ_UNLIKELY(len > maxout - 8 * 255)) {
  ------------------
  |  |   52|      2|#define BLOSCLZ_UNLIKELY(c)  (c)
  |  |  ------------------
  |  |  |  Branch (52:30): [True: 1, False: 1]
  |  |  ------------------
  ------------------
 1979|      1|            return 0;
 1980|      1|          }
 1981|      1|          len += 8 * 255;
 1982|      1|          ip += 8;
 1983|      1|        }
 1984|  10.8k|#endif
 1985|  10.8k|        do {
 1986|  10.8k|          if (BLOSCLZ_UNLIKELY(ip + 1 >= ip_limit)) {
  ------------------
  |  |   52|  10.8k|#define BLOSCLZ_UNLIKELY(c)  (c)
  |  |  ------------------
  |  |  |  Branch (52:30): [True: 1, False: 10.8k]
  |  |  ------------------
  ------------------
 1987|      1|            return 0;
 1988|      1|          }
 1989|  10.8k|          code = *ip++;
 1990|       |          /* Guard before the addition so that `len` can never wrap past
 1991|       |             INT32_MAX.  The subsequent `len += 3` adds at most 3 more,
 1992|       |             so capping at maxout here is safe and sufficient. */
 1993|  10.8k|          if (BLOSCLZ_UNLIKELY(len > maxout - code)) {
  ------------------
  |  |   52|  10.8k|#define BLOSCLZ_UNLIKELY(c)  (c)
  |  |  ------------------
  |  |  |  Branch (52:30): [True: 5, False: 10.8k]
  |  |  ------------------
  ------------------
 1994|      5|            return 0;
 1995|      5|          }
 1996|  10.8k|          len += code;
 1997|  10.8k|        } while (code == 255);
  ------------------
  |  Branch (1997:18): [True: 33, False: 10.8k]
  ------------------
 1998|  10.8k|      }
 1999|  5.79k|      else {
 2000|  5.79k|        if (BLOSCLZ_UNLIKELY(ip + 1 >= ip_limit)) {
  ------------------
  |  |   52|  5.79k|#define BLOSCLZ_UNLIKELY(c)  (c)
  |  |  ------------------
  |  |  |  Branch (52:30): [True: 0, False: 5.79k]
  |  |  ------------------
  ------------------
 2001|      0|          return 0;
 2002|      0|        }
 2003|  5.79k|      }
 2004|  16.6k|      code = *ip++;
 2005|  16.6k|      len += 3;
 2006|  16.6k|      ofs += code;
 2007|       |
 2008|       |      /* match from 16-bit distance: ofs == (31 << 8) && code == 255 iff ofs + code == MAX_DISTANCE */
 2009|  16.6k|      if (BLOSCLZ_UNLIKELY(ofs == MAX_DISTANCE)) {
  ------------------
  |  |   52|  16.6k|#define BLOSCLZ_UNLIKELY(c)  (c)
  |  |  ------------------
  |  |  |  Branch (52:30): [True: 9, False: 16.6k]
  |  |  ------------------
  ------------------
 2010|      9|        if (ip + 1 >= ip_limit) {
  ------------------
  |  Branch (2010:13): [True: 1, False: 8]
  ------------------
 2011|      1|          return 0;
 2012|      1|        }
 2013|      8|        ofs = (*ip++) << 8U;
 2014|      8|        ofs += *ip++;
 2015|      8|        ofs += MAX_DISTANCE;
  ------------------
  |  |   63|      8|#define MAX_DISTANCE 8191
  ------------------
 2016|      8|      }
 2017|  16.6k|      ref = op - ofs;
 2018|       |
 2019|  16.6k|      if (BLOSCLZ_UNLIKELY(len > op_limit - op)) {
  ------------------
  |  |   52|  16.6k|#define BLOSCLZ_UNLIKELY(c)  (c)
  |  |  ------------------
  |  |  |  Branch (52:30): [True: 1, False: 16.6k]
  |  |  ------------------
  ------------------
 2020|      1|        return 0;
 2021|      1|      }
 2022|       |
 2023|  16.6k|      if (BLOSCLZ_UNLIKELY(ref <= (uint8_t*)output)) {
  ------------------
  |  |   52|  16.6k|#define BLOSCLZ_UNLIKELY(c)  (c)
  |  |  ------------------
  |  |  |  Branch (52:30): [True: 43, False: 16.5k]
  |  |  ------------------
  ------------------
 2024|     43|        return 0;
 2025|     43|      }
 2026|       |
 2027|  16.5k|      if (BLOSCLZ_UNLIKELY(ip >= ip_limit)) break;
  ------------------
  |  |   52|  16.5k|#define BLOSCLZ_UNLIKELY(c)  (c)
  |  |  ------------------
  |  |  |  Branch (52:30): [True: 1, False: 16.5k]
  |  |  ------------------
  ------------------
 2028|  16.5k|      ctrl = *ip++;
 2029|       |
 2030|  16.5k|      ref--;
 2031|  16.5k|#if defined(__aarch64__) || defined(_M_ARM64) || defined(__AVX2__) || defined(__SSSE3__)
 2032|  16.5k|      if (len <= 32 && op_limit - op >= 32) {
  ------------------
  |  Branch (2032:11): [True: 13.1k, False: 3.46k]
  |  Branch (2032:24): [True: 10.9k, False: 2.12k]
  ------------------
 2033|  10.9k|        blosclz_copy_short_match(op, ref, len);
 2034|  10.9k|        op += len;
 2035|  10.9k|        continue;
 2036|  10.9k|      }
 2037|  5.58k|#endif
 2038|  5.58k|#if defined(__AVX2__)
 2039|  5.58k|      op = blosclz_copy_match_avx2(op, ref, len, op_limit);
 2040|       |#elif defined(__SSE2__) || defined(__x86_64__) || defined(_M_X64)
 2041|       |      op = blosclz_copy_match_sse2(op, ref, len, op_limit);
 2042|       |#elif defined(__aarch64__) || defined(_M_ARM64)
 2043|       |      op = blosclz_copy_match_neon(op, ref, len, op_limit);
 2044|       |#else
 2045|       |      if (ref == op - 1) {
 2046|       |        /* optimized copy for a run */
 2047|       |        memset(op, *ref, len);
 2048|       |        op += len;
 2049|       |      }
 2050|       |      else if ((op - ref >= 8) && (op_limit - op - len >= 8)) {
 2051|       |        // copy with an overlap not larger than 8
 2052|       |        wild_copy(op, ref, op + len);
 2053|       |        op += len;
 2054|       |      }
 2055|       |      else {
 2056|       |        op = copy_match(op, ref, (unsigned) len);
 2057|       |      }
 2058|       |#endif
 2059|  5.58k|    }
 2060|  16.8k|    else {
 2061|       |      // literal
 2062|  16.8k|      ctrl++;
 2063|  16.8k|#ifdef BLOSCLZ_WIDE_DECODE
 2064|       |      /* All literal lengths fit in one fixed-size copy when both buffers have room. */
 2065|  16.8k|      if (op_limit - op >= 32 && ip_limit - ip >= 32) {
  ------------------
  |  Branch (2065:11): [True: 11.4k, False: 5.38k]
  |  Branch (2065:34): [True: 6.67k, False: 4.82k]
  ------------------
 2066|  6.67k|        memcpy(op, ip, 32);
 2067|  6.67k|      }
 2068|  10.2k|      else
 2069|  10.2k|#endif
 2070|  10.2k|      {
 2071|  10.2k|        if (BLOSCLZ_UNLIKELY(ctrl > op_limit - op || ctrl > ip_limit - ip)) {
  ------------------
  |  |   52|  20.4k|#define BLOSCLZ_UNLIKELY(c)  (c)
  |  |  ------------------
  |  |  |  Branch (52:31): [True: 1, False: 10.2k]
  |  |  |  Branch (52:31): [True: 9, False: 10.1k]
  |  |  ------------------
  ------------------
 2072|     10|          return 0;
 2073|     10|        }
 2074|  10.1k|        memcpy(op, ip, ctrl);
 2075|  10.1k|      }
 2076|  16.8k|      op += ctrl; ip += ctrl;
 2077|       |
 2078|  16.8k|      if (BLOSCLZ_UNLIKELY(ip >= ip_limit)) break;
  ------------------
  |  |   52|  16.8k|#define BLOSCLZ_UNLIKELY(c)  (c)
  |  |  ------------------
  |  |  |  Branch (52:30): [True: 4.29k, False: 12.5k]
  |  |  ------------------
  ------------------
 2079|  12.5k|      ctrl = *ip++;
 2080|  12.5k|    }
 2081|  33.5k|  }
 2082|       |
 2083|  4.29k|  return (int)(op - (uint8_t*)output);
 2084|  4.35k|}
blosclz-avx2.c:blosclz_copy_short_match:
 1308|  10.9k|BLOSCLZ_ALWAYS_INLINE void blosclz_copy_short_match(uint8_t *op, const uint8_t *ref, int32_t len) {
 1309|  10.9k|  ptrdiff_t dist = op - ref;
 1310|       |  /* Row d repeats the first d bytes. Row zero is the identity for distances
 1311|       |   * of at least 16, where each vector load already contains the next 16 bytes. */
 1312|  10.9k|  static const uint8_t repeat[16][16] = {
 1313|  10.9k|    {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15},
 1314|  10.9k|    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 1315|  10.9k|    {0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1},
 1316|  10.9k|    {0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0},
 1317|  10.9k|    {0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3},
 1318|  10.9k|    {0, 1, 2, 3, 4, 0, 1, 2, 3, 4, 0, 1, 2, 3, 4, 0},
 1319|  10.9k|    {0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3},
 1320|  10.9k|    {0, 1, 2, 3, 4, 5, 6, 0, 1, 2, 3, 4, 5, 6, 0, 1},
 1321|  10.9k|    {0, 1, 2, 3, 4, 5, 6, 7, 0, 1, 2, 3, 4, 5, 6, 7},
 1322|  10.9k|    {0, 1, 2, 3, 4, 5, 6, 7, 8, 0, 1, 2, 3, 4, 5, 6},
 1323|  10.9k|    {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5},
 1324|  10.9k|    {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 0, 1, 2, 3, 4},
 1325|  10.9k|    {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 0, 1, 2, 3},
 1326|  10.9k|    {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 0, 1, 2},
 1327|  10.9k|    {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 0, 1},
 1328|  10.9k|    {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 0},
 1329|  10.9k|  };
 1330|       |
 1331|       |  /* Compute the repeat-table row branchlessly (row 0 is identity for dist >= 16)
 1332|       |   * so GCC does not emit a mispredicting branch on dist < 16. */
 1333|  10.9k|  size_t row = (size_t)dist & ((size_t)0 - (size_t)(dist < 16));
 1334|       |#if defined(__aarch64__) || defined(_M_ARM64)
 1335|       |  uint8x16_t index = vld1q_u8(repeat[row]);
 1336|       |  vst1q_u8(op, vqtbl1q_u8(vld1q_u8(ref), index));
 1337|       |  if (len > 16) {
 1338|       |    vst1q_u8(op + 16, vqtbl1q_u8(vld1q_u8(ref + 16), index));
 1339|       |  }
 1340|       |#else
 1341|  10.9k|  __m128i index = _mm_loadu_si128((const __m128i *)repeat[row]);
 1342|  10.9k|  _mm_storeu_si128((__m128i *)op, _mm_shuffle_epi8(_mm_loadu_si128((const __m128i *)ref), index));
 1343|  10.9k|  if (len > 16) {
  ------------------
  |  Branch (1343:7): [True: 1.65k, False: 9.33k]
  ------------------
 1344|  1.65k|    _mm_storeu_si128((__m128i *)(op + 16), _mm_shuffle_epi8(_mm_loadu_si128((const __m128i *)(ref + 16)), index));
 1345|  1.65k|  }
 1346|  10.9k|#endif
 1347|  10.9k|}
blosclz-avx2.c:blosclz_copy_match_avx2:
 1356|  5.58k|    uint8_t *op, const uint8_t *ref, int32_t len, uint8_t *op_limit) {
 1357|  5.58k|  ptrdiff_t dist = op - ref;
 1358|  5.58k|  uint8_t *end = op + len;
 1359|       |
 1360|  5.58k|  if (dist >= 32) {
  ------------------
  |  Branch (1360:7): [True: 1.03k, False: 4.55k]
  ------------------
 1361|       |    /* Short match overcopies when output slack permits (subsequent tokens overwrite excess). */
 1362|  1.03k|    if (len <= 16 && op_limit - op >= 16) {
  ------------------
  |  Branch (1362:9): [True: 701, False: 333]
  |  Branch (1362:22): [True: 453, False: 248]
  ------------------
 1363|    453|      _mm_storeu_si128((__m128i *)op, _mm_loadu_si128((const __m128i *)ref));
 1364|    453|      return end;
 1365|    453|    }
 1366|    581|    if (len <= 32 && op_limit - op >= 32) {
  ------------------
  |  Branch (1366:9): [True: 280, False: 301]
  |  Branch (1366:22): [True: 0, False: 280]
  ------------------
 1367|      0|      _mm256_storeu_si256((__m256i *)op, _mm256_loadu_si256((const __m256i *)ref));
 1368|      0|      return end;
 1369|      0|    }
 1370|    581|    if (len <= 64 && op_limit - op >= 64) {
  ------------------
  |  Branch (1370:9): [True: 569, False: 12]
  |  Branch (1370:22): [True: 7, False: 562]
  ------------------
 1371|      7|      _mm256_storeu_si256((__m256i *)op, _mm256_loadu_si256((const __m256i *)ref));
 1372|      7|      _mm256_storeu_si256((__m256i *)(op + 32), _mm256_loadu_si256((const __m256i *)(ref + 32)));
 1373|      7|      return end;
 1374|      7|    }
 1375|    574|    if (len >= 32) {
  ------------------
  |  Branch (1375:9): [True: 294, False: 280]
  ------------------
 1376|    294|      uint8_t *cur = op;
 1377|    294|      const uint8_t *src = ref;
 1378|    294|      if (dist >= 128) {
  ------------------
  |  Branch (1378:11): [True: 8, False: 286]
  ------------------
 1379|       |        /* Non-overlapping 128B blocks: batch 4x32B loads before stores in 256B/128B steps. */
 1380|     14|        while (cur + 256 <= end) {
  ------------------
  |  Branch (1380:16): [True: 6, False: 8]
  ------------------
 1381|      6|          __m256i v0 = _mm256_loadu_si256((const __m256i *)src);
 1382|      6|          __m256i v1 = _mm256_loadu_si256((const __m256i *)(src + 32));
 1383|      6|          __m256i v2 = _mm256_loadu_si256((const __m256i *)(src + 64));
 1384|      6|          __m256i v3 = _mm256_loadu_si256((const __m256i *)(src + 96));
 1385|      6|          _mm256_storeu_si256((__m256i *)cur, v0);
 1386|      6|          _mm256_storeu_si256((__m256i *)(cur + 32), v1);
 1387|      6|          _mm256_storeu_si256((__m256i *)(cur + 64), v2);
 1388|      6|          _mm256_storeu_si256((__m256i *)(cur + 96), v3);
 1389|      6|          __m256i v4 = _mm256_loadu_si256((const __m256i *)(src + 128));
 1390|      6|          __m256i v5 = _mm256_loadu_si256((const __m256i *)(src + 160));
 1391|      6|          __m256i v6 = _mm256_loadu_si256((const __m256i *)(src + 192));
 1392|      6|          __m256i v7 = _mm256_loadu_si256((const __m256i *)(src + 224));
 1393|      6|          _mm256_storeu_si256((__m256i *)(cur + 128), v4);
 1394|      6|          _mm256_storeu_si256((__m256i *)(cur + 160), v5);
 1395|      6|          _mm256_storeu_si256((__m256i *)(cur + 192), v6);
 1396|      6|          _mm256_storeu_si256((__m256i *)(cur + 224), v7);
 1397|      6|          cur += 256;
 1398|      6|          src += 256;
 1399|      6|        }
 1400|      8|        if (cur + 128 <= end) {
  ------------------
  |  Branch (1400:13): [True: 3, False: 5]
  ------------------
 1401|      3|          __m256i v0 = _mm256_loadu_si256((const __m256i *)src);
 1402|      3|          __m256i v1 = _mm256_loadu_si256((const __m256i *)(src + 32));
 1403|      3|          __m256i v2 = _mm256_loadu_si256((const __m256i *)(src + 64));
 1404|      3|          __m256i v3 = _mm256_loadu_si256((const __m256i *)(src + 96));
 1405|      3|          _mm256_storeu_si256((__m256i *)cur, v0);
 1406|      3|          _mm256_storeu_si256((__m256i *)(cur + 32), v1);
 1407|      3|          _mm256_storeu_si256((__m256i *)(cur + 64), v2);
 1408|      3|          _mm256_storeu_si256((__m256i *)(cur + 96), v3);
 1409|      3|          cur += 128;
 1410|      3|          src += 128;
 1411|      3|        }
 1412|      8|      }
 1413|    286|      else {
 1414|       |        /* Keep each 32B load/store ordered so distances in [32, 128) propagate safely. */
 1415|    298|        while (cur + 128 <= end) {
  ------------------
  |  Branch (1415:16): [True: 12, False: 286]
  ------------------
 1416|     12|          _mm256_storeu_si256((__m256i *)cur, _mm256_loadu_si256((const __m256i *)src));
 1417|     12|          _mm256_storeu_si256((__m256i *)(cur + 32), _mm256_loadu_si256((const __m256i *)(src + 32)));
 1418|     12|          _mm256_storeu_si256((__m256i *)(cur + 64), _mm256_loadu_si256((const __m256i *)(src + 64)));
 1419|     12|          _mm256_storeu_si256((__m256i *)(cur + 96), _mm256_loadu_si256((const __m256i *)(src + 96)));
 1420|     12|          cur += 128;
 1421|     12|          src += 128;
 1422|     12|        }
 1423|    286|      }
 1424|       |      /* Finish remaining <128B using 64B/32B steps and an exact overlapping 32B tail. */
 1425|    294|      if (cur + 64 <= end) {
  ------------------
  |  Branch (1425:11): [True: 4, False: 290]
  ------------------
 1426|      4|        _mm256_storeu_si256((__m256i *)cur, _mm256_loadu_si256((const __m256i *)src));
 1427|      4|        _mm256_storeu_si256((__m256i *)(cur + 32), _mm256_loadu_si256((const __m256i *)(src + 32)));
 1428|      4|        cur += 64;
 1429|      4|        src += 64;
 1430|      4|      }
 1431|    294|      if (cur + 32 <= end) {
  ------------------
  |  Branch (1431:11): [True: 286, False: 8]
  ------------------
 1432|    286|        _mm256_storeu_si256((__m256i *)cur, _mm256_loadu_si256((const __m256i *)src));
 1433|    286|        cur += 32;
 1434|    286|      }
 1435|    294|      if (cur < end) {
  ------------------
  |  Branch (1435:11): [True: 291, False: 3]
  ------------------
 1436|    291|        _mm256_storeu_si256((__m256i *)(end - 32), _mm256_loadu_si256((const __m256i *)(ref + len - 32)));
 1437|    291|      }
 1438|    294|      return end;
 1439|    294|    }
 1440|       |    /* Exact 16..31-byte copy near end of buffer using two overlapping 16B stores. */
 1441|    280|    if (len >= 16) {
  ------------------
  |  Branch (1441:9): [True: 32, False: 248]
  ------------------
 1442|     32|      _mm_storeu_si128((__m128i *)op, _mm_loadu_si128((const __m128i *)ref));
 1443|     32|      _mm_storeu_si128((__m128i *)(end - 16), _mm_loadu_si128((const __m128i *)(ref + len - 16)));
 1444|     32|      return end;
 1445|     32|    }
 1446|    248|    return copy_match(op, ref, (unsigned)len);
 1447|    280|  }
 1448|       |
 1449|  4.55k|  if (dist >= 16) {
  ------------------
  |  Branch (1449:7): [True: 228, False: 4.32k]
  ------------------
 1450|       |    /* 16..31-byte overlap distance: single 16B overcopy for short matches. */
 1451|    228|    if (len <= 16 && op_limit - op >= 16) {
  ------------------
  |  Branch (1451:9): [True: 208, False: 20]
  |  Branch (1451:22): [True: 174, False: 34]
  ------------------
 1452|    174|      _mm_storeu_si128((__m128i *)op, _mm_loadu_si128((const __m128i *)ref));
 1453|    174|      return end;
 1454|    174|    }
 1455|     54|    if (len >= 32) {
  ------------------
  |  Branch (1455:9): [True: 14, False: 40]
  ------------------
 1456|       |      /* Seed first dist bytes so wide_dist = 2 * dist >= 32, enabling 32B AVX2 copies. */
 1457|     14|      _mm_storeu_si128((__m128i *)op, _mm_loadu_si128((const __m128i *)ref));
 1458|     14|      _mm_storeu_si128((__m128i *)(op + dist - 16), _mm_loadu_si128((const __m128i *)(ref + dist - 16)));
 1459|     14|      uint8_t *cur = op + dist;
 1460|     14|      const uint8_t *src = ref;
 1461|     14|      ptrdiff_t wide_dist = dist * 2;
 1462|     30|      while (cur + 64 <= end) {
  ------------------
  |  Branch (1462:14): [True: 16, False: 14]
  ------------------
 1463|     16|        _mm256_storeu_si256((__m256i *)cur, _mm256_loadu_si256((const __m256i *)src));
 1464|     16|        _mm256_storeu_si256((__m256i *)(cur + 32), _mm256_loadu_si256((const __m256i *)(src + 32)));
 1465|     16|        cur += 64;
 1466|     16|        src += 64;
 1467|     16|      }
 1468|     14|      if (cur + 32 <= end) {
  ------------------
  |  Branch (1468:11): [True: 4, False: 10]
  ------------------
 1469|      4|        _mm256_storeu_si256((__m256i *)cur, _mm256_loadu_si256((const __m256i *)src));
 1470|      4|        cur += 32;
 1471|      4|        src += 32;
 1472|      4|      }
 1473|       |      /* Overlapping 32B tail if the wide loop ran; otherwise finish safely with 16B ops. */
 1474|     14|      if (cur < end) {
  ------------------
  |  Branch (1474:11): [True: 14, False: 0]
  ------------------
 1475|     14|        if (cur > op + dist) {
  ------------------
  |  Branch (1475:13): [True: 6, False: 8]
  ------------------
 1476|      6|          _mm256_storeu_si256((__m256i *)(end - 32), _mm256_loadu_si256((const __m256i *)(end - 32 - wide_dist)));
 1477|      6|        }
 1478|      8|        else {
 1479|      8|          if (cur + 16 <= end) {
  ------------------
  |  Branch (1479:15): [True: 8, False: 0]
  ------------------
 1480|      8|            _mm_storeu_si128((__m128i *)cur, _mm_loadu_si128((const __m128i *)src));
 1481|      8|            cur += 16;
 1482|      8|          }
 1483|      8|          if (cur < end) {
  ------------------
  |  Branch (1483:15): [True: 7, False: 1]
  ------------------
 1484|      7|            _mm_storeu_si128((__m128i *)(end - 16), _mm_loadu_si128((const __m128i *)(end - 16 - dist)));
 1485|      7|          }
 1486|      8|        }
 1487|     14|      }
 1488|     14|      return end;
 1489|     14|    }
 1490|       |    /* Exact 16..31-byte copy with two overlapping 16B stores. */
 1491|     40|    if (len >= 16) {
  ------------------
  |  Branch (1491:9): [True: 6, False: 34]
  ------------------
 1492|      6|      _mm_storeu_si128((__m128i *)op, _mm_loadu_si128((const __m128i *)ref));
 1493|      6|      if (len > 16) {
  ------------------
  |  Branch (1493:11): [True: 6, False: 0]
  ------------------
 1494|      6|        _mm_storeu_si128((__m128i *)(end - 16), _mm_loadu_si128((const __m128i *)(ref + len - 16)));
 1495|      6|      }
 1496|      6|      return end;
 1497|      6|    }
 1498|     34|    return copy_match(op, ref, (unsigned)len);
 1499|     40|  }
 1500|       |
 1501|  4.32k|  if (dist == 1) {
  ------------------
  |  Branch (1501:7): [True: 2.06k, False: 2.25k]
  ------------------
 1502|       |    /* Inline AVX2 RLE fills up to 256B to avoid memset call overhead; longer runs use memset. */
 1503|  2.06k|    if (len <= 32 && op_limit - op >= 32) {
  ------------------
  |  Branch (1503:9): [True: 561, False: 1.50k]
  |  Branch (1503:22): [True: 0, False: 561]
  ------------------
 1504|      0|      _mm256_storeu_si256((__m256i *)op, _mm256_set1_epi8((char)*ref));
 1505|      0|      return end;
 1506|      0|    }
 1507|  2.06k|    if (len <= 64 && op_limit - op >= 64) {
  ------------------
  |  Branch (1507:9): [True: 717, False: 1.35k]
  |  Branch (1507:22): [True: 64, False: 653]
  ------------------
 1508|     64|      __m256i v = _mm256_set1_epi8((char)*ref);
 1509|     64|      _mm256_storeu_si256((__m256i *)op, v);
 1510|     64|      _mm256_storeu_si256((__m256i *)(op + 32), v);
 1511|     64|      return end;
 1512|     64|    }
 1513|  2.00k|    if (len >= 32 && len <= 256) {
  ------------------
  |  Branch (1513:9): [True: 1.44k, False: 561]
  |  Branch (1513:22): [True: 1.44k, False: 1]
  ------------------
 1514|  1.44k|      __m256i v = _mm256_set1_epi8((char)*ref);
 1515|  1.44k|      uint8_t *cur = op;
 1516|  2.82k|      while (cur + 64 <= end) {
  ------------------
  |  Branch (1516:14): [True: 1.38k, False: 1.44k]
  ------------------
 1517|  1.38k|        _mm256_storeu_si256((__m256i *)cur, v);
 1518|  1.38k|        _mm256_storeu_si256((__m256i *)(cur + 32), v);
 1519|  1.38k|        cur += 64;
 1520|  1.38k|      }
 1521|  1.44k|      if (cur + 32 <= end) {
  ------------------
  |  Branch (1521:11): [True: 166, False: 1.27k]
  ------------------
 1522|    166|        _mm256_storeu_si256((__m256i *)cur, v);
 1523|    166|        cur += 32;
 1524|    166|      }
 1525|  1.44k|      if (cur < end) {
  ------------------
  |  Branch (1525:11): [True: 1.43k, False: 5]
  ------------------
 1526|  1.43k|        _mm256_storeu_si256((__m256i *)(end - 32), v);
 1527|  1.43k|      }
 1528|  1.44k|      return end;
 1529|  1.44k|    }
 1530|    562|    memset(op, *ref, (size_t)len);
 1531|    562|    return end;
 1532|  2.00k|  }
 1533|       |
 1534|  2.25k|  if (dist >= 8) {
  ------------------
  |  Branch (1534:7): [True: 853, False: 1.40k]
  ------------------
 1535|       |    /* 8..15-byte overlap distance: fast short copies, or double distance to >=16B for loops. */
 1536|    853|    if (len <= dist && op_limit - op >= 16) {
  ------------------
  |  Branch (1536:9): [True: 88, False: 765]
  |  Branch (1536:24): [True: 86, False: 2]
  ------------------
 1537|     86|      _mm_storeu_si128((__m128i *)op, _mm_loadu_si128((const __m128i *)ref));
 1538|     86|      return end;
 1539|     86|    }
 1540|    767|    if (len <= 16 && op_limit - op >= 16) {
  ------------------
  |  Branch (1540:9): [True: 8, False: 759]
  |  Branch (1540:22): [True: 4, False: 4]
  ------------------
 1541|      4|      memcpy(op, ref, 8);
 1542|      4|      memcpy(op + 8, ref + 8, 8);
 1543|      4|      return end;
 1544|      4|    }
 1545|    763|    if (len > 16) {
  ------------------
  |  Branch (1545:9): [True: 759, False: 4]
  ------------------
 1546|       |      /* Seed first dist bytes so wide_dist = 2 * dist >= 16. */
 1547|    759|      _mm_storeu_si128((__m128i *)op, _mm_loadu_si128((const __m128i *)ref));
 1548|    759|      uint8_t *cur = op + dist;
 1549|    759|      const uint8_t *src = ref;
 1550|    759|      ptrdiff_t wide_dist = dist * 2;
 1551|  3.13k|      while (cur + 16 <= end) {
  ------------------
  |  Branch (1551:14): [True: 2.37k, False: 759]
  ------------------
 1552|  2.37k|        _mm_storeu_si128((__m128i *)cur, _mm_loadu_si128((const __m128i *)src));
 1553|  2.37k|        cur += 16;
 1554|  2.37k|        src += 16;
 1555|  2.37k|      }
 1556|       |      /* Finish tail via overlapping 16B copy if wide loop ran, else bytewise fallback. */
 1557|    759|      if (cur < end) {
  ------------------
  |  Branch (1557:11): [True: 684, False: 75]
  ------------------
 1558|    684|        if (cur > op + dist) {
  ------------------
  |  Branch (1558:13): [True: 682, False: 2]
  ------------------
 1559|    682|          _mm_storeu_si128((__m128i *)(end - 16), _mm_loadu_si128((const __m128i *)(end - 16 - wide_dist)));
 1560|    682|        }
 1561|      2|        else {
 1562|      8|          while (cur < end) {
  ------------------
  |  Branch (1562:18): [True: 6, False: 2]
  ------------------
 1563|      6|            *cur++ = *src++;
 1564|      6|          }
 1565|      2|        }
 1566|    684|      }
 1567|    759|      return end;
 1568|    759|    }
 1569|      4|    return copy_match(op, ref, (unsigned)len);
 1570|    763|  }
 1571|       |
 1572|  1.40k|  if ((dist == 2 || dist == 4) && len >= 16) {
  ------------------
  |  Branch (1572:8): [True: 66, False: 1.33k]
  |  Branch (1572:21): [True: 156, False: 1.18k]
  |  Branch (1572:35): [True: 158, False: 64]
  ------------------
 1573|    158|    __m256i v256;
 1574|    158|    if (dist == 2) {
  ------------------
  |  Branch (1574:9): [True: 4, False: 154]
  ------------------
 1575|      4|      int16_t pat2;
 1576|      4|      memcpy(&pat2, ref, sizeof(pat2));
 1577|      4|      v256 = _mm256_set1_epi16(pat2);
 1578|      4|    }
 1579|    154|    else {
 1580|    154|      int32_t pat4;
 1581|    154|      memcpy(&pat4, ref, sizeof(pat4));
 1582|    154|      v256 = _mm256_set1_epi32(pat4);
 1583|    154|    }
 1584|    158|    __m128i v128 = _mm256_castsi256_si128(v256);
 1585|    158|    uint8_t *cur = op;
 1586|    323|    while (cur + 64 <= end) {
  ------------------
  |  Branch (1586:12): [True: 165, False: 158]
  ------------------
 1587|    165|      _mm256_storeu_si256((__m256i *)cur, v256);
 1588|    165|      _mm256_storeu_si256((__m256i *)(cur + 32), v256);
 1589|    165|      cur += 64;
 1590|    165|    }
 1591|    158|    if (cur + 32 <= end) {
  ------------------
  |  Branch (1591:9): [True: 155, False: 3]
  ------------------
 1592|    155|      _mm256_storeu_si256((__m256i *)cur, v256);
 1593|    155|      cur += 32;
 1594|    155|    }
 1595|    158|    if (cur + 16 <= end) {
  ------------------
  |  Branch (1595:9): [True: 4, False: 154]
  ------------------
 1596|      4|      _mm_storeu_si128((__m128i *)cur, v128);
 1597|      4|      cur += 16;
 1598|      4|    }
 1599|    158|    if (cur < end) {
  ------------------
  |  Branch (1599:9): [True: 157, False: 1]
  ------------------
 1600|    157|      if (op_limit - cur >= 16) {
  ------------------
  |  Branch (1600:11): [True: 155, False: 2]
  ------------------
 1601|    155|        _mm_storeu_si128((__m128i *)cur, v128);
 1602|    155|      }
 1603|      2|      else {
 1604|      2|        const uint8_t *tail_src = ref;
 1605|     22|        while (cur < end) {
  ------------------
  |  Branch (1605:16): [True: 20, False: 2]
  ------------------
 1606|     20|          *cur++ = *tail_src++;
 1607|     20|        }
 1608|      2|      }
 1609|    157|    }
 1610|    158|    return end;
 1611|    158|  }
 1612|       |
 1613|  1.24k|  return copy_match(op, ref, (unsigned)len);
 1614|  1.40k|}

blosc2.c:ctx_clear_maskout:
  170|  4.60k|static inline void ctx_clear_maskout(blosc2_context *context) {
  171|  4.60k|  free(context->block_maskout);
  172|       |  context->block_maskout = NULL;
  173|  4.60k|  context->block_maskout_nitems = 0;
  174|  4.60k|}
schunk.c:ctx_uses_parallel_backend:
  165|      2|static inline bool ctx_uses_parallel_backend(const blosc2_context *context) {
  166|      2|  return context != NULL && context->thread_backend != BLOSC_BACKEND_SERIAL && context->nthreads > 1;
  ------------------
  |  |   33|      4|#define BLOSC_BACKEND_SERIAL 0
  ------------------
  |  Branch (166:10): [True: 2, False: 0]
  |  Branch (166:29): [True: 0, False: 2]
  |  Branch (166:80): [True: 0, False: 0]
  ------------------
  167|      2|}
schunk.c:ctx_clear_maskout:
  170|  1.12k|static inline void ctx_clear_maskout(blosc2_context *context) {
  171|  1.12k|  free(context->block_maskout);
  172|       |  context->block_maskout = NULL;
  173|  1.12k|  context->block_maskout_nitems = 0;
  174|  1.12k|}

delta_encoder:
   19|    839|                   const uint8_t* src, uint8_t* dest) {
   20|    839|  int32_t i;
   21|    839|  if (offset == 0) {
  ------------------
  |  Branch (21:7): [True: 58, False: 781]
  ------------------
   22|       |    /* This is the reference block, use delta coding in elements */
   23|     58|    switch (typesize) {
   24|      4|      case 1:
  ------------------
  |  Branch (24:7): [True: 4, False: 54]
  ------------------
   25|      4|        dest[0] = dref[0];
   26|     64|        for (i = 1; i < nbytes; i++) {
  ------------------
  |  Branch (26:21): [True: 60, False: 4]
  ------------------
   27|     60|          dest[i] = src[i] ^ dref[i-1];
   28|     60|        }
   29|      4|        break;
   30|      0|      case 2:
  ------------------
  |  Branch (30:7): [True: 0, False: 58]
  ------------------
   31|      0|        ((uint16_t *)dest)[0] = ((uint16_t *)dref)[0];
   32|      0|        for (i = 1; i < nbytes / 2; i++) {
  ------------------
  |  Branch (32:21): [True: 0, False: 0]
  ------------------
   33|      0|          ((uint16_t *)dest)[i] =
   34|      0|                  ((uint16_t *)src)[i] ^ ((uint16_t *)dref)[i-1];
   35|      0|        }
   36|      0|        break;
   37|     20|      case 4:
  ------------------
  |  Branch (37:7): [True: 20, False: 38]
  ------------------
   38|     20|        ((uint32_t *)dest)[0] = ((uint32_t *)dref)[0];
   39|  1.28k|        for (i = 1; i < nbytes / 4; i++) {
  ------------------
  |  Branch (39:21): [True: 1.26k, False: 20]
  ------------------
   40|  1.26k|          ((uint32_t *)dest)[i] =
   41|  1.26k|                  ((uint32_t *)src)[i] ^ ((uint32_t *)dref)[i-1];
   42|  1.26k|        }
   43|     20|        break;
   44|     34|      case 8:
  ------------------
  |  Branch (44:7): [True: 34, False: 24]
  ------------------
   45|     34|        ((uint64_t *)dest)[0] = ((uint64_t *)dref)[0];
   46|    544|        for (i = 1; i < nbytes / 8; i++) {
  ------------------
  |  Branch (46:21): [True: 510, False: 34]
  ------------------
   47|    510|          ((uint64_t *)dest)[i] =
   48|    510|                  ((uint64_t *)src)[i] ^ ((uint64_t *)dref)[i-1];
   49|    510|        }
   50|     34|        break;
   51|      0|      default:
  ------------------
  |  Branch (51:7): [True: 0, False: 58]
  ------------------
   52|      0|        if ((typesize % 8) == 0) {
  ------------------
  |  Branch (52:13): [True: 0, False: 0]
  ------------------
   53|      0|          delta_encoder(dref, offset, nbytes, 8, src, dest);
   54|      0|        } else {
   55|      0|          delta_encoder(dref, offset, nbytes, 1, src, dest);
   56|      0|        }
   57|     58|    }
   58|    781|  } else {
   59|       |    /* Use delta coding wrt reference block */
   60|    781|    switch (typesize) {
   61|     37|      case 1:
  ------------------
  |  Branch (61:7): [True: 37, False: 744]
  ------------------
   62|    629|        for (i = 0; i < nbytes; i++) {
  ------------------
  |  Branch (62:21): [True: 592, False: 37]
  ------------------
   63|    592|          dest[i] = src[i] ^ dref[i];
   64|    592|        }
   65|     37|        break;
   66|      0|      case 2:
  ------------------
  |  Branch (66:7): [True: 0, False: 781]
  ------------------
   67|      0|        for (i = 0; i < nbytes / 2; i++) {
  ------------------
  |  Branch (67:21): [True: 0, False: 0]
  ------------------
   68|      0|          ((uint16_t *) dest)[i] =
   69|      0|                  ((uint16_t *) src)[i] ^ ((uint16_t *) dref)[i];
   70|      0|        }
   71|      0|        break;
   72|    234|      case 4:
  ------------------
  |  Branch (72:7): [True: 234, False: 547]
  ------------------
   73|  3.97k|        for (i = 0; i < nbytes / 4; i++) {
  ------------------
  |  Branch (73:21): [True: 3.74k, False: 234]
  ------------------
   74|  3.74k|          ((uint32_t *) dest)[i] =
   75|  3.74k|                  ((uint32_t *) src)[i] ^ ((uint32_t *) dref)[i];
   76|  3.74k|        }
   77|    234|        break;
   78|    510|      case 8:
  ------------------
  |  Branch (78:7): [True: 510, False: 271]
  ------------------
   79|  8.67k|        for (i = 0; i < nbytes / 8; i++) {
  ------------------
  |  Branch (79:21): [True: 8.16k, False: 510]
  ------------------
   80|  8.16k|          ((uint64_t *) dest)[i] =
   81|  8.16k|                  ((uint64_t *) src)[i] ^ ((uint64_t *) dref)[i];
   82|  8.16k|        }
   83|    510|        break;
   84|      0|      default:
  ------------------
  |  Branch (84:7): [True: 0, False: 781]
  ------------------
   85|      0|        if ((typesize % 8) == 0) {
  ------------------
  |  Branch (85:13): [True: 0, False: 0]
  ------------------
   86|      0|          delta_encoder(dref, offset, nbytes, 8, src, dest);
   87|      0|        } else {
   88|      0|          delta_encoder(dref, offset, nbytes, 1, src, dest);
   89|      0|        }
   90|    781|    }
   91|    781|  }
   92|    839|}
delta_decoder:
   97|  1.60k|                   int32_t typesize, uint8_t* dest) {
   98|  1.60k|  int32_t i;
   99|       |
  100|  1.60k|  if (offset == 0) {
  ------------------
  |  Branch (100:7): [True: 576, False: 1.02k]
  ------------------
  101|       |    /* Decode delta for the reference block */
  102|    576|    switch (typesize) {
  103|    122|      case 1:
  ------------------
  |  Branch (103:7): [True: 122, False: 454]
  ------------------
  104|  5.43G|        for (i = 1; i < nbytes; i++) {
  ------------------
  |  Branch (104:21): [True: 5.43G, False: 122]
  ------------------
  105|  5.43G|          dest[i] ^= dref[i-1];
  106|  5.43G|        }
  107|    122|        break;
  108|     38|      case 2:
  ------------------
  |  Branch (108:7): [True: 38, False: 538]
  ------------------
  109|  1.18G|        for (i = 1; i < nbytes / 2; i++) {
  ------------------
  |  Branch (109:21): [True: 1.18G, False: 38]
  ------------------
  110|  1.18G|          ((uint16_t *)dest)[i] ^= ((uint16_t *)dref)[i-1];
  111|  1.18G|        }
  112|     38|        break;
  113|     51|      case 4:
  ------------------
  |  Branch (113:7): [True: 51, False: 525]
  ------------------
  114|   593M|        for (i = 1; i < nbytes / 4; i++) {
  ------------------
  |  Branch (114:21): [True: 593M, False: 51]
  ------------------
  115|   593M|          ((uint32_t *)dest)[i] ^= ((uint32_t *)dref)[i-1];
  116|   593M|        }
  117|     51|        break;
  118|    212|      case 8:
  ------------------
  |  Branch (118:7): [True: 212, False: 364]
  ------------------
  119|   605M|        for (i = 1; i < nbytes / 8; i++) {
  ------------------
  |  Branch (119:21): [True: 605M, False: 212]
  ------------------
  120|   605M|          ((uint64_t *)dest)[i] ^= ((uint64_t *)dref)[i-1];
  121|   605M|        }
  122|    212|        break;
  123|    153|      default:
  ------------------
  |  Branch (123:7): [True: 153, False: 423]
  ------------------
  124|    153|        if ((typesize % 8) == 0) {
  ------------------
  |  Branch (124:13): [True: 86, False: 67]
  ------------------
  125|     86|          delta_decoder(dref, offset, nbytes, 8, dest);
  126|     86|        } else {
  127|     67|          delta_decoder(dref, offset, nbytes, 1, dest);
  128|     67|        }
  129|    576|    }
  130|  1.02k|  } else {
  131|       |    /* Decode delta for the non-reference blocks */
  132|  1.02k|    switch (typesize) {
  133|     35|      case 1:
  ------------------
  |  Branch (133:7): [True: 35, False: 990]
  ------------------
  134|  1.34G|        for (i = 0; i < nbytes; i++) {
  ------------------
  |  Branch (134:21): [True: 1.34G, False: 35]
  ------------------
  135|  1.34G|          dest[i] ^= dref[i];
  136|  1.34G|        }
  137|     35|        break;
  138|     19|      case 2:
  ------------------
  |  Branch (138:7): [True: 19, False: 1.00k]
  ------------------
  139|   308M|        for (i = 0; i < nbytes / 2; i++) {
  ------------------
  |  Branch (139:21): [True: 308M, False: 19]
  ------------------
  140|   308M|          ((uint16_t *)dest)[i] ^= ((uint16_t *)dref)[i];
  141|   308M|        }
  142|     19|        break;
  143|    135|      case 4:
  ------------------
  |  Branch (143:7): [True: 135, False: 890]
  ------------------
  144|   226M|        for (i = 0; i < nbytes / 4; i++) {
  ------------------
  |  Branch (144:21): [True: 226M, False: 135]
  ------------------
  145|   226M|          ((uint32_t *)dest)[i] ^= ((uint32_t *)dref)[i];
  146|   226M|        }
  147|    135|        break;
  148|    797|      case 8:
  ------------------
  |  Branch (148:7): [True: 797, False: 228]
  ------------------
  149|   207M|        for (i = 0; i < nbytes / 8; i++) {
  ------------------
  |  Branch (149:21): [True: 207M, False: 797]
  ------------------
  150|   207M|          ((uint64_t *)dest)[i] ^= ((uint64_t *)dref)[i];
  151|   207M|        }
  152|    797|        break;
  153|     39|      default:
  ------------------
  |  Branch (153:7): [True: 39, False: 986]
  ------------------
  154|     39|        if ((typesize % 8) == 0) {
  ------------------
  |  Branch (154:13): [True: 20, False: 19]
  ------------------
  155|     20|          delta_decoder(dref, offset, nbytes, 8, dest);
  156|     20|        } else {
  157|     19|          delta_decoder(dref, offset, nbytes, 1, dest);
  158|     19|        }
  159|  1.02k|    }
  160|  1.02k|  }
  161|  1.60k|}

fastcopy:
  516|    276|unsigned char *fastcopy(unsigned char *out, const unsigned char *from, unsigned len) {
  517|    276|  switch (len) {
  518|      0|    case 32:
  ------------------
  |  Branch (518:5): [True: 0, False: 276]
  ------------------
  519|      0|      return copy_32_bytes(out, from);
  520|      0|    case 16:
  ------------------
  |  Branch (520:5): [True: 0, False: 276]
  ------------------
  521|      0|      return copy_16_bytes(out, from);
  522|      5|    case 8:
  ------------------
  |  Branch (522:5): [True: 5, False: 271]
  ------------------
  523|      5|      return copy_8_bytes(out, from);
  524|    271|    default: {
  ------------------
  |  Branch (524:5): [True: 271, False: 5]
  ------------------
  525|    271|    }
  526|    276|  }
  527|    271|  if (len < 8) {
  ------------------
  |  Branch (527:7): [True: 113, False: 158]
  ------------------
  528|    113|    return copy_bytes(out, from, len);
  529|    113|  }
  530|    158|#if defined(__SSE2__)
  531|    158|  if (len < 16) {
  ------------------
  |  Branch (531:7): [True: 158, False: 0]
  ------------------
  532|    158|    return chunk_memcpy(out, from, len);
  533|    158|  }
  534|      0|#if !defined(__AVX2__)
  535|      0|  return chunk_memcpy_unaligned(out, from, len);
  536|       |#else
  537|       |  if (len < 32) {
  538|       |    return chunk_memcpy_16(out, from, len);
  539|       |  }
  540|       |  return chunk_memcpy_unaligned(out, from, len);
  541|       |#endif  // !__AVX2__
  542|       |#else
  543|       |  return chunk_memcpy(out, from, len);
  544|       |#endif  // __SSE2__
  545|    158|}
copy_match:
  549|  1.53k|unsigned char* copy_match(unsigned char *out, const unsigned char *from, unsigned len) {
  550|       |#if defined(__AVX2__)
  551|       |  unsigned sz = sizeof(__m256i);
  552|       |#elif defined(__SSE2__)
  553|       |  unsigned sz = sizeof(__m128i);
  554|       |#else
  555|       |  unsigned sz = sizeof(uint64_t);
  556|       |#endif
  557|       |
  558|       |#if ((defined(__GNUC__) && BLOSC_GCC_VERSION < 800) && !defined(__clang__) && !defined(__ICC) && !defined(__ICL))
  559|       |  // GCC < 8 in fully optimization mode seems to have problems with the code further below so stop here
  560|       |  for (; len > 0; len--) {
  561|       |    *out++ = *from++;
  562|       |  }
  563|       |  return out;
  564|       |#endif
  565|       |
  566|       |  // If out and from are away more than the size of the copy, then a fastcopy is safe
  567|  1.53k|  unsigned overlap_dist = (unsigned) (out - from);
  568|  1.53k|  if (overlap_dist > sz) {
  ------------------
  |  Branch (568:7): [True: 276, False: 1.25k]
  ------------------
  569|    276|    return fastcopy(out, from, len);
  570|    276|  }
  571|       |
  572|       |  // Otherwise we need to be more careful so as not to overwrite destination
  573|  1.25k|  switch (overlap_dist) {
  574|      0|    case 32:
  ------------------
  |  Branch (574:5): [True: 0, False: 1.25k]
  ------------------
  575|      0|      for (; len >= 32; len -= 32) {
  ------------------
  |  Branch (575:14): [True: 0, False: 0]
  ------------------
  576|      0|        out = copy_32_bytes(out, from);
  577|      0|      }
  578|      0|      break;
  579|      0|    case 30:
  ------------------
  |  Branch (579:5): [True: 0, False: 1.25k]
  ------------------
  580|      0|      for (; len >= 30; len -= 30) {
  ------------------
  |  Branch (580:14): [True: 0, False: 0]
  ------------------
  581|      0|        out = copy_16_bytes(out, from);
  582|      0|        out = copy_8_bytes(out, from + 16);
  583|      0|        out = copy_4_bytes(out, from + 24);
  584|      0|        out = copy_2_bytes(out, from + 28);
  585|      0|      }
  586|      0|      break;
  587|      0|    case 28:
  ------------------
  |  Branch (587:5): [True: 0, False: 1.25k]
  ------------------
  588|      0|      for (; len >= 28; len -= 28) {
  ------------------
  |  Branch (588:14): [True: 0, False: 0]
  ------------------
  589|      0|        out = copy_16_bytes(out, from);
  590|      0|        out = copy_8_bytes(out, from + 16);
  591|      0|        out = copy_4_bytes(out, from + 24);
  592|      0|      }
  593|      0|      break;
  594|      0|    case 26:
  ------------------
  |  Branch (594:5): [True: 0, False: 1.25k]
  ------------------
  595|      0|      for (; len >= 26; len -= 26) {
  ------------------
  |  Branch (595:14): [True: 0, False: 0]
  ------------------
  596|      0|        out = copy_16_bytes(out, from);
  597|      0|        out = copy_8_bytes(out, from + 16);
  598|      0|        out = copy_2_bytes(out, from + 24);
  599|      0|      }
  600|      0|      break;
  601|      0|    case 24:
  ------------------
  |  Branch (601:5): [True: 0, False: 1.25k]
  ------------------
  602|      0|      for (; len >= 24; len -= 24) {
  ------------------
  |  Branch (602:14): [True: 0, False: 0]
  ------------------
  603|      0|        out = copy_16_bytes(out, from);
  604|      0|        out = copy_8_bytes(out, from + 16);
  605|      0|      }
  606|      0|      break;
  607|      0|    case 22:
  ------------------
  |  Branch (607:5): [True: 0, False: 1.25k]
  ------------------
  608|      0|      for (; len >= 22; len -= 22) {
  ------------------
  |  Branch (608:14): [True: 0, False: 0]
  ------------------
  609|      0|        out = copy_16_bytes(out, from);
  610|      0|        out = copy_4_bytes(out, from + 16);
  611|      0|        out = copy_2_bytes(out, from + 20);
  612|      0|      }
  613|      0|      break;
  614|      0|    case 20:
  ------------------
  |  Branch (614:5): [True: 0, False: 1.25k]
  ------------------
  615|      0|      for (; len >= 20; len -= 20) {
  ------------------
  |  Branch (615:14): [True: 0, False: 0]
  ------------------
  616|      0|        out = copy_16_bytes(out, from);
  617|      0|        out = copy_4_bytes(out, from + 16);
  618|      0|      }
  619|      0|      break;
  620|      0|    case 18:
  ------------------
  |  Branch (620:5): [True: 0, False: 1.25k]
  ------------------
  621|      0|      for (; len >= 18; len -= 18) {
  ------------------
  |  Branch (621:14): [True: 0, False: 0]
  ------------------
  622|      0|        out = copy_16_bytes(out, from);
  623|      0|        out = copy_2_bytes(out, from + 16);
  624|      0|      }
  625|      0|      break;
  626|      6|    case 16:
  ------------------
  |  Branch (626:5): [True: 6, False: 1.25k]
  ------------------
  627|      6|      for (; len >= 16; len -= 16) {
  ------------------
  |  Branch (627:14): [True: 0, False: 6]
  ------------------
  628|      0|        out = copy_16_bytes(out, from);
  629|      0|      }
  630|      6|      break;
  631|      0|    case 8:
  ------------------
  |  Branch (631:5): [True: 0, False: 1.25k]
  ------------------
  632|      0|      for (; len >= 8; len -= 8) {
  ------------------
  |  Branch (632:14): [True: 0, False: 0]
  ------------------
  633|      0|        out = copy_8_bytes(out, from);
  634|      0|      }
  635|      0|      break;
  636|      2|    case 4:
  ------------------
  |  Branch (636:5): [True: 2, False: 1.25k]
  ------------------
  637|      4|      for (; len >= 4; len -= 4) {
  ------------------
  |  Branch (637:14): [True: 2, False: 2]
  ------------------
  638|      2|        out = copy_4_bytes(out, from);
  639|      2|      }
  640|      2|      break;
  641|     62|    case 2:
  ------------------
  |  Branch (641:5): [True: 62, False: 1.19k]
  ------------------
  642|    390|      for (; len >= 2; len -= 2) {
  ------------------
  |  Branch (642:14): [True: 328, False: 62]
  ------------------
  643|    328|        out = copy_2_bytes(out, from);
  644|    328|      }
  645|     62|      break;
  646|  1.18k|    default:
  ------------------
  |  Branch (646:5): [True: 1.18k, False: 70]
  ------------------
  647|  55.7k|      for (; len > 0; len--) {
  ------------------
  |  Branch (647:14): [True: 54.5k, False: 1.18k]
  ------------------
  648|  54.5k|        *out++ = *from++;
  649|  54.5k|      }
  650|  1.25k|  }
  651|       |
  652|       |  // Copy the leftovers
  653|  1.36k|  for (; len > 0; len--) {
  ------------------
  |  Branch (653:10): [True: 111, False: 1.25k]
  ------------------
  654|    111|    *out++ = *from++;
  655|    111|  }
  656|       |
  657|  1.25k|  return out;
  658|  1.25k|}
fastcopy.c:copy_8_bytes:
   89|    321|static inline unsigned char *copy_8_bytes(unsigned char *out, const unsigned char *from) {
   90|       |#if defined(BLOSC_STRICT_ALIGN)
   91|       |  uint64_t chunk;
   92|       |  memcpy(&chunk, from, 8);
   93|       |  memcpy(out, &chunk, 8);
   94|       |#else
   95|    321|  *(uint64_t *) out = *(uint64_t *) from;
   96|    321|#endif
   97|    321|  return out + 8;
   98|    321|}
fastcopy.c:copy_bytes:
  173|    113|static inline unsigned char *copy_bytes(unsigned char *out, const unsigned char *from, unsigned len) {
  174|    113|  assert(len < 8);
  175|       |
  176|       |#ifdef BLOSC_STRICT_ALIGN
  177|       |  while (len--) {
  178|       |    *out++ = *from++;
  179|       |  }
  180|       |#else
  181|    113|  switch (len) {
  182|     35|    case 7:
  ------------------
  |  Branch (182:5): [True: 35, False: 78]
  ------------------
  183|     35|      return copy_7_bytes(out, from);
  184|     78|    case 6:
  ------------------
  |  Branch (184:5): [True: 78, False: 35]
  ------------------
  185|     78|      return copy_6_bytes(out, from);
  186|      0|    case 5:
  ------------------
  |  Branch (186:5): [True: 0, False: 113]
  ------------------
  187|      0|      return copy_5_bytes(out, from);
  188|      0|    case 4:
  ------------------
  |  Branch (188:5): [True: 0, False: 113]
  ------------------
  189|      0|      return copy_4_bytes(out, from);
  190|      0|    case 3:
  ------------------
  |  Branch (190:5): [True: 0, False: 113]
  ------------------
  191|      0|      return copy_3_bytes(out, from);
  192|      0|    case 2:
  ------------------
  |  Branch (192:5): [True: 0, False: 113]
  ------------------
  193|      0|      return copy_2_bytes(out, from);
  194|      0|    case 1:
  ------------------
  |  Branch (194:5): [True: 0, False: 113]
  ------------------
  195|      0|      return copy_1_bytes(out, from);
  196|      0|    case 0:
  ------------------
  |  Branch (196:5): [True: 0, False: 113]
  ------------------
  197|      0|      return out;
  198|      0|    default:
  ------------------
  |  Branch (198:5): [True: 0, False: 113]
  ------------------
  199|      0|      assert(0);
  200|    113|  }
  201|      0|#endif /* BLOSC_STRICT_ALIGN */
  202|      0|  return out;
  203|    113|}
fastcopy.c:copy_7_bytes:
   83|     35|static inline unsigned char *copy_7_bytes(unsigned char *out, const unsigned char *from) {
   84|     35|  out = copy_3_bytes(out, from);
   85|     35|  return copy_4_bytes(out, from + 3);
   86|     35|}
fastcopy.c:copy_6_bytes:
   78|     78|static inline unsigned char *copy_6_bytes(unsigned char *out, const unsigned char *from) {
   79|     78|  out = copy_2_bytes(out, from);
   80|     78|  return copy_4_bytes(out, from + 2);
   81|     78|}
fastcopy.c:copy_3_bytes:
   68|     35|static inline unsigned char *copy_3_bytes(unsigned char *out, const unsigned char *from) {
   69|     35|  out = copy_1_bytes(out, from);
   70|     35|  return copy_2_bytes(out, from + 1);
   71|     35|}
fastcopy.c:copy_1_bytes:
   63|     35|static inline unsigned char *copy_1_bytes(unsigned char *out, const unsigned char *from) {
   64|     35|  *out++ = *from;
   65|     35|  return out;
   66|     35|}
fastcopy.c:chunk_memcpy:
  212|    158|static inline unsigned char *chunk_memcpy(unsigned char *out, const unsigned char *from, unsigned len) {
  213|    158|  unsigned sz = sizeof(uint64_t);
  214|    158|  unsigned rem = len % sz;
  215|    158|  unsigned by8;
  216|       |
  217|    158|  assert(len >= sz);
  218|       |
  219|       |  /* Copy a few bytes to make sure the loop below has a multiple of SZ bytes to be copied. */
  220|    158|  copy_8_bytes(out, from);
  221|       |
  222|    158|  len /= sz;
  223|    158|  out += rem;
  224|    158|  from += rem;
  225|       |
  226|    158|  by8 = len % 8;
  227|    158|  len -= by8;
  228|    158|  switch (by8) {
  229|      0|    case 7:
  ------------------
  |  Branch (229:5): [True: 0, False: 158]
  ------------------
  230|      0|      out = copy_8_bytes(out, from);
  231|      0|      from += sz;
  232|       |      #ifdef AVOID_FALLTHROUGH_WARNING
  233|       |      __attribute__ ((fallthrough));  // Shut-up -Wimplicit-fallthrough warning in GCC
  234|       |      #endif
  235|      0|    case 6:
  ------------------
  |  Branch (235:5): [True: 0, False: 158]
  ------------------
  236|      0|      out = copy_8_bytes(out, from);
  237|      0|      from += sz;
  238|       |      #ifdef AVOID_FALLTHROUGH_WARNING
  239|       |      __attribute__ ((fallthrough));
  240|       |      #endif
  241|      0|    case 5:
  ------------------
  |  Branch (241:5): [True: 0, False: 158]
  ------------------
  242|      0|      out = copy_8_bytes(out, from);
  243|      0|      from += sz;
  244|       |      #ifdef AVOID_FALLTHROUGH_WARNING
  245|       |      __attribute__ ((fallthrough));
  246|       |      #endif
  247|      0|    case 4:
  ------------------
  |  Branch (247:5): [True: 0, False: 158]
  ------------------
  248|      0|      out = copy_8_bytes(out, from);
  249|      0|      from += sz;
  250|       |      #ifdef AVOID_FALLTHROUGH_WARNING
  251|       |      __attribute__ ((fallthrough));
  252|       |      #endif
  253|      0|    case 3:
  ------------------
  |  Branch (253:5): [True: 0, False: 158]
  ------------------
  254|      0|      out = copy_8_bytes(out, from);
  255|      0|      from += sz;
  256|       |      #ifdef AVOID_FALLTHROUGH_WARNING
  257|       |      __attribute__ ((fallthrough));
  258|       |      #endif
  259|      0|    case 2:
  ------------------
  |  Branch (259:5): [True: 0, False: 158]
  ------------------
  260|      0|      out = copy_8_bytes(out, from);
  261|      0|      from += sz;
  262|       |      #ifdef AVOID_FALLTHROUGH_WARNING
  263|       |      __attribute__ ((fallthrough));
  264|       |      #endif
  265|    158|    case 1:
  ------------------
  |  Branch (265:5): [True: 158, False: 0]
  ------------------
  266|    158|      out = copy_8_bytes(out, from);
  267|    158|      from += sz;
  268|       |      #ifdef AVOID_FALLTHROUGH_WARNING
  269|       |      __attribute__ ((fallthrough));
  270|       |      #endif
  271|    158|    default:
  ------------------
  |  Branch (271:5): [True: 0, False: 158]
  ------------------
  272|    158|      break;
  273|    158|  }
  274|       |
  275|    158|  while (len) {
  ------------------
  |  Branch (275:10): [True: 0, False: 158]
  ------------------
  276|      0|    out = copy_8_bytes(out, from);
  277|      0|    from += sz;
  278|      0|    out = copy_8_bytes(out, from);
  279|      0|    from += sz;
  280|      0|    out = copy_8_bytes(out, from);
  281|      0|    from += sz;
  282|      0|    out = copy_8_bytes(out, from);
  283|      0|    from += sz;
  284|      0|    out = copy_8_bytes(out, from);
  285|      0|    from += sz;
  286|      0|    out = copy_8_bytes(out, from);
  287|      0|    from += sz;
  288|      0|    out = copy_8_bytes(out, from);
  289|      0|    from += sz;
  290|      0|    out = copy_8_bytes(out, from);
  291|      0|    from += sz;
  292|       |
  293|      0|    len -= 8;
  294|      0|  }
  295|       |
  296|    158|  return out;
  297|    158|}
fastcopy.c:copy_4_bytes:
   51|    115|static inline unsigned char *copy_4_bytes(unsigned char *out, const unsigned char *from) {
   52|       |#if defined(BLOSC_STRICT_ALIGN)
   53|       |  uint32_t chunk;
   54|       |  memcpy(&chunk, from, 4);
   55|       |  memcpy(out, &chunk, 4);
   56|       |#else
   57|    115|  *(uint32_t *) out = *(uint32_t *) from;
   58|    115|#endif
   59|    115|  return out + 4;
   60|    115|}
fastcopy.c:copy_2_bytes:
   40|    441|static inline unsigned char *copy_2_bytes(unsigned char *out, const unsigned char *from) {
   41|       |#if defined(BLOSC_STRICT_ALIGN)
   42|       |  uint16_t chunk;
   43|       |  memcpy(&chunk, from, 2);
   44|       |  memcpy(out, &chunk, 2);
   45|       |#else
   46|    441|  *(uint16_t *) out = *(uint16_t *) from;
   47|    441|#endif
   48|    441|  return out + 2;
   49|    441|}

frame_reader_invalidate:
  495|  2.02k|int frame_reader_invalidate(blosc2_frame_s* frame) {
  496|  2.02k|  blosc2_pthread_mutex_lock(&frame->read_fp_mutex);
  ------------------
  |  |   92|  2.02k|#define blosc2_pthread_mutex_lock(a) pthread_mutex_lock((a))
  ------------------
  497|  2.02k|  int w_rc = frame_writer_close_locked(frame);
  498|  2.02k|  int r_rc = frame_reader_close_locked(frame, true);
  499|  2.02k|  blosc2_pthread_mutex_unlock(&frame->read_fp_mutex);
  ------------------
  |  |   93|  2.02k|#define blosc2_pthread_mutex_unlock(a) pthread_mutex_unlock((a))
  ------------------
  500|  2.02k|  if (w_rc < 0) {
  ------------------
  |  Branch (500:7): [True: 0, False: 2.02k]
  ------------------
  501|      0|    return w_rc;
  502|      0|  }
  503|  2.02k|  return r_rc < 0 ? r_rc : BLOSC2_ERROR_SUCCESS;
  ------------------
  |  Branch (503:10): [True: 0, False: 2.02k]
  ------------------
  504|  2.02k|}
frame_new:
  782|     70|blosc2_frame_s* frame_new(const char* urlpath) {
  783|     70|  blosc2_frame_s* new_frame = frame_alloc();
  784|     70|  if (new_frame == NULL) {
  ------------------
  |  Branch (784:7): [True: 0, False: 70]
  ------------------
  785|      0|    return NULL;
  786|      0|  }
  787|     70|  if (urlpath != NULL) {
  ------------------
  |  Branch (787:7): [True: 0, False: 70]
  ------------------
  788|      0|    char* new_urlpath = malloc(strlen(urlpath) + 1);  // + 1 for the trailing NULL
  789|      0|    if (new_urlpath == NULL) {
  ------------------
  |  Branch (789:9): [True: 0, False: 0]
  ------------------
  790|      0|      blosc2_pthread_mutex_destroy(&new_frame->read_fp_mutex);
  ------------------
  |  |   91|      0|#define blosc2_pthread_mutex_destroy(a) pthread_mutex_destroy((a))
  ------------------
  791|      0|      free(new_frame);
  792|      0|      return NULL;
  793|      0|    }
  794|      0|    new_frame->urlpath = strcpy(new_urlpath, urlpath);
  795|      0|    new_frame->file_offset = 0;
  796|      0|  }
  797|     70|  return new_frame;
  798|     70|}
frame_set_locking:
  819|     70|void frame_set_locking(blosc2_frame_s* frame, const blosc2_io* io) {
  820|     70|  if (frame->urlpath == NULL) {
  ------------------
  |  Branch (820:7): [True: 70, False: 0]
  ------------------
  821|     70|    return;
  822|     70|  }
  823|      0|  if (frame_locking_requested(io)) {
  ------------------
  |  Branch (823:7): [True: 0, False: 0]
  ------------------
  824|       |    frame->locking = true;
  825|      0|    frame->lock_fd = -1;
  826|      0|  }
  827|      0|}
frame_lock:
  938|  2.11k|int frame_lock(blosc2_frame_s* frame, bool exclusive) {
  939|  2.11k|  if (frame == NULL || !frame->locking) {
  ------------------
  |  Branch (939:7): [True: 0, False: 2.11k]
  |  Branch (939:24): [True: 2.11k, False: 0]
  ------------------
  940|  2.11k|    return BLOSC2_ERROR_SUCCESS;
  941|  2.11k|  }
  942|      0|  if (frame->lock_depth > 0) {
  ------------------
  |  Branch (942:7): [True: 0, False: 0]
  ------------------
  943|       |    // Already held by this handle (a nested call); the outer lock covers us
  944|      0|    frame->lock_depth++;
  945|      0|    return BLOSC2_ERROR_SUCCESS;
  946|      0|  }
  947|      0|  if (frame->lock_fd == -1) {
  ------------------
  |  Branch (947:7): [True: 0, False: 0]
  ------------------
  948|       |    // Lazily open the sidecar, kept for the frame's lifetime
  949|      0|    char* path = frame_lock_path(frame);
  950|      0|    if (path == NULL) {
  ------------------
  |  Branch (950:9): [True: 0, False: 0]
  ------------------
  951|      0|      return BLOSC2_ERROR_MEMORY_ALLOC;
  952|      0|    }
  953|       |#if defined(_WIN32)
  954|       |    HANDLE h = CreateFileA(path, GENERIC_READ | GENERIC_WRITE,
  955|       |                           FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
  956|       |                           NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
  957|       |    if (h == INVALID_HANDLE_VALUE) {
  958|       |      BLOSC_TRACE_ERROR("Cannot open the lock file in: %s", path);
  959|       |      free(path);
  960|       |      return BLOSC2_ERROR_LOCK;
  961|       |    }
  962|       |    frame->lock_fd = (intptr_t)h;
  963|       |#else
  964|      0|    int fd = open(path, O_CREAT | O_RDWR | O_CLOEXEC, 0666);
  965|      0|    if (fd < 0) {
  ------------------
  |  Branch (965:9): [True: 0, False: 0]
  ------------------
  966|      0|      BLOSC_TRACE_ERROR("Cannot open the lock file in: %s", path);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  967|      0|      free(path);
  968|      0|      return BLOSC2_ERROR_LOCK;
  969|      0|    }
  970|      0|    frame->lock_fd = fd;
  971|      0|#endif
  972|      0|    free(path);
  973|      0|  }
  974|      0|  if (frame_os_lock(frame, exclusive) < 0) {
  ------------------
  |  Branch (974:7): [True: 0, False: 0]
  ------------------
  975|      0|    BLOSC_TRACE_ERROR("Cannot lock the frame.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  976|      0|    return BLOSC2_ERROR_LOCK;
  977|      0|  }
  978|       |  // Generation counter: writers bump it, everyone compares it with the last
  979|       |  // value it saw.  This detects mutations by other handles exactly, even when
  980|       |  // the frame length on disk ends up unchanged (which the length-based
  981|       |  // staleness check in frame_refresh_if_stale() cannot see).
  982|      0|  uint64_t seq;
  983|      0|  if (frame_lock_read_seq(frame, &seq) < 0 ||
  ------------------
  |  Branch (983:7): [True: 0, False: 0]
  ------------------
  984|      0|      (exclusive && frame_lock_write_seq(frame, seq + 1) < 0)) {
  ------------------
  |  Branch (984:8): [True: 0, False: 0]
  |  Branch (984:21): [True: 0, False: 0]
  ------------------
  985|      0|    BLOSC_TRACE_ERROR("Cannot access the frame lock generation counter.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  986|      0|    frame_os_unlock(frame);
  987|      0|    return BLOSC2_ERROR_LOCK;
  988|      0|  }
  989|      0|  if (seq != frame->lock_seq) {
  ------------------
  |  Branch (989:7): [True: 0, False: 0]
  ------------------
  990|      0|    frame->force_refresh = true;
  991|      0|  }
  992|      0|  if (exclusive) {
  ------------------
  |  Branch (992:7): [True: 0, False: 0]
  ------------------
  993|      0|    seq++;
  994|      0|  }
  995|      0|  frame->lock_seq = seq;
  996|      0|  frame->lock_depth = 1;
  997|      0|  return BLOSC2_ERROR_SUCCESS;
  998|      0|}
frame_unlock:
 1001|  2.11k|int frame_unlock(blosc2_frame_s* frame) {
 1002|  2.11k|  if (frame == NULL || !frame->locking || frame->lock_depth == 0) {
  ------------------
  |  Branch (1002:7): [True: 0, False: 2.11k]
  |  Branch (1002:24): [True: 2.11k, False: 0]
  |  Branch (1002:43): [True: 0, False: 0]
  ------------------
 1003|  2.11k|    return BLOSC2_ERROR_SUCCESS;
 1004|  2.11k|  }
 1005|      0|  if (--frame->lock_depth > 0) {
  ------------------
  |  Branch (1005:7): [True: 0, False: 0]
  ------------------
 1006|      0|    return BLOSC2_ERROR_SUCCESS;
 1007|      0|  }
 1008|       |  // Hand our writes over before the next lock holder looks: closing the cached
 1009|       |  // writer is what pushes them to the server on NFS (close-to-open consistency).
 1010|       |  // A no-op unless this handle wrote since it last let go of the lock.
 1011|      0|  int close_rc = frame_writer_close(frame);
 1012|      0|  if (frame_os_unlock(frame) < 0) {
  ------------------
  |  Branch (1012:7): [True: 0, False: 0]
  ------------------
 1013|      0|    BLOSC_TRACE_ERROR("Cannot unlock the frame.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1014|      0|    return BLOSC2_ERROR_LOCK;
 1015|      0|  }
 1016|      0|  return close_rc;
 1017|      0|}
frame_free:
 1021|  2.02k|int frame_free(blosc2_frame_s* frame) {
 1022|       |
 1023|  2.02k|  int rc = frame_reader_invalidate(frame);
 1024|  2.02k|  blosc2_pthread_mutex_destroy(&frame->read_fp_mutex);
  ------------------
  |  |   91|  2.02k|#define blosc2_pthread_mutex_destroy(a) pthread_mutex_destroy((a))
  ------------------
 1025|       |
 1026|  2.02k|  if (frame->locking && frame->lock_fd != -1) {
  ------------------
  |  Branch (1026:7): [True: 0, False: 2.02k]
  |  Branch (1026:25): [True: 0, False: 0]
  ------------------
 1027|       |#if defined(_WIN32)
 1028|       |    CloseHandle((HANDLE)frame->lock_fd);
 1029|       |#else
 1030|      0|    close((int)frame->lock_fd);
 1031|      0|#endif
 1032|      0|  }
 1033|       |
 1034|  2.02k|  if (frame->cframe != NULL && !frame->avoid_cframe_free) {
  ------------------
  |  Branch (1034:7): [True: 2.02k, False: 0]
  |  Branch (1034:32): [True: 70, False: 1.95k]
  ------------------
 1035|     70|    free(frame->cframe);
 1036|     70|  }
 1037|       |
 1038|  2.02k|  if (frame->coffsets != NULL && frame->coffsets_needs_free) {
  ------------------
  |  Branch (1038:7): [True: 0, False: 2.02k]
  |  Branch (1038:34): [True: 0, False: 0]
  ------------------
 1039|      0|    free(frame->coffsets);
 1040|      0|  }
 1041|       |
 1042|  2.02k|  if (frame->urlpath != NULL) {
  ------------------
  |  Branch (1042:7): [True: 0, False: 2.02k]
  ------------------
 1043|      0|    free(frame->urlpath);
 1044|      0|  }
 1045|  2.02k|  free(frame->holes);
 1046|       |
 1047|  2.02k|  free(frame);
 1048|       |
 1049|  2.02k|  return rc;
 1050|  2.02k|}
new_header_frame:
 1053|    820|void *new_header_frame(blosc2_schunk *schunk, blosc2_frame_s *frame) {
 1054|    820|  if (frame == NULL) {
  ------------------
  |  Branch (1054:7): [True: 0, False: 820]
  ------------------
 1055|      0|    return NULL;
 1056|      0|  }
 1057|    820|  uint8_t* h2 = calloc(FRAME_HEADER_MINLEN, 1);
  ------------------
  |  |   49|    820|#define FRAME_HEADER_MINLEN (FRAME_FILTER_PIPELINE + 1 + 16)  // 87 <- minimum length
  |  |  ------------------
  |  |  |  |   44|    820|#define FRAME_FILTER_PIPELINE (FRAME_HAS_VLMETALAYERS + 1 + 1) // 70
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|    820|#define FRAME_HAS_VLMETALAYERS (FRAME_NTHREADS_D + 2)  // 68
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|    820|#define FRAME_NTHREADS_D (FRAME_NTHREADS_C + 2 + 1)  // 66
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   41|    820|#define FRAME_NTHREADS_C (FRAME_CHUNKSIZE + 4 + 1)  // 63
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   40|    820|#define FRAME_CHUNKSIZE (FRAME_BLOCKSIZE + 4 + 1)  // 58
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   39|    820|#define FRAME_BLOCKSIZE (FRAME_TYPESIZE + 4 + 1)  // 53
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   38|    820|#define FRAME_TYPESIZE (FRAME_CBYTES + 8 + 1) // 48
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|    820|#define FRAME_CBYTES (FRAME_NBYTES + 8 + 1)  // 39
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   36|    820|#define FRAME_NBYTES (FRAME_FLAGS + 4 + 1)  // 30
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   32|    820|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   31|    820|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   30|    820|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   29|    820|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1058|    820|  uint8_t* h2p = h2;
 1059|       |
 1060|       |  // The msgpack header starts here
 1061|    820|  *h2p = 0x90;  // fixarray...
 1062|    820|  *h2p += 14;   // ...with 13 elements
 1063|    820|  h2p += 1;
 1064|       |
 1065|       |  // Magic number
 1066|    820|  *h2p = 0xa0 + 8;  // str with 8 elements
 1067|    820|  h2p += 1;
 1068|    820|  if (h2p - h2 >= FRAME_HEADER_MINLEN) {
  ------------------
  |  |   49|    820|#define FRAME_HEADER_MINLEN (FRAME_FILTER_PIPELINE + 1 + 16)  // 87 <- minimum length
  |  |  ------------------
  |  |  |  |   44|    820|#define FRAME_FILTER_PIPELINE (FRAME_HAS_VLMETALAYERS + 1 + 1) // 70
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|    820|#define FRAME_HAS_VLMETALAYERS (FRAME_NTHREADS_D + 2)  // 68
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|    820|#define FRAME_NTHREADS_D (FRAME_NTHREADS_C + 2 + 1)  // 66
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   41|    820|#define FRAME_NTHREADS_C (FRAME_CHUNKSIZE + 4 + 1)  // 63
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   40|    820|#define FRAME_CHUNKSIZE (FRAME_BLOCKSIZE + 4 + 1)  // 58
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   39|    820|#define FRAME_BLOCKSIZE (FRAME_TYPESIZE + 4 + 1)  // 53
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   38|    820|#define FRAME_TYPESIZE (FRAME_CBYTES + 8 + 1) // 48
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|    820|#define FRAME_CBYTES (FRAME_NBYTES + 8 + 1)  // 39
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   36|    820|#define FRAME_NBYTES (FRAME_FLAGS + 4 + 1)  // 30
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   32|    820|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   31|    820|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   30|    820|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   29|    820|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1068:7): [True: 0, False: 820]
  ------------------
 1069|      0|    return NULL;
 1070|      0|  }
 1071|    820|  strcpy((char*)h2p, "b2frame");
 1072|    820|  h2p += 8;
 1073|       |
 1074|       |  // Header size
 1075|    820|  *h2p = 0xd2;  // int32
 1076|    820|  h2p += 1 + 4;
 1077|    820|  if (h2p - h2 >= FRAME_HEADER_MINLEN) {
  ------------------
  |  |   49|    820|#define FRAME_HEADER_MINLEN (FRAME_FILTER_PIPELINE + 1 + 16)  // 87 <- minimum length
  |  |  ------------------
  |  |  |  |   44|    820|#define FRAME_FILTER_PIPELINE (FRAME_HAS_VLMETALAYERS + 1 + 1) // 70
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|    820|#define FRAME_HAS_VLMETALAYERS (FRAME_NTHREADS_D + 2)  // 68
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|    820|#define FRAME_NTHREADS_D (FRAME_NTHREADS_C + 2 + 1)  // 66
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   41|    820|#define FRAME_NTHREADS_C (FRAME_CHUNKSIZE + 4 + 1)  // 63
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   40|    820|#define FRAME_CHUNKSIZE (FRAME_BLOCKSIZE + 4 + 1)  // 58
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   39|    820|#define FRAME_BLOCKSIZE (FRAME_TYPESIZE + 4 + 1)  // 53
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   38|    820|#define FRAME_TYPESIZE (FRAME_CBYTES + 8 + 1) // 48
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|    820|#define FRAME_CBYTES (FRAME_NBYTES + 8 + 1)  // 39
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   36|    820|#define FRAME_NBYTES (FRAME_FLAGS + 4 + 1)  // 30
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   32|    820|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   31|    820|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   30|    820|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   29|    820|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1077:7): [True: 0, False: 820]
  ------------------
 1078|      0|    return NULL;
 1079|      0|  }
 1080|       |
 1081|       |  // Total frame size
 1082|    820|  *h2p = 0xcf;  // uint64
 1083|       |  // Fill it with frame->len which is known *after* the creation of the frame (e.g. when updating the header)
 1084|    820|  int64_t flen = frame->len;
 1085|    820|  to_big(h2 + FRAME_LEN, &flen, sizeof(flen));
  ------------------
  |  |   37|    820|#define to_big(dest, src, itemsize)       endian_handler(false, dest, src, itemsize)
  ------------------
 1086|    820|  h2p += 1 + 8;
 1087|    820|  if (h2p - h2 >= FRAME_HEADER_MINLEN) {
  ------------------
  |  |   49|    820|#define FRAME_HEADER_MINLEN (FRAME_FILTER_PIPELINE + 1 + 16)  // 87 <- minimum length
  |  |  ------------------
  |  |  |  |   44|    820|#define FRAME_FILTER_PIPELINE (FRAME_HAS_VLMETALAYERS + 1 + 1) // 70
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|    820|#define FRAME_HAS_VLMETALAYERS (FRAME_NTHREADS_D + 2)  // 68
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|    820|#define FRAME_NTHREADS_D (FRAME_NTHREADS_C + 2 + 1)  // 66
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   41|    820|#define FRAME_NTHREADS_C (FRAME_CHUNKSIZE + 4 + 1)  // 63
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   40|    820|#define FRAME_CHUNKSIZE (FRAME_BLOCKSIZE + 4 + 1)  // 58
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   39|    820|#define FRAME_BLOCKSIZE (FRAME_TYPESIZE + 4 + 1)  // 53
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   38|    820|#define FRAME_TYPESIZE (FRAME_CBYTES + 8 + 1) // 48
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|    820|#define FRAME_CBYTES (FRAME_NBYTES + 8 + 1)  // 39
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   36|    820|#define FRAME_NBYTES (FRAME_FLAGS + 4 + 1)  // 30
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   32|    820|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   31|    820|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   30|    820|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   29|    820|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1087:7): [True: 0, False: 820]
  ------------------
 1088|      0|    return NULL;
 1089|      0|  }
 1090|       |
 1091|       |  // Flags
 1092|    820|  *h2p = 0xa0 + 4;  // str with 4 elements
 1093|    820|  h2p += 1;
 1094|    820|  if (h2p - h2 >= FRAME_HEADER_MINLEN) {
  ------------------
  |  |   49|    820|#define FRAME_HEADER_MINLEN (FRAME_FILTER_PIPELINE + 1 + 16)  // 87 <- minimum length
  |  |  ------------------
  |  |  |  |   44|    820|#define FRAME_FILTER_PIPELINE (FRAME_HAS_VLMETALAYERS + 1 + 1) // 70
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|    820|#define FRAME_HAS_VLMETALAYERS (FRAME_NTHREADS_D + 2)  // 68
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|    820|#define FRAME_NTHREADS_D (FRAME_NTHREADS_C + 2 + 1)  // 66
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   41|    820|#define FRAME_NTHREADS_C (FRAME_CHUNKSIZE + 4 + 1)  // 63
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   40|    820|#define FRAME_CHUNKSIZE (FRAME_BLOCKSIZE + 4 + 1)  // 58
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   39|    820|#define FRAME_BLOCKSIZE (FRAME_TYPESIZE + 4 + 1)  // 53
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   38|    820|#define FRAME_TYPESIZE (FRAME_CBYTES + 8 + 1) // 48
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|    820|#define FRAME_CBYTES (FRAME_NBYTES + 8 + 1)  // 39
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   36|    820|#define FRAME_NBYTES (FRAME_FLAGS + 4 + 1)  // 30
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   32|    820|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   31|    820|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   30|    820|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   29|    820|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1094:7): [True: 0, False: 820]
  ------------------
 1095|      0|    return NULL;
 1096|      0|  }
 1097|       |  // General flags
 1098|    820|  if (schunk->chunksize == 0 || (schunk->flags2 & BLOSC2_VL_BLOCKS)) {
  ------------------
  |  Branch (1098:7): [True: 0, False: 820]
  |  Branch (1098:33): [True: 0, False: 820]
  ------------------
 1099|      0|    *h2p = BLOSC2_VERSION_FRAME_FORMAT_VL_BLOCKS;  // version
 1100|      0|  }
 1101|    820|  else {
 1102|    820|    *h2p = BLOSC2_VERSION_FRAME_FORMAT_RC1;  // version
 1103|    820|  }
 1104|    820|  *h2p += 0x10;  // 64-bit offsets.  We only support this for now.
 1105|    820|  if (schunk->chunksize == 0) {
  ------------------
  |  Branch (1105:7): [True: 0, False: 820]
  ------------------
 1106|      0|    *h2p |= FRAME_VARIABLE_CHUNKS;
  ------------------
  |  |   26|      0|#define FRAME_VARIABLE_CHUNKS (1U << 6)
  ------------------
 1107|      0|  }
 1108|    820|  if (schunk->flags2 & BLOSC2_VL_BLOCKS) {
  ------------------
  |  Branch (1108:7): [True: 0, False: 820]
  ------------------
 1109|      0|    *h2p |= FRAME_VL_BLOCKS;
  ------------------
  |  |   27|      0|#define FRAME_VL_BLOCKS (1U << 7)
  ------------------
 1110|      0|  }
 1111|    820|  h2p += 1;
 1112|    820|  if (h2p - h2 >= FRAME_HEADER_MINLEN) {
  ------------------
  |  |   49|    820|#define FRAME_HEADER_MINLEN (FRAME_FILTER_PIPELINE + 1 + 16)  // 87 <- minimum length
  |  |  ------------------
  |  |  |  |   44|    820|#define FRAME_FILTER_PIPELINE (FRAME_HAS_VLMETALAYERS + 1 + 1) // 70
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|    820|#define FRAME_HAS_VLMETALAYERS (FRAME_NTHREADS_D + 2)  // 68
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|    820|#define FRAME_NTHREADS_D (FRAME_NTHREADS_C + 2 + 1)  // 66
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   41|    820|#define FRAME_NTHREADS_C (FRAME_CHUNKSIZE + 4 + 1)  // 63
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   40|    820|#define FRAME_CHUNKSIZE (FRAME_BLOCKSIZE + 4 + 1)  // 58
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   39|    820|#define FRAME_BLOCKSIZE (FRAME_TYPESIZE + 4 + 1)  // 53
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   38|    820|#define FRAME_TYPESIZE (FRAME_CBYTES + 8 + 1) // 48
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|    820|#define FRAME_CBYTES (FRAME_NBYTES + 8 + 1)  // 39
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   36|    820|#define FRAME_NBYTES (FRAME_FLAGS + 4 + 1)  // 30
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   32|    820|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   31|    820|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   30|    820|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   29|    820|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1112:7): [True: 0, False: 820]
  ------------------
 1113|      0|    return NULL;
 1114|      0|  }
 1115|       |
 1116|       |  // Frame type
 1117|       |  // We only support contiguous and sparse directories frames currently
 1118|    820|  *h2p = frame->sframe ? 1 : 0;
  ------------------
  |  Branch (1118:10): [True: 0, False: 820]
  ------------------
 1119|    820|  h2p += 1;
 1120|    820|  if (h2p - h2 >= FRAME_HEADER_MINLEN) {
  ------------------
  |  |   49|    820|#define FRAME_HEADER_MINLEN (FRAME_FILTER_PIPELINE + 1 + 16)  // 87 <- minimum length
  |  |  ------------------
  |  |  |  |   44|    820|#define FRAME_FILTER_PIPELINE (FRAME_HAS_VLMETALAYERS + 1 + 1) // 70
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|    820|#define FRAME_HAS_VLMETALAYERS (FRAME_NTHREADS_D + 2)  // 68
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|    820|#define FRAME_NTHREADS_D (FRAME_NTHREADS_C + 2 + 1)  // 66
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   41|    820|#define FRAME_NTHREADS_C (FRAME_CHUNKSIZE + 4 + 1)  // 63
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   40|    820|#define FRAME_CHUNKSIZE (FRAME_BLOCKSIZE + 4 + 1)  // 58
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   39|    820|#define FRAME_BLOCKSIZE (FRAME_TYPESIZE + 4 + 1)  // 53
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   38|    820|#define FRAME_TYPESIZE (FRAME_CBYTES + 8 + 1) // 48
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|    820|#define FRAME_CBYTES (FRAME_NBYTES + 8 + 1)  // 39
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   36|    820|#define FRAME_NBYTES (FRAME_FLAGS + 4 + 1)  // 30
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   32|    820|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   31|    820|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   30|    820|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   29|    820|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1120:7): [True: 0, False: 820]
  ------------------
 1121|      0|    return NULL;
 1122|      0|  }
 1123|       |
 1124|       |  // Codec flags
 1125|    820|  *h2p = schunk->compcode;
 1126|    820|  if (schunk->compcode >= BLOSC_LAST_CODEC) {
  ------------------
  |  Branch (1126:7): [True: 223, False: 597]
  ------------------
 1127|    223|    *h2p = BLOSC_UDCODEC_FORMAT;
 1128|    223|  }
 1129|    820|  *h2p += (schunk->clevel) << 4u;  // clevel
 1130|    820|  h2p += 1;
 1131|    820|  if (h2p - h2 >= FRAME_HEADER_MINLEN) {
  ------------------
  |  |   49|    820|#define FRAME_HEADER_MINLEN (FRAME_FILTER_PIPELINE + 1 + 16)  // 87 <- minimum length
  |  |  ------------------
  |  |  |  |   44|    820|#define FRAME_FILTER_PIPELINE (FRAME_HAS_VLMETALAYERS + 1 + 1) // 70
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|    820|#define FRAME_HAS_VLMETALAYERS (FRAME_NTHREADS_D + 2)  // 68
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|    820|#define FRAME_NTHREADS_D (FRAME_NTHREADS_C + 2 + 1)  // 66
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   41|    820|#define FRAME_NTHREADS_C (FRAME_CHUNKSIZE + 4 + 1)  // 63
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   40|    820|#define FRAME_CHUNKSIZE (FRAME_BLOCKSIZE + 4 + 1)  // 58
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   39|    820|#define FRAME_BLOCKSIZE (FRAME_TYPESIZE + 4 + 1)  // 53
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   38|    820|#define FRAME_TYPESIZE (FRAME_CBYTES + 8 + 1) // 48
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|    820|#define FRAME_CBYTES (FRAME_NBYTES + 8 + 1)  // 39
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   36|    820|#define FRAME_NBYTES (FRAME_FLAGS + 4 + 1)  // 30
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   32|    820|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   31|    820|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   30|    820|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   29|    820|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1131:7): [True: 0, False: 820]
  ------------------
 1132|      0|    return NULL;
 1133|      0|  }
 1134|       |
 1135|       |  // Other flags
 1136|    820|  *h2p = schunk->splitmode - 1;
 1137|    820|  h2p += 1;
 1138|    820|  if (h2p - h2 >= FRAME_HEADER_MINLEN) {
  ------------------
  |  |   49|    820|#define FRAME_HEADER_MINLEN (FRAME_FILTER_PIPELINE + 1 + 16)  // 87 <- minimum length
  |  |  ------------------
  |  |  |  |   44|    820|#define FRAME_FILTER_PIPELINE (FRAME_HAS_VLMETALAYERS + 1 + 1) // 70
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|    820|#define FRAME_HAS_VLMETALAYERS (FRAME_NTHREADS_D + 2)  // 68
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|    820|#define FRAME_NTHREADS_D (FRAME_NTHREADS_C + 2 + 1)  // 66
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   41|    820|#define FRAME_NTHREADS_C (FRAME_CHUNKSIZE + 4 + 1)  // 63
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   40|    820|#define FRAME_CHUNKSIZE (FRAME_BLOCKSIZE + 4 + 1)  // 58
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   39|    820|#define FRAME_BLOCKSIZE (FRAME_TYPESIZE + 4 + 1)  // 53
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   38|    820|#define FRAME_TYPESIZE (FRAME_CBYTES + 8 + 1) // 48
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|    820|#define FRAME_CBYTES (FRAME_NBYTES + 8 + 1)  // 39
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   36|    820|#define FRAME_NBYTES (FRAME_FLAGS + 4 + 1)  // 30
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   32|    820|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   31|    820|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   30|    820|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   29|    820|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1138:7): [True: 0, False: 820]
  ------------------
 1139|      0|    return NULL;
 1140|      0|  }
 1141|       |
 1142|       |  // Uncompressed size
 1143|    820|  *h2p = 0xd3;  // int64
 1144|    820|  h2p += 1;
 1145|    820|  int64_t nbytes = schunk->nbytes;
 1146|    820|  to_big(h2p, &nbytes, sizeof(nbytes));
  ------------------
  |  |   37|    820|#define to_big(dest, src, itemsize)       endian_handler(false, dest, src, itemsize)
  ------------------
 1147|    820|  h2p += 8;
 1148|    820|  if (h2p - h2 >= FRAME_HEADER_MINLEN) {
  ------------------
  |  |   49|    820|#define FRAME_HEADER_MINLEN (FRAME_FILTER_PIPELINE + 1 + 16)  // 87 <- minimum length
  |  |  ------------------
  |  |  |  |   44|    820|#define FRAME_FILTER_PIPELINE (FRAME_HAS_VLMETALAYERS + 1 + 1) // 70
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|    820|#define FRAME_HAS_VLMETALAYERS (FRAME_NTHREADS_D + 2)  // 68
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|    820|#define FRAME_NTHREADS_D (FRAME_NTHREADS_C + 2 + 1)  // 66
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   41|    820|#define FRAME_NTHREADS_C (FRAME_CHUNKSIZE + 4 + 1)  // 63
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   40|    820|#define FRAME_CHUNKSIZE (FRAME_BLOCKSIZE + 4 + 1)  // 58
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   39|    820|#define FRAME_BLOCKSIZE (FRAME_TYPESIZE + 4 + 1)  // 53
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   38|    820|#define FRAME_TYPESIZE (FRAME_CBYTES + 8 + 1) // 48
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|    820|#define FRAME_CBYTES (FRAME_NBYTES + 8 + 1)  // 39
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   36|    820|#define FRAME_NBYTES (FRAME_FLAGS + 4 + 1)  // 30
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   32|    820|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   31|    820|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   30|    820|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   29|    820|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1148:7): [True: 0, False: 820]
  ------------------
 1149|      0|    return NULL;
 1150|      0|  }
 1151|       |
 1152|       |  // Compressed size
 1153|    820|  *h2p = 0xd3;  // int64
 1154|    820|  h2p += 1;
 1155|    820|  int64_t cbytes = schunk->cbytes;
 1156|    820|  to_big(h2p, &cbytes, sizeof(cbytes));
  ------------------
  |  |   37|    820|#define to_big(dest, src, itemsize)       endian_handler(false, dest, src, itemsize)
  ------------------
 1157|    820|  h2p += 8;
 1158|    820|  if (h2p - h2 >= FRAME_HEADER_MINLEN) {
  ------------------
  |  |   49|    820|#define FRAME_HEADER_MINLEN (FRAME_FILTER_PIPELINE + 1 + 16)  // 87 <- minimum length
  |  |  ------------------
  |  |  |  |   44|    820|#define FRAME_FILTER_PIPELINE (FRAME_HAS_VLMETALAYERS + 1 + 1) // 70
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|    820|#define FRAME_HAS_VLMETALAYERS (FRAME_NTHREADS_D + 2)  // 68
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|    820|#define FRAME_NTHREADS_D (FRAME_NTHREADS_C + 2 + 1)  // 66
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   41|    820|#define FRAME_NTHREADS_C (FRAME_CHUNKSIZE + 4 + 1)  // 63
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   40|    820|#define FRAME_CHUNKSIZE (FRAME_BLOCKSIZE + 4 + 1)  // 58
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   39|    820|#define FRAME_BLOCKSIZE (FRAME_TYPESIZE + 4 + 1)  // 53
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   38|    820|#define FRAME_TYPESIZE (FRAME_CBYTES + 8 + 1) // 48
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|    820|#define FRAME_CBYTES (FRAME_NBYTES + 8 + 1)  // 39
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   36|    820|#define FRAME_NBYTES (FRAME_FLAGS + 4 + 1)  // 30
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   32|    820|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   31|    820|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   30|    820|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   29|    820|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1158:7): [True: 0, False: 820]
  ------------------
 1159|      0|    return NULL;
 1160|      0|  }
 1161|       |
 1162|       |  // Type size
 1163|    820|  *h2p = 0xd2;  // int32
 1164|    820|  h2p += 1;
 1165|    820|  int32_t typesize = schunk->typesize;
 1166|    820|  to_big(h2p, &typesize, sizeof(typesize));
  ------------------
  |  |   37|    820|#define to_big(dest, src, itemsize)       endian_handler(false, dest, src, itemsize)
  ------------------
 1167|    820|  h2p += 4;
 1168|    820|  if (h2p - h2 >= FRAME_HEADER_MINLEN) {
  ------------------
  |  |   49|    820|#define FRAME_HEADER_MINLEN (FRAME_FILTER_PIPELINE + 1 + 16)  // 87 <- minimum length
  |  |  ------------------
  |  |  |  |   44|    820|#define FRAME_FILTER_PIPELINE (FRAME_HAS_VLMETALAYERS + 1 + 1) // 70
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|    820|#define FRAME_HAS_VLMETALAYERS (FRAME_NTHREADS_D + 2)  // 68
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|    820|#define FRAME_NTHREADS_D (FRAME_NTHREADS_C + 2 + 1)  // 66
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   41|    820|#define FRAME_NTHREADS_C (FRAME_CHUNKSIZE + 4 + 1)  // 63
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   40|    820|#define FRAME_CHUNKSIZE (FRAME_BLOCKSIZE + 4 + 1)  // 58
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   39|    820|#define FRAME_BLOCKSIZE (FRAME_TYPESIZE + 4 + 1)  // 53
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   38|    820|#define FRAME_TYPESIZE (FRAME_CBYTES + 8 + 1) // 48
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|    820|#define FRAME_CBYTES (FRAME_NBYTES + 8 + 1)  // 39
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   36|    820|#define FRAME_NBYTES (FRAME_FLAGS + 4 + 1)  // 30
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   32|    820|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   31|    820|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   30|    820|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   29|    820|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1168:7): [True: 0, False: 820]
  ------------------
 1169|      0|    return NULL;
 1170|      0|  }
 1171|       |
 1172|       |  // Block size
 1173|    820|  *h2p = 0xd2;  // int32
 1174|    820|  h2p += 1;
 1175|    820|  int32_t blocksize = schunk->blocksize;
 1176|    820|  to_big(h2p, &blocksize, sizeof(blocksize));
  ------------------
  |  |   37|    820|#define to_big(dest, src, itemsize)       endian_handler(false, dest, src, itemsize)
  ------------------
 1177|    820|  h2p += 4;
 1178|    820|  if (h2p - h2 >= FRAME_HEADER_MINLEN) {
  ------------------
  |  |   49|    820|#define FRAME_HEADER_MINLEN (FRAME_FILTER_PIPELINE + 1 + 16)  // 87 <- minimum length
  |  |  ------------------
  |  |  |  |   44|    820|#define FRAME_FILTER_PIPELINE (FRAME_HAS_VLMETALAYERS + 1 + 1) // 70
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|    820|#define FRAME_HAS_VLMETALAYERS (FRAME_NTHREADS_D + 2)  // 68
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|    820|#define FRAME_NTHREADS_D (FRAME_NTHREADS_C + 2 + 1)  // 66
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   41|    820|#define FRAME_NTHREADS_C (FRAME_CHUNKSIZE + 4 + 1)  // 63
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   40|    820|#define FRAME_CHUNKSIZE (FRAME_BLOCKSIZE + 4 + 1)  // 58
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   39|    820|#define FRAME_BLOCKSIZE (FRAME_TYPESIZE + 4 + 1)  // 53
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   38|    820|#define FRAME_TYPESIZE (FRAME_CBYTES + 8 + 1) // 48
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|    820|#define FRAME_CBYTES (FRAME_NBYTES + 8 + 1)  // 39
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   36|    820|#define FRAME_NBYTES (FRAME_FLAGS + 4 + 1)  // 30
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   32|    820|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   31|    820|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   30|    820|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   29|    820|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1178:7): [True: 0, False: 820]
  ------------------
 1179|      0|    return NULL;
 1180|      0|  }
 1181|       |
 1182|       |  // Chunk size
 1183|    820|  *h2p = 0xd2;  // int32
 1184|    820|  h2p += 1;
 1185|    820|  int32_t chunksize = schunk->chunksize;
 1186|    820|  to_big(h2p, &chunksize, sizeof(chunksize));
  ------------------
  |  |   37|    820|#define to_big(dest, src, itemsize)       endian_handler(false, dest, src, itemsize)
  ------------------
 1187|    820|  h2p += 4;
 1188|    820|  if (h2p - h2 >= FRAME_HEADER_MINLEN) {
  ------------------
  |  |   49|    820|#define FRAME_HEADER_MINLEN (FRAME_FILTER_PIPELINE + 1 + 16)  // 87 <- minimum length
  |  |  ------------------
  |  |  |  |   44|    820|#define FRAME_FILTER_PIPELINE (FRAME_HAS_VLMETALAYERS + 1 + 1) // 70
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|    820|#define FRAME_HAS_VLMETALAYERS (FRAME_NTHREADS_D + 2)  // 68
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|    820|#define FRAME_NTHREADS_D (FRAME_NTHREADS_C + 2 + 1)  // 66
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   41|    820|#define FRAME_NTHREADS_C (FRAME_CHUNKSIZE + 4 + 1)  // 63
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   40|    820|#define FRAME_CHUNKSIZE (FRAME_BLOCKSIZE + 4 + 1)  // 58
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   39|    820|#define FRAME_BLOCKSIZE (FRAME_TYPESIZE + 4 + 1)  // 53
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   38|    820|#define FRAME_TYPESIZE (FRAME_CBYTES + 8 + 1) // 48
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|    820|#define FRAME_CBYTES (FRAME_NBYTES + 8 + 1)  // 39
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   36|    820|#define FRAME_NBYTES (FRAME_FLAGS + 4 + 1)  // 30
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   32|    820|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   31|    820|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   30|    820|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   29|    820|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1188:7): [True: 0, False: 820]
  ------------------
 1189|      0|    return NULL;
 1190|      0|  }
 1191|       |
 1192|       |  // Number of threads for compression
 1193|    820|  *h2p = 0xd1;  // int16
 1194|    820|  h2p += 1;
 1195|    820|  int16_t nthreads = (int16_t)schunk->cctx->nthreads;
 1196|    820|  to_big(h2p, &nthreads, sizeof(nthreads));
  ------------------
  |  |   37|    820|#define to_big(dest, src, itemsize)       endian_handler(false, dest, src, itemsize)
  ------------------
 1197|    820|  h2p += 2;
 1198|    820|  if (h2p - h2 >= FRAME_HEADER_MINLEN) {
  ------------------
  |  |   49|    820|#define FRAME_HEADER_MINLEN (FRAME_FILTER_PIPELINE + 1 + 16)  // 87 <- minimum length
  |  |  ------------------
  |  |  |  |   44|    820|#define FRAME_FILTER_PIPELINE (FRAME_HAS_VLMETALAYERS + 1 + 1) // 70
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|    820|#define FRAME_HAS_VLMETALAYERS (FRAME_NTHREADS_D + 2)  // 68
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|    820|#define FRAME_NTHREADS_D (FRAME_NTHREADS_C + 2 + 1)  // 66
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   41|    820|#define FRAME_NTHREADS_C (FRAME_CHUNKSIZE + 4 + 1)  // 63
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   40|    820|#define FRAME_CHUNKSIZE (FRAME_BLOCKSIZE + 4 + 1)  // 58
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   39|    820|#define FRAME_BLOCKSIZE (FRAME_TYPESIZE + 4 + 1)  // 53
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   38|    820|#define FRAME_TYPESIZE (FRAME_CBYTES + 8 + 1) // 48
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|    820|#define FRAME_CBYTES (FRAME_NBYTES + 8 + 1)  // 39
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   36|    820|#define FRAME_NBYTES (FRAME_FLAGS + 4 + 1)  // 30
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   32|    820|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   31|    820|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   30|    820|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   29|    820|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1198:7): [True: 0, False: 820]
  ------------------
 1199|      0|    return NULL;
 1200|      0|  }
 1201|       |
 1202|       |  // Number of threads for decompression
 1203|    820|  *h2p = 0xd1;  // int16
 1204|    820|  h2p += 1;
 1205|    820|  nthreads = (int16_t)schunk->dctx->nthreads;
 1206|    820|  to_big(h2p, &nthreads, sizeof(nthreads));
  ------------------
  |  |   37|    820|#define to_big(dest, src, itemsize)       endian_handler(false, dest, src, itemsize)
  ------------------
 1207|    820|  h2p += 2;
 1208|    820|  if (h2p - h2 >= FRAME_HEADER_MINLEN) {
  ------------------
  |  |   49|    820|#define FRAME_HEADER_MINLEN (FRAME_FILTER_PIPELINE + 1 + 16)  // 87 <- minimum length
  |  |  ------------------
  |  |  |  |   44|    820|#define FRAME_FILTER_PIPELINE (FRAME_HAS_VLMETALAYERS + 1 + 1) // 70
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|    820|#define FRAME_HAS_VLMETALAYERS (FRAME_NTHREADS_D + 2)  // 68
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|    820|#define FRAME_NTHREADS_D (FRAME_NTHREADS_C + 2 + 1)  // 66
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   41|    820|#define FRAME_NTHREADS_C (FRAME_CHUNKSIZE + 4 + 1)  // 63
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   40|    820|#define FRAME_CHUNKSIZE (FRAME_BLOCKSIZE + 4 + 1)  // 58
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   39|    820|#define FRAME_BLOCKSIZE (FRAME_TYPESIZE + 4 + 1)  // 53
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   38|    820|#define FRAME_TYPESIZE (FRAME_CBYTES + 8 + 1) // 48
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|    820|#define FRAME_CBYTES (FRAME_NBYTES + 8 + 1)  // 39
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   36|    820|#define FRAME_NBYTES (FRAME_FLAGS + 4 + 1)  // 30
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   32|    820|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   31|    820|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   30|    820|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   29|    820|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1208:7): [True: 0, False: 820]
  ------------------
 1209|      0|    return NULL;
 1210|      0|  }
 1211|       |
 1212|       |  // The boolean for variable-length metalayers
 1213|    820|  *h2p = (schunk->nvlmetalayers > 0) ? (uint8_t)0xc3 : (uint8_t)0xc2;
  ------------------
  |  Branch (1213:10): [True: 0, False: 820]
  ------------------
 1214|    820|  h2p += 1;
 1215|    820|  if (h2p - h2 >= FRAME_HEADER_MINLEN) {
  ------------------
  |  |   49|    820|#define FRAME_HEADER_MINLEN (FRAME_FILTER_PIPELINE + 1 + 16)  // 87 <- minimum length
  |  |  ------------------
  |  |  |  |   44|    820|#define FRAME_FILTER_PIPELINE (FRAME_HAS_VLMETALAYERS + 1 + 1) // 70
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|    820|#define FRAME_HAS_VLMETALAYERS (FRAME_NTHREADS_D + 2)  // 68
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|    820|#define FRAME_NTHREADS_D (FRAME_NTHREADS_C + 2 + 1)  // 66
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   41|    820|#define FRAME_NTHREADS_C (FRAME_CHUNKSIZE + 4 + 1)  // 63
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   40|    820|#define FRAME_CHUNKSIZE (FRAME_BLOCKSIZE + 4 + 1)  // 58
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   39|    820|#define FRAME_BLOCKSIZE (FRAME_TYPESIZE + 4 + 1)  // 53
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   38|    820|#define FRAME_TYPESIZE (FRAME_CBYTES + 8 + 1) // 48
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|    820|#define FRAME_CBYTES (FRAME_NBYTES + 8 + 1)  // 39
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   36|    820|#define FRAME_NBYTES (FRAME_FLAGS + 4 + 1)  // 30
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   32|    820|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   31|    820|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   30|    820|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   29|    820|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1215:7): [True: 0, False: 820]
  ------------------
 1216|      0|    return NULL;
 1217|      0|  }
 1218|       |
 1219|       |  // The space for FRAME_FILTER_PIPELINE
 1220|    820|  *h2p = 0xd8;  //  fixext 16
 1221|    820|  h2p += 1;
 1222|    820|  if (BLOSC2_MAX_FILTERS > FRAME_FILTER_PIPELINE_MAX) {
  ------------------
  |  |   53|    820|#define FRAME_FILTER_PIPELINE_MAX (8)  // the maximum number of filters that can be stored in header
  ------------------
  |  Branch (1222:7): [Folded, False: 820]
  ------------------
 1223|      0|    return NULL;
 1224|      0|  }
 1225|       |  // Store the filter pipeline in header
 1226|    820|  uint8_t* mp_filters = h2 + FRAME_FILTER_PIPELINE + 1;
  ------------------
  |  |   44|    820|#define FRAME_FILTER_PIPELINE (FRAME_HAS_VLMETALAYERS + 1 + 1) // 70
  |  |  ------------------
  |  |  |  |   43|    820|#define FRAME_HAS_VLMETALAYERS (FRAME_NTHREADS_D + 2)  // 68
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|    820|#define FRAME_NTHREADS_D (FRAME_NTHREADS_C + 2 + 1)  // 66
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   41|    820|#define FRAME_NTHREADS_C (FRAME_CHUNKSIZE + 4 + 1)  // 63
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   40|    820|#define FRAME_CHUNKSIZE (FRAME_BLOCKSIZE + 4 + 1)  // 58
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   39|    820|#define FRAME_BLOCKSIZE (FRAME_TYPESIZE + 4 + 1)  // 53
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   38|    820|#define FRAME_TYPESIZE (FRAME_CBYTES + 8 + 1) // 48
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|    820|#define FRAME_CBYTES (FRAME_NBYTES + 8 + 1)  // 39
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   36|    820|#define FRAME_NBYTES (FRAME_FLAGS + 4 + 1)  // 30
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   32|    820|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   31|    820|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   30|    820|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   29|    820|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1227|    820|  uint8_t* mp_meta = h2 + FRAME_FILTER_PIPELINE + 1 + FRAME_FILTER_PIPELINE_MAX;
  ------------------
  |  |   44|    820|#define FRAME_FILTER_PIPELINE (FRAME_HAS_VLMETALAYERS + 1 + 1) // 70
  |  |  ------------------
  |  |  |  |   43|    820|#define FRAME_HAS_VLMETALAYERS (FRAME_NTHREADS_D + 2)  // 68
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|    820|#define FRAME_NTHREADS_D (FRAME_NTHREADS_C + 2 + 1)  // 66
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   41|    820|#define FRAME_NTHREADS_C (FRAME_CHUNKSIZE + 4 + 1)  // 63
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   40|    820|#define FRAME_CHUNKSIZE (FRAME_BLOCKSIZE + 4 + 1)  // 58
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   39|    820|#define FRAME_BLOCKSIZE (FRAME_TYPESIZE + 4 + 1)  // 53
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   38|    820|#define FRAME_TYPESIZE (FRAME_CBYTES + 8 + 1) // 48
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|    820|#define FRAME_CBYTES (FRAME_NBYTES + 8 + 1)  // 39
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   36|    820|#define FRAME_NBYTES (FRAME_FLAGS + 4 + 1)  // 30
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   32|    820|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   31|    820|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   30|    820|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   29|    820|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                uint8_t* mp_meta = h2 + FRAME_FILTER_PIPELINE + 1 + FRAME_FILTER_PIPELINE_MAX;
  ------------------
  |  |   53|    820|#define FRAME_FILTER_PIPELINE_MAX (8)  // the maximum number of filters that can be stored in header
  ------------------
 1228|  5.74k|  for (int i = 0; i < BLOSC2_MAX_FILTERS; i++) {
  ------------------
  |  Branch (1228:19): [True: 4.92k, False: 820]
  ------------------
 1229|  4.92k|      mp_filters[i] = schunk->filters[i];
 1230|  4.92k|      mp_meta[i] = schunk->filters_meta[i];
 1231|  4.92k|  }
 1232|    820|  *h2p = (uint8_t) BLOSC2_MAX_FILTERS;
 1233|    820|  h2p += 1;
 1234|    820|  h2p += 16;
 1235|       |
 1236|       |  // User-defined codec and codec metadata
 1237|    820|  uint8_t* udcodec = h2 + FRAME_UDCODEC;
  ------------------
  |  |   45|    820|#define FRAME_UDCODEC (FRAME_FILTER_PIPELINE + 1 + 6) // 77
  |  |  ------------------
  |  |  |  |   44|    820|#define FRAME_FILTER_PIPELINE (FRAME_HAS_VLMETALAYERS + 1 + 1) // 70
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|    820|#define FRAME_HAS_VLMETALAYERS (FRAME_NTHREADS_D + 2)  // 68
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|    820|#define FRAME_NTHREADS_D (FRAME_NTHREADS_C + 2 + 1)  // 66
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   41|    820|#define FRAME_NTHREADS_C (FRAME_CHUNKSIZE + 4 + 1)  // 63
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   40|    820|#define FRAME_CHUNKSIZE (FRAME_BLOCKSIZE + 4 + 1)  // 58
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   39|    820|#define FRAME_BLOCKSIZE (FRAME_TYPESIZE + 4 + 1)  // 53
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   38|    820|#define FRAME_TYPESIZE (FRAME_CBYTES + 8 + 1) // 48
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|    820|#define FRAME_CBYTES (FRAME_NBYTES + 8 + 1)  // 39
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   36|    820|#define FRAME_NBYTES (FRAME_FLAGS + 4 + 1)  // 30
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   32|    820|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   31|    820|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   30|    820|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   29|    820|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1238|    820|  *udcodec = schunk->compcode;
 1239|    820|  uint8_t* codec_meta = h2 + FRAME_CODEC_META;
  ------------------
  |  |   46|    820|#define FRAME_CODEC_META (FRAME_FILTER_PIPELINE + 1 + 7) // 78
  |  |  ------------------
  |  |  |  |   44|    820|#define FRAME_FILTER_PIPELINE (FRAME_HAS_VLMETALAYERS + 1 + 1) // 70
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|    820|#define FRAME_HAS_VLMETALAYERS (FRAME_NTHREADS_D + 2)  // 68
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|    820|#define FRAME_NTHREADS_D (FRAME_NTHREADS_C + 2 + 1)  // 66
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   41|    820|#define FRAME_NTHREADS_C (FRAME_CHUNKSIZE + 4 + 1)  // 63
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   40|    820|#define FRAME_CHUNKSIZE (FRAME_BLOCKSIZE + 4 + 1)  // 58
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   39|    820|#define FRAME_BLOCKSIZE (FRAME_TYPESIZE + 4 + 1)  // 53
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   38|    820|#define FRAME_TYPESIZE (FRAME_CBYTES + 8 + 1) // 48
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|    820|#define FRAME_CBYTES (FRAME_NBYTES + 8 + 1)  // 39
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   36|    820|#define FRAME_NBYTES (FRAME_FLAGS + 4 + 1)  // 30
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   32|    820|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   31|    820|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   30|    820|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   29|    820|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1240|    820|  *codec_meta = schunk->compcode_meta;
 1241|       |
 1242|       |  // Other flags 2 (byte 0x55): bit 0 = use_dict
 1243|    820|  h2[FRAME_OTHER_FLAGS2] = schunk->use_dict ? FRAME_USE_DICT : 0;
  ------------------
  |  |   47|    820|#define FRAME_OTHER_FLAGS2 (FRAME_FILTER_PIPELINE + 1 + 14)  // 85
  |  |  ------------------
  |  |  |  |   44|    820|#define FRAME_FILTER_PIPELINE (FRAME_HAS_VLMETALAYERS + 1 + 1) // 70
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|    820|#define FRAME_HAS_VLMETALAYERS (FRAME_NTHREADS_D + 2)  // 68
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|    820|#define FRAME_NTHREADS_D (FRAME_NTHREADS_C + 2 + 1)  // 66
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   41|    820|#define FRAME_NTHREADS_C (FRAME_CHUNKSIZE + 4 + 1)  // 63
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   40|    820|#define FRAME_CHUNKSIZE (FRAME_BLOCKSIZE + 4 + 1)  // 58
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   39|    820|#define FRAME_BLOCKSIZE (FRAME_TYPESIZE + 4 + 1)  // 53
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   38|    820|#define FRAME_TYPESIZE (FRAME_CBYTES + 8 + 1) // 48
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|    820|#define FRAME_CBYTES (FRAME_NBYTES + 8 + 1)  // 39
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   36|    820|#define FRAME_NBYTES (FRAME_FLAGS + 4 + 1)  // 30
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   32|    820|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   31|    820|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   30|    820|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   29|    820|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                h2[FRAME_OTHER_FLAGS2] = schunk->use_dict ? FRAME_USE_DICT : 0;
  ------------------
  |  |   48|      0|#define FRAME_USE_DICT (1U << 0)   //!< bit 0 of other_flags2: use dictionary compression
  ------------------
  |  Branch (1243:28): [True: 0, False: 820]
  ------------------
 1244|       |
 1245|    820|  if (h2p - h2 != FRAME_HEADER_MINLEN) {
  ------------------
  |  |   49|    820|#define FRAME_HEADER_MINLEN (FRAME_FILTER_PIPELINE + 1 + 16)  // 87 <- minimum length
  |  |  ------------------
  |  |  |  |   44|    820|#define FRAME_FILTER_PIPELINE (FRAME_HAS_VLMETALAYERS + 1 + 1) // 70
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|    820|#define FRAME_HAS_VLMETALAYERS (FRAME_NTHREADS_D + 2)  // 68
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|    820|#define FRAME_NTHREADS_D (FRAME_NTHREADS_C + 2 + 1)  // 66
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   41|    820|#define FRAME_NTHREADS_C (FRAME_CHUNKSIZE + 4 + 1)  // 63
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   40|    820|#define FRAME_CHUNKSIZE (FRAME_BLOCKSIZE + 4 + 1)  // 58
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   39|    820|#define FRAME_BLOCKSIZE (FRAME_TYPESIZE + 4 + 1)  // 53
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   38|    820|#define FRAME_TYPESIZE (FRAME_CBYTES + 8 + 1) // 48
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|    820|#define FRAME_CBYTES (FRAME_NBYTES + 8 + 1)  // 39
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   36|    820|#define FRAME_NBYTES (FRAME_FLAGS + 4 + 1)  // 30
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   32|    820|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   31|    820|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   30|    820|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   29|    820|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1245:7): [True: 0, False: 820]
  ------------------
 1246|      0|    return NULL;
 1247|      0|  }
 1248|       |
 1249|    820|  int32_t hsize = FRAME_HEADER_MINLEN;
  ------------------
  |  |   49|    820|#define FRAME_HEADER_MINLEN (FRAME_FILTER_PIPELINE + 1 + 16)  // 87 <- minimum length
  |  |  ------------------
  |  |  |  |   44|    820|#define FRAME_FILTER_PIPELINE (FRAME_HAS_VLMETALAYERS + 1 + 1) // 70
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|    820|#define FRAME_HAS_VLMETALAYERS (FRAME_NTHREADS_D + 2)  // 68
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|    820|#define FRAME_NTHREADS_D (FRAME_NTHREADS_C + 2 + 1)  // 66
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   41|    820|#define FRAME_NTHREADS_C (FRAME_CHUNKSIZE + 4 + 1)  // 63
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   40|    820|#define FRAME_CHUNKSIZE (FRAME_BLOCKSIZE + 4 + 1)  // 58
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   39|    820|#define FRAME_BLOCKSIZE (FRAME_TYPESIZE + 4 + 1)  // 53
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   38|    820|#define FRAME_TYPESIZE (FRAME_CBYTES + 8 + 1) // 48
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|    820|#define FRAME_CBYTES (FRAME_NBYTES + 8 + 1)  // 39
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   36|    820|#define FRAME_NBYTES (FRAME_FLAGS + 4 + 1)  // 30
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   32|    820|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   31|    820|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   30|    820|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   29|    820|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1250|       |
 1251|       |  // Now, deal with metalayers
 1252|    820|  uint16_t nmetalayers = schunk->nmetalayers;
 1253|    820|  if (nmetalayers > BLOSC2_MAX_METALAYERS) {
  ------------------
  |  | 1895|    820|#define BLOSC2_MAX_METALAYERS 16
  ------------------
  |  Branch (1253:7): [True: 0, False: 820]
  ------------------
 1254|      0|    return NULL;
 1255|      0|  }
 1256|       |
 1257|       |  // Make space for the header of metalayers (array marker, size, map of offsets)
 1258|    820|  h2 = realloc(h2, (size_t)hsize + 1 + 1 + 2 + 1 + 2);
 1259|    820|  h2p = h2 + hsize;
 1260|       |
 1261|       |  // The msgpack header for the metalayers (array_marker, size, map of offsets, list of metalayers)
 1262|    820|  *h2p = 0x90 + 3;  // array with 3 elements
 1263|    820|  h2p += 1;
 1264|       |
 1265|       |  // Size for the map (index) of offsets, including this uint16 size (to be filled out later on)
 1266|    820|  *h2p = 0xcd;  // uint16
 1267|    820|  h2p += 1 + 2;
 1268|       |
 1269|       |  // Map (index) of offsets for optional metalayers
 1270|    820|  *h2p = 0xde;  // map 16 with N keys
 1271|    820|  h2p += 1;
 1272|    820|  to_big(h2p, &nmetalayers, sizeof(nmetalayers));
  ------------------
  |  |   37|    820|#define to_big(dest, src, itemsize)       endian_handler(false, dest, src, itemsize)
  ------------------
 1273|    820|  h2p += sizeof(nmetalayers);
 1274|    820|  int32_t current_header_len = (int32_t)(h2p - h2);
 1275|    820|  int32_t *offtooff = malloc(nmetalayers * sizeof(int32_t));
 1276|    820|  if (offtooff == NULL) {
  ------------------
  |  Branch (1276:7): [True: 0, False: 820]
  ------------------
 1277|      0|    free(h2);
 1278|      0|    return NULL;
 1279|      0|  }
 1280|  1.57k|  for (int nmetalayer = 0; nmetalayer < nmetalayers; nmetalayer++) {
  ------------------
  |  Branch (1280:28): [True: 750, False: 820]
  ------------------
 1281|    750|    if (frame == NULL) {
  ------------------
  |  Branch (1281:9): [True: 0, False: 750]
  ------------------
 1282|      0|      free(offtooff);
 1283|      0|      free(h2);
 1284|      0|      return NULL;
 1285|      0|    }
 1286|    750|    blosc2_metalayer *metalayer = schunk->metalayers[nmetalayer];
 1287|    750|    uint8_t namelen = (uint8_t) strlen(metalayer->name);
 1288|    750|    h2 = realloc(h2, (size_t)current_header_len + 1 + namelen + 1 + 4);
 1289|    750|    h2p = h2 + current_header_len;
 1290|       |    // Store the metalayer
 1291|    750|    if (namelen >= (1U << 5U)) {  // metalayer strings cannot be longer than 32 bytes
  ------------------
  |  Branch (1291:9): [True: 0, False: 750]
  ------------------
 1292|      0|      free(offtooff);
 1293|      0|      free(h2);
 1294|      0|      return NULL;
 1295|      0|    }
 1296|    750|    *h2p = (uint8_t)0xa0 + namelen;  // str
 1297|    750|    h2p += 1;
 1298|    750|    memcpy(h2p, metalayer->name, namelen);
 1299|    750|    h2p += namelen;
 1300|       |    // Space for storing the offset for the value of this metalayer
 1301|    750|    *h2p = 0xd2;  // int32
 1302|    750|    h2p += 1;
 1303|    750|    offtooff[nmetalayer] = (int32_t)(h2p - h2);
 1304|    750|    h2p += 4;
 1305|    750|    current_header_len += 1 + namelen + 1 + 4;
 1306|    750|  }
 1307|    820|  int32_t hsize2 = (int32_t)(h2p - h2);
 1308|    820|  if (hsize2 != current_header_len) {  // sanity check
  ------------------
  |  Branch (1308:7): [True: 0, False: 820]
  ------------------
 1309|      0|    free(offtooff);
 1310|      0|    free(h2);
 1311|      0|    return NULL;
 1312|      0|  }
 1313|       |
 1314|       |  // Map size + int16 size
 1315|    820|  if ((uint32_t) (hsize2 - hsize) >= (1U << 16U)) {
  ------------------
  |  Branch (1315:7): [True: 0, False: 820]
  ------------------
 1316|      0|    free(offtooff);
 1317|      0|    free(h2);
 1318|      0|    return NULL;
 1319|      0|  }
 1320|    820|  uint16_t map_size = (uint16_t) (hsize2 - hsize);
 1321|    820|  to_big(h2 + FRAME_IDX_SIZE, &map_size, sizeof(map_size));
  ------------------
  |  |   37|    820|#define to_big(dest, src, itemsize)       endian_handler(false, dest, src, itemsize)
  ------------------
 1322|       |
 1323|       |  // Make space for an (empty) array
 1324|    820|  hsize = (int32_t)(h2p - h2);
 1325|    820|  h2 = realloc(h2, (size_t)hsize + 2 + 1 + 2);
 1326|    820|  h2p = h2 + hsize;
 1327|       |
 1328|       |  // Now, store the values in an array
 1329|    820|  *h2p = 0xdc;  // array 16 with N elements
 1330|    820|  h2p += 1;
 1331|    820|  to_big(h2p, &nmetalayers, sizeof(nmetalayers));
  ------------------
  |  |   37|    820|#define to_big(dest, src, itemsize)       endian_handler(false, dest, src, itemsize)
  ------------------
 1332|    820|  h2p += sizeof(nmetalayers);
 1333|    820|  current_header_len = (int32_t)(h2p - h2);
 1334|  1.57k|  for (int nmetalayer = 0; nmetalayer < nmetalayers; nmetalayer++) {
  ------------------
  |  Branch (1334:28): [True: 750, False: 820]
  ------------------
 1335|    750|    if (frame == NULL) {
  ------------------
  |  Branch (1335:9): [True: 0, False: 750]
  ------------------
 1336|      0|      free(offtooff);
 1337|      0|      free(h2);
 1338|      0|      return NULL;
 1339|      0|    }
 1340|    750|    blosc2_metalayer *metalayer = schunk->metalayers[nmetalayer];
 1341|    750|    h2 = realloc(h2, (size_t)current_header_len + 1 + 4 + metalayer->content_len);
 1342|    750|    h2p = h2 + current_header_len;
 1343|       |    // Store the serialized contents for this metalayer
 1344|    750|    *h2p = 0xc6;  // bin32
 1345|    750|    h2p += 1;
 1346|    750|    to_big(h2p, &(metalayer->content_len), sizeof(metalayer->content_len));
  ------------------
  |  |   37|    750|#define to_big(dest, src, itemsize)       endian_handler(false, dest, src, itemsize)
  ------------------
 1347|    750|    h2p += 4;
 1348|    750|    memcpy(h2p, metalayer->content, metalayer->content_len);  // buffer, no need to swap
 1349|    750|    h2p += metalayer->content_len;
 1350|       |    // Update the offset now that we know it
 1351|    750|    to_big(h2 + offtooff[nmetalayer], &current_header_len, sizeof(current_header_len));
  ------------------
  |  |   37|    750|#define to_big(dest, src, itemsize)       endian_handler(false, dest, src, itemsize)
  ------------------
 1352|    750|    current_header_len += 1 + 4 + metalayer->content_len;
 1353|    750|  }
 1354|    820|  free(offtooff);
 1355|    820|  hsize = (int32_t)(h2p - h2);
 1356|    820|  if (hsize != current_header_len) {  // sanity check
  ------------------
  |  Branch (1356:7): [True: 0, False: 820]
  ------------------
 1357|      0|    free(h2);
 1358|      0|    return NULL;
 1359|      0|  }
 1360|       |
 1361|       |  // Set the length of the whole header now that we know it
 1362|    820|  to_big(h2 + FRAME_HEADER_LEN, &hsize, sizeof(hsize));
  ------------------
  |  |   37|    820|#define to_big(dest, src, itemsize)       endian_handler(false, dest, src, itemsize)
  ------------------
 1363|       |
 1364|    820|  return h2;
 1365|    820|}
get_header_info:
 1374|  6.43k|                    uint8_t *splitmode, uint8_t *use_dict, const blosc2_io *io) {
 1375|  6.43k|  uint8_t* framep = frame->cframe;
 1376|  6.43k|  uint8_t* header_ptr;
 1377|  6.43k|  uint8_t header[FRAME_HEADER_MINLEN];
 1378|       |
 1379|  6.43k|  blosc2_io_cb *io_cb = blosc2_get_io_cb(io->id);
 1380|  6.43k|  if (io_cb == NULL) {
  ------------------
  |  Branch (1380:7): [True: 0, False: 6.43k]
  ------------------
 1381|      0|    BLOSC_TRACE_ERROR("Error getting the input/output API");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1382|      0|    return BLOSC2_ERROR_PLUGIN_IO;
 1383|      0|  }
 1384|       |
 1385|  6.43k|  if (frame->len <= 0) {
  ------------------
  |  Branch (1385:7): [True: 0, False: 6.43k]
  ------------------
 1386|      0|    return BLOSC2_ERROR_READ_BUFFER;
 1387|      0|  }
 1388|       |
 1389|  6.43k|  if (frame->cframe == NULL) {
  ------------------
  |  Branch (1389:7): [True: 0, False: 6.43k]
  ------------------
 1390|      0|    int64_t rbytes = 0;
 1391|      0|    void* fp = NULL;
 1392|      0|    int64_t io_pos = 0;
 1393|      0|    if (frame->sframe) {
  ------------------
  |  Branch (1393:9): [True: 0, False: 0]
  ------------------
 1394|      0|      fp = sframe_open_index(frame->urlpath, "rb", io);
 1395|      0|      if (fp == NULL) {
  ------------------
  |  Branch (1395:11): [True: 0, False: 0]
  ------------------
 1396|      0|        BLOSC_TRACE_ERROR("Error opening file in: %s", frame->urlpath);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1397|      0|        return BLOSC2_ERROR_FILE_OPEN;
 1398|      0|      }
 1399|      0|    }
 1400|      0|    else {
 1401|       |      /* Ahead of the header read, not after it: everything downstream (and
 1402|       |         frame_refresh_if_stale in particular) trusts the length this read
 1403|       |         returns, so a stale handle here would pair old metadata with the
 1404|       |         replacement's bytes. */
 1405|      0|      frame_reader_revalidate(frame);
 1406|      0|      fp = frame_reader_acquire(frame, io);
 1407|      0|      if (fp == NULL) {
  ------------------
  |  Branch (1407:11): [True: 0, False: 0]
  ------------------
 1408|      0|        BLOSC_TRACE_ERROR("Error opening file in: %s", frame->urlpath);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1409|      0|        return BLOSC2_ERROR_FILE_OPEN;
 1410|      0|      }
 1411|      0|      io_pos = frame->file_offset;
 1412|      0|    }
 1413|      0|    if (io_cb->is_allocation_necessary)
  ------------------
  |  Branch (1413:9): [True: 0, False: 0]
  ------------------
 1414|      0|      header_ptr = header;
 1415|      0|    rbytes = io_cb->read((void**)&header_ptr, 1, FRAME_HEADER_MINLEN, io_pos, fp);
  ------------------
  |  |   49|      0|#define FRAME_HEADER_MINLEN (FRAME_FILTER_PIPELINE + 1 + 16)  // 87 <- minimum length
  |  |  ------------------
  |  |  |  |   44|      0|#define FRAME_FILTER_PIPELINE (FRAME_HAS_VLMETALAYERS + 1 + 1) // 70
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|      0|#define FRAME_HAS_VLMETALAYERS (FRAME_NTHREADS_D + 2)  // 68
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define FRAME_NTHREADS_D (FRAME_NTHREADS_C + 2 + 1)  // 66
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   41|      0|#define FRAME_NTHREADS_C (FRAME_CHUNKSIZE + 4 + 1)  // 63
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   40|      0|#define FRAME_CHUNKSIZE (FRAME_BLOCKSIZE + 4 + 1)  // 58
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   39|      0|#define FRAME_BLOCKSIZE (FRAME_TYPESIZE + 4 + 1)  // 53
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   38|      0|#define FRAME_TYPESIZE (FRAME_CBYTES + 8 + 1) // 48
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|      0|#define FRAME_CBYTES (FRAME_NBYTES + 8 + 1)  // 39
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   36|      0|#define FRAME_NBYTES (FRAME_FLAGS + 4 + 1)  // 30
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   32|      0|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   31|      0|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   30|      0|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   29|      0|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1416|      0|    frame_reader_release(frame, io_cb, fp);
 1417|      0|    if (rbytes != FRAME_HEADER_MINLEN) {
  ------------------
  |  |   49|      0|#define FRAME_HEADER_MINLEN (FRAME_FILTER_PIPELINE + 1 + 16)  // 87 <- minimum length
  |  |  ------------------
  |  |  |  |   44|      0|#define FRAME_FILTER_PIPELINE (FRAME_HAS_VLMETALAYERS + 1 + 1) // 70
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|      0|#define FRAME_HAS_VLMETALAYERS (FRAME_NTHREADS_D + 2)  // 68
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define FRAME_NTHREADS_D (FRAME_NTHREADS_C + 2 + 1)  // 66
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   41|      0|#define FRAME_NTHREADS_C (FRAME_CHUNKSIZE + 4 + 1)  // 63
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   40|      0|#define FRAME_CHUNKSIZE (FRAME_BLOCKSIZE + 4 + 1)  // 58
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   39|      0|#define FRAME_BLOCKSIZE (FRAME_TYPESIZE + 4 + 1)  // 53
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   38|      0|#define FRAME_TYPESIZE (FRAME_CBYTES + 8 + 1) // 48
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|      0|#define FRAME_CBYTES (FRAME_NBYTES + 8 + 1)  // 39
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   36|      0|#define FRAME_NBYTES (FRAME_FLAGS + 4 + 1)  // 30
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   32|      0|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   31|      0|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   30|      0|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   29|      0|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1417:9): [True: 0, False: 0]
  ------------------
 1418|      0|      return BLOSC2_ERROR_FILE_READ;
 1419|      0|    }
 1420|      0|    framep = header_ptr;
 1421|      0|  }
 1422|       |
 1423|       |  // Consistency check for frame type
 1424|  6.43k|  uint8_t frame_type = framep[FRAME_TYPE];
  ------------------
  |  |   33|  6.43k|#define FRAME_TYPE (FRAME_FLAGS + 1)  // 26
  |  |  ------------------
  |  |  |  |   32|  6.43k|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  ------------------
  |  |  |  |  |  |   31|  6.43k|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   30|  6.43k|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   29|  6.43k|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1425|  6.43k|  uint8_t frame_version = framep[FRAME_FLAGS] & 0x0fu;
  ------------------
  |  |   32|  6.43k|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  ------------------
  |  |  |  |   31|  6.43k|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  ------------------
  |  |  |  |  |  |   30|  6.43k|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   29|  6.43k|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1426|  6.43k|  if (frame_version > BLOSC2_VERSION_FRAME_FORMAT) {
  ------------------
  |  Branch (1426:7): [True: 0, False: 6.43k]
  ------------------
 1427|      0|    BLOSC_TRACE_ERROR("Unsupported cframe version: %u", frame_version);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1428|      0|    return BLOSC2_ERROR_VERSION_SUPPORT;
 1429|      0|  }
 1430|  6.43k|  if (frame->sframe) {
  ------------------
  |  Branch (1430:7): [True: 0, False: 6.43k]
  ------------------
 1431|      0|    if (frame_type != FRAME_DIRECTORY_TYPE) {
  ------------------
  |  |   22|      0|#define FRAME_DIRECTORY_TYPE 1
  ------------------
  |  Branch (1431:9): [True: 0, False: 0]
  ------------------
 1432|      0|      return BLOSC2_ERROR_FRAME_TYPE;
 1433|      0|    }
 1434|  6.43k|  } else {
 1435|  6.43k|    if (frame_type != FRAME_CONTIGUOUS_TYPE) {
  ------------------
  |  |   21|  6.43k|#define FRAME_CONTIGUOUS_TYPE 0
  ------------------
  |  Branch (1435:9): [True: 0, False: 6.43k]
  ------------------
 1436|      0|      return BLOSC2_ERROR_FRAME_TYPE;
 1437|      0|    }
 1438|  6.43k|  }
 1439|       |
 1440|       |  // Fetch some internal lengths
 1441|  6.43k|  from_big(header_len, framep + FRAME_HEADER_LEN, sizeof(*header_len));
  ------------------
  |  |   38|  6.43k|#define from_big(dest, src, itemsize)     endian_handler(false, dest, src, itemsize)
  ------------------
 1442|  6.43k|  if (*header_len < FRAME_HEADER_MINLEN) {
  ------------------
  |  |   49|  6.43k|#define FRAME_HEADER_MINLEN (FRAME_FILTER_PIPELINE + 1 + 16)  // 87 <- minimum length
  |  |  ------------------
  |  |  |  |   44|  6.43k|#define FRAME_FILTER_PIPELINE (FRAME_HAS_VLMETALAYERS + 1 + 1) // 70
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|  6.43k|#define FRAME_HAS_VLMETALAYERS (FRAME_NTHREADS_D + 2)  // 68
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|  6.43k|#define FRAME_NTHREADS_D (FRAME_NTHREADS_C + 2 + 1)  // 66
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   41|  6.43k|#define FRAME_NTHREADS_C (FRAME_CHUNKSIZE + 4 + 1)  // 63
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   40|  6.43k|#define FRAME_CHUNKSIZE (FRAME_BLOCKSIZE + 4 + 1)  // 58
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   39|  6.43k|#define FRAME_BLOCKSIZE (FRAME_TYPESIZE + 4 + 1)  // 53
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   38|  6.43k|#define FRAME_TYPESIZE (FRAME_CBYTES + 8 + 1) // 48
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|  6.43k|#define FRAME_CBYTES (FRAME_NBYTES + 8 + 1)  // 39
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   36|  6.43k|#define FRAME_NBYTES (FRAME_FLAGS + 4 + 1)  // 30
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   32|  6.43k|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   31|  6.43k|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   30|  6.43k|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   29|  6.43k|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1442:7): [True: 4, False: 6.42k]
  ------------------
 1443|      4|    BLOSC_TRACE_ERROR("Header length is zero or smaller than min allowed.");
  ------------------
  |  |   93|      4|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      4|    do {                                            \
  |  |  |  |   98|      4|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      4|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 4, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      4|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1444|      4|    return BLOSC2_ERROR_INVALID_HEADER;
 1445|      4|  }
 1446|  6.42k|  from_big(frame_len, framep + FRAME_LEN, sizeof(*frame_len));
  ------------------
  |  |   38|  6.42k|#define from_big(dest, src, itemsize)     endian_handler(false, dest, src, itemsize)
  ------------------
 1447|  6.42k|  if (*header_len > *frame_len) {
  ------------------
  |  Branch (1447:7): [True: 0, False: 6.42k]
  ------------------
 1448|      0|    BLOSC_TRACE_ERROR("Header length exceeds length of the frame.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1449|      0|    return BLOSC2_ERROR_INVALID_HEADER;
 1450|      0|  }
 1451|  6.42k|  from_big(nbytes, framep + FRAME_NBYTES, sizeof(*nbytes));
  ------------------
  |  |   38|  6.42k|#define from_big(dest, src, itemsize)     endian_handler(false, dest, src, itemsize)
  ------------------
 1452|  6.42k|  from_big(cbytes, framep + FRAME_CBYTES, sizeof(*cbytes));
  ------------------
  |  |   38|  6.42k|#define from_big(dest, src, itemsize)     endian_handler(false, dest, src, itemsize)
  ------------------
 1453|  6.42k|  from_big(blocksize, framep + FRAME_BLOCKSIZE, sizeof(*blocksize));
  ------------------
  |  |   38|  6.42k|#define from_big(dest, src, itemsize)     endian_handler(false, dest, src, itemsize)
  ------------------
 1454|  6.42k|  if (chunksize != NULL) {
  ------------------
  |  Branch (1454:7): [True: 6.35k, False: 70]
  ------------------
 1455|  6.35k|    from_big(chunksize, framep + FRAME_CHUNKSIZE, sizeof(*chunksize));
  ------------------
  |  |   38|  6.35k|#define from_big(dest, src, itemsize)     endian_handler(false, dest, src, itemsize)
  ------------------
 1456|  6.35k|  }
 1457|  6.42k|  if (typesize != NULL) {
  ------------------
  |  Branch (1457:7): [True: 4.57k, False: 1.85k]
  ------------------
 1458|  4.57k|    from_big(typesize, framep + FRAME_TYPESIZE, sizeof(*typesize));
  ------------------
  |  |   38|  4.57k|#define from_big(dest, src, itemsize)     endian_handler(false, dest, src, itemsize)
  ------------------
 1459|  4.57k|    if (*typesize <= 0) {
  ------------------
  |  Branch (1459:9): [True: 1, False: 4.57k]
  ------------------
 1460|      1|      BLOSC_TRACE_ERROR("`typesize` cannot be zero or negative.");
  ------------------
  |  |   93|      1|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      1|    do {                                            \
  |  |  |  |   98|      1|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      1|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 1, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      1|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1461|      1|      return BLOSC2_ERROR_INVALID_HEADER;
 1462|      1|    }
 1463|  4.57k|  }
 1464|       |
 1465|       |  // Codecs
 1466|  6.42k|  uint8_t frame_codecs = framep[FRAME_CODECS];
  ------------------
  |  |   34|  6.42k|#define FRAME_CODECS (FRAME_FLAGS + 2)  // 27
  |  |  ------------------
  |  |  |  |   32|  6.42k|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  ------------------
  |  |  |  |  |  |   31|  6.42k|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   30|  6.42k|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   29|  6.42k|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1467|  6.42k|  if (clevel != NULL) {
  ------------------
  |  Branch (1467:7): [True: 1.94k, False: 4.47k]
  ------------------
 1468|  1.94k|    *clevel = frame_codecs >> 4u;
 1469|  1.94k|  }
 1470|  6.42k|  if (compcode != NULL) {
  ------------------
  |  Branch (1470:7): [True: 1.94k, False: 4.47k]
  ------------------
 1471|  1.94k|    *compcode = frame_codecs & 0xFu;
 1472|  1.94k|    if (*compcode == BLOSC_UDCODEC_FORMAT) {
  ------------------
  |  Branch (1472:9): [True: 58, False: 1.89k]
  ------------------
 1473|     58|      from_big(compcode, framep + FRAME_UDCODEC, sizeof(*compcode));
  ------------------
  |  |   38|     58|#define from_big(dest, src, itemsize)     endian_handler(false, dest, src, itemsize)
  ------------------
 1474|     58|    }
 1475|  1.94k|  }
 1476|       |
 1477|       |  // Other flags
 1478|  6.42k|  uint8_t other_flags = framep[FRAME_OTHER_FLAGS];
  ------------------
  |  |   35|  6.42k|#define FRAME_OTHER_FLAGS (FRAME_FLAGS + 3)  // 28
  |  |  ------------------
  |  |  |  |   32|  6.42k|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  ------------------
  |  |  |  |  |  |   31|  6.42k|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   30|  6.42k|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   29|  6.42k|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1479|  6.42k|  if (splitmode != NULL) {
  ------------------
  |  Branch (1479:7): [True: 1.94k, False: 4.47k]
  ------------------
 1480|  1.94k|    *splitmode = (other_flags & 0x03u) + 1;
 1481|  1.94k|  }
 1482|       |
 1483|       |  // Other flags 2: bit 0 = use_dict
 1484|  6.42k|  if (use_dict != NULL) {
  ------------------
  |  Branch (1484:7): [True: 1.94k, False: 4.47k]
  ------------------
 1485|  1.94k|    *use_dict = (framep[FRAME_OTHER_FLAGS2] & FRAME_USE_DICT) ? 1 : 0;
  ------------------
  |  |   47|  1.94k|#define FRAME_OTHER_FLAGS2 (FRAME_FILTER_PIPELINE + 1 + 14)  // 85
  |  |  ------------------
  |  |  |  |   44|  1.94k|#define FRAME_FILTER_PIPELINE (FRAME_HAS_VLMETALAYERS + 1 + 1) // 70
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|  1.94k|#define FRAME_HAS_VLMETALAYERS (FRAME_NTHREADS_D + 2)  // 68
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|  1.94k|#define FRAME_NTHREADS_D (FRAME_NTHREADS_C + 2 + 1)  // 66
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   41|  1.94k|#define FRAME_NTHREADS_C (FRAME_CHUNKSIZE + 4 + 1)  // 63
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   40|  1.94k|#define FRAME_CHUNKSIZE (FRAME_BLOCKSIZE + 4 + 1)  // 58
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   39|  1.94k|#define FRAME_BLOCKSIZE (FRAME_TYPESIZE + 4 + 1)  // 53
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   38|  1.94k|#define FRAME_TYPESIZE (FRAME_CBYTES + 8 + 1) // 48
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|  1.94k|#define FRAME_CBYTES (FRAME_NBYTES + 8 + 1)  // 39
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   36|  1.94k|#define FRAME_NBYTES (FRAME_FLAGS + 4 + 1)  // 30
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   32|  1.94k|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   31|  1.94k|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   30|  1.94k|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   29|  1.94k|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                  *use_dict = (framep[FRAME_OTHER_FLAGS2] & FRAME_USE_DICT) ? 1 : 0;
  ------------------
  |  |   48|  1.94k|#define FRAME_USE_DICT (1U << 0)   //!< bit 0 of other_flags2: use dictionary compression
  ------------------
  |  Branch (1485:17): [True: 838, False: 1.11k]
  ------------------
 1486|  1.94k|  }
 1487|       |
 1488|  6.42k|  if (compcode_meta != NULL) {
  ------------------
  |  Branch (1488:7): [True: 1.94k, False: 4.47k]
  ------------------
 1489|  1.94k|    from_big(compcode_meta, framep + FRAME_CODEC_META, sizeof(*compcode_meta));
  ------------------
  |  |   38|  1.94k|#define from_big(dest, src, itemsize)     endian_handler(false, dest, src, itemsize)
  ------------------
 1490|  1.94k|  }
 1491|       |
 1492|       |  // Filters
 1493|  6.42k|  if (filters != NULL && filters_meta != NULL) {
  ------------------
  |  Branch (1493:7): [True: 1.94k, False: 4.47k]
  |  Branch (1493:26): [True: 1.94k, False: 0]
  ------------------
 1494|  1.94k|    uint8_t nfilters = framep[FRAME_FILTER_PIPELINE];
  ------------------
  |  |   44|  1.94k|#define FRAME_FILTER_PIPELINE (FRAME_HAS_VLMETALAYERS + 1 + 1) // 70
  |  |  ------------------
  |  |  |  |   43|  1.94k|#define FRAME_HAS_VLMETALAYERS (FRAME_NTHREADS_D + 2)  // 68
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|  1.94k|#define FRAME_NTHREADS_D (FRAME_NTHREADS_C + 2 + 1)  // 66
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   41|  1.94k|#define FRAME_NTHREADS_C (FRAME_CHUNKSIZE + 4 + 1)  // 63
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   40|  1.94k|#define FRAME_CHUNKSIZE (FRAME_BLOCKSIZE + 4 + 1)  // 58
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   39|  1.94k|#define FRAME_BLOCKSIZE (FRAME_TYPESIZE + 4 + 1)  // 53
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   38|  1.94k|#define FRAME_TYPESIZE (FRAME_CBYTES + 8 + 1) // 48
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|  1.94k|#define FRAME_CBYTES (FRAME_NBYTES + 8 + 1)  // 39
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   36|  1.94k|#define FRAME_NBYTES (FRAME_FLAGS + 4 + 1)  // 30
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   32|  1.94k|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   31|  1.94k|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   30|  1.94k|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   29|  1.94k|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1495|  1.94k|    if (nfilters > BLOSC2_MAX_FILTERS) {
  ------------------
  |  Branch (1495:9): [True: 0, False: 1.94k]
  ------------------
 1496|      0|      BLOSC_TRACE_ERROR("The number of filters in frame header are too large for Blosc2.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1497|      0|      return BLOSC2_ERROR_INVALID_HEADER;
 1498|      0|    }
 1499|  1.94k|    uint8_t *filters_ = framep + FRAME_FILTER_PIPELINE + 1;
  ------------------
  |  |   44|  1.94k|#define FRAME_FILTER_PIPELINE (FRAME_HAS_VLMETALAYERS + 1 + 1) // 70
  |  |  ------------------
  |  |  |  |   43|  1.94k|#define FRAME_HAS_VLMETALAYERS (FRAME_NTHREADS_D + 2)  // 68
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|  1.94k|#define FRAME_NTHREADS_D (FRAME_NTHREADS_C + 2 + 1)  // 66
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   41|  1.94k|#define FRAME_NTHREADS_C (FRAME_CHUNKSIZE + 4 + 1)  // 63
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   40|  1.94k|#define FRAME_CHUNKSIZE (FRAME_BLOCKSIZE + 4 + 1)  // 58
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   39|  1.94k|#define FRAME_BLOCKSIZE (FRAME_TYPESIZE + 4 + 1)  // 53
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   38|  1.94k|#define FRAME_TYPESIZE (FRAME_CBYTES + 8 + 1) // 48
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|  1.94k|#define FRAME_CBYTES (FRAME_NBYTES + 8 + 1)  // 39
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   36|  1.94k|#define FRAME_NBYTES (FRAME_FLAGS + 4 + 1)  // 30
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   32|  1.94k|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   31|  1.94k|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   30|  1.94k|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   29|  1.94k|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1500|  1.94k|    uint8_t *filters_meta_ = framep + FRAME_FILTER_PIPELINE + 1 + FRAME_FILTER_PIPELINE_MAX;
  ------------------
  |  |   44|  1.94k|#define FRAME_FILTER_PIPELINE (FRAME_HAS_VLMETALAYERS + 1 + 1) // 70
  |  |  ------------------
  |  |  |  |   43|  1.94k|#define FRAME_HAS_VLMETALAYERS (FRAME_NTHREADS_D + 2)  // 68
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|  1.94k|#define FRAME_NTHREADS_D (FRAME_NTHREADS_C + 2 + 1)  // 66
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   41|  1.94k|#define FRAME_NTHREADS_C (FRAME_CHUNKSIZE + 4 + 1)  // 63
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   40|  1.94k|#define FRAME_CHUNKSIZE (FRAME_BLOCKSIZE + 4 + 1)  // 58
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   39|  1.94k|#define FRAME_BLOCKSIZE (FRAME_TYPESIZE + 4 + 1)  // 53
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   38|  1.94k|#define FRAME_TYPESIZE (FRAME_CBYTES + 8 + 1) // 48
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|  1.94k|#define FRAME_CBYTES (FRAME_NBYTES + 8 + 1)  // 39
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   36|  1.94k|#define FRAME_NBYTES (FRAME_FLAGS + 4 + 1)  // 30
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   32|  1.94k|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   31|  1.94k|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   30|  1.94k|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   29|  1.94k|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                  uint8_t *filters_meta_ = framep + FRAME_FILTER_PIPELINE + 1 + FRAME_FILTER_PIPELINE_MAX;
  ------------------
  |  |   53|  1.94k|#define FRAME_FILTER_PIPELINE_MAX (8)  // the maximum number of filters that can be stored in header
  ------------------
 1501|  3.53k|    for (int i = 0; i < nfilters; i++) {
  ------------------
  |  Branch (1501:21): [True: 1.58k, False: 1.94k]
  ------------------
 1502|  1.58k|      filters[i] = filters_[i];
 1503|  1.58k|      filters_meta[i] = filters_meta_[i];
 1504|  1.58k|    }
 1505|  1.94k|  }
 1506|       |
 1507|  6.42k|  if (*nbytes > 0) {
  ------------------
  |  Branch (1507:7): [True: 5.95k, False: 470]
  ------------------
 1508|  5.95k|    if (*chunksize > 0) {
  ------------------
  |  Branch (1508:9): [True: 4.12k, False: 1.83k]
  ------------------
 1509|       |      // We can compute the number of chunks directly when there is a fixed chunk size.
 1510|  4.12k|      *nchunks = *nbytes / *chunksize;
 1511|  4.12k|      if (*nbytes % *chunksize > 0) {
  ------------------
  |  Branch (1511:11): [True: 49, False: 4.07k]
  ------------------
 1512|     49|        *nchunks += 1;
 1513|     49|      }
 1514|       |
 1515|       |      // Sanity check for compressed sizes
 1516|  4.12k|      if ((*cbytes < 0) || ((int64_t)*nchunks * *chunksize < *nbytes)) {
  ------------------
  |  Branch (1516:11): [True: 7, False: 4.11k]
  |  Branch (1516:28): [True: 2, False: 4.11k]
  ------------------
 1517|      9|        BLOSC_TRACE_ERROR("Invalid compressed size in frame header.");
  ------------------
  |  |   93|      9|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      9|    do {                                            \
  |  |  |  |   98|      9|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      9|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 9, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      9|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1518|      9|        return BLOSC2_ERROR_INVALID_HEADER;
 1519|      9|      }
 1520|  4.12k|    }
 1521|  1.83k|    else if (*chunksize == 0) {
  ------------------
  |  Branch (1521:14): [True: 1.83k, False: 0]
  ------------------
 1522|  1.83k|      int32_t coffsets_nbytes;
 1523|  1.83k|      int rc2 = get_coffsets_nbytes(frame, *header_len, *cbytes, &coffsets_nbytes, io);
 1524|  1.83k|      if (rc2 < 0) {
  ------------------
  |  Branch (1524:11): [True: 52, False: 1.78k]
  ------------------
 1525|     52|        return rc2;
 1526|     52|      }
 1527|  1.78k|      if (coffsets_nbytes < 0 || coffsets_nbytes % (int32_t)sizeof(int64_t) != 0) {
  ------------------
  |  Branch (1527:11): [True: 18, False: 1.76k]
  |  Branch (1527:34): [True: 1, False: 1.76k]
  ------------------
 1528|     19|        BLOSC_TRACE_ERROR("Invalid offsets chunk in frame header.");
  ------------------
  |  |   93|     19|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|     19|    do {                                            \
  |  |  |  |   98|     19|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|     19|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 19, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|     19|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1529|     19|        return BLOSC2_ERROR_INVALID_HEADER;
 1530|     19|      }
 1531|  1.76k|      *nchunks = coffsets_nbytes / (int32_t)sizeof(int64_t);
 1532|  1.76k|    }
 1533|      0|    else {
 1534|      0|      BLOSC_TRACE_ERROR("Invalid chunk size in frame header.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1535|      0|      return BLOSC2_ERROR_INVALID_HEADER;
 1536|      0|    }
 1537|  5.95k|  } else {
 1538|    470|    *nchunks = 0;
 1539|    470|  }
 1540|       |
 1541|  6.34k|  if (*nchunks > 0) {
  ------------------
  |  Branch (1541:7): [True: 5.87k, False: 472]
  ------------------
 1542|  5.87k|    int32_t off_nbytes;
 1543|  5.87k|    if (!blosc2_nchunks_to_offsets_nbytes(*nchunks, &off_nbytes)) {
  ------------------
  |  Branch (1543:9): [True: 10, False: 5.86k]
  ------------------
 1544|     10|      BLOSC_TRACE_ERROR("Invalid number of chunks in frame header.");
  ------------------
  |  |   93|     10|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|     10|    do {                                            \
  |  |  |  |   98|     10|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|     10|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 10, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|     10|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1545|     10|      return BLOSC2_ERROR_INVALID_HEADER;
 1546|     10|    }
 1547|  5.87k|  }
 1548|       |
 1549|  6.33k|  return 0;
 1550|  6.34k|}
get_trailer_offset:
 1553|    932|int64_t get_trailer_offset(blosc2_frame_s *frame, int32_t header_len, bool has_coffsets) {
 1554|    932|  if (!has_coffsets) {
  ------------------
  |  Branch (1554:7): [True: 183, False: 749]
  ------------------
 1555|       |    // No data chunks yet
 1556|    183|    return header_len;
 1557|    183|  }
 1558|    749|  return frame->len - frame->trailer_len;
 1559|    932|}
frame_check_stale:
 1745|    346|int frame_check_stale(blosc2_frame_s *frame) {
 1746|    346|  if (frame == NULL || frame->cframe != NULL || frame->schunk == NULL) {
  ------------------
  |  Branch (1746:7): [True: 0, False: 346]
  |  Branch (1746:24): [True: 346, False: 0]
  |  Branch (1746:49): [True: 0, False: 0]
  ------------------
 1747|    346|    return 0;
 1748|    346|  }
 1749|      0|  if (frame_lock(frame, false) < 0) {
  ------------------
  |  Branch (1749:7): [True: 0, False: 0]
  ------------------
 1750|      0|    return BLOSC2_ERROR_LOCK;
 1751|      0|  }
 1752|      0|  int32_t header_len;
 1753|      0|  int64_t frame_len;
 1754|      0|  int64_t nbytes;
 1755|      0|  int64_t cbytes;
 1756|      0|  int32_t blocksize;
 1757|      0|  int32_t chunksize;
 1758|      0|  int64_t nchunks;
 1759|      0|  int rc = get_header_info(frame, &header_len, &frame_len, &nbytes, &cbytes,
 1760|      0|                           &blocksize, &chunksize, &nchunks,
 1761|      0|                           NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
 1762|      0|                           frame->schunk->storage->io);
 1763|      0|  if (rc < 0) {
  ------------------
  |  Branch (1763:7): [True: 0, False: 0]
  ------------------
 1764|       |    // The on-disk header cannot be read right now (e.g. a freshly created
 1765|       |    // frame not yet flushed to disk, or another process mid-write).  The
 1766|       |    // poll is opportunistic: keep the cached view, exactly as before polling
 1767|       |    // existed.  A genuinely torn frame still errors out in the data-access
 1768|       |    // paths that need it.
 1769|      0|    frame_unlock(frame);
 1770|      0|    return 0;
 1771|      0|  }
 1772|      0|  rc = frame_refresh_if_stale(frame, frame_len);
 1773|      0|  if (rc > 0) {
  ------------------
  |  Branch (1773:7): [True: 0, False: 0]
  ------------------
 1774|      0|    frame->schunk->nbytes = nbytes;
 1775|      0|    frame->schunk->cbytes = cbytes;
 1776|      0|    frame->schunk->nchunks = nchunks;
 1777|      0|  }
 1778|      0|  frame_unlock(frame);
 1779|      0|  return rc;
 1780|      0|}
update_frame_len:
 1866|    820|int update_frame_len(blosc2_frame_s* frame, int64_t len) {
 1867|    820|  int rc = 1;
 1868|    820|  blosc2_io_cb *io_cb = blosc2_get_io_cb(frame->schunk->storage->io->id);
 1869|    820|  if (io_cb == NULL) {
  ------------------
  |  Branch (1869:7): [True: 0, False: 820]
  ------------------
 1870|      0|    BLOSC_TRACE_ERROR("Error getting the input/output API");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1871|      0|    return BLOSC2_ERROR_PLUGIN_IO;
 1872|      0|  }
 1873|       |
 1874|    820|  if (frame->cframe != NULL) {
  ------------------
  |  Branch (1874:7): [True: 820, False: 0]
  ------------------
 1875|    820|    to_big(frame->cframe + FRAME_LEN, &len, sizeof(int64_t));
  ------------------
  |  |   37|    820|#define to_big(dest, src, itemsize)       endian_handler(false, dest, src, itemsize)
  ------------------
 1876|    820|  }
 1877|      0|  else {
 1878|      0|    void* fp = NULL;
 1879|      0|    if (frame->sframe) {
  ------------------
  |  Branch (1879:9): [True: 0, False: 0]
  ------------------
 1880|      0|      fp = sframe_open_index(frame->urlpath, "rb+",
 1881|      0|                             frame->schunk->storage->io);
 1882|      0|    }
 1883|      0|    else {
 1884|      0|      fp = frame_writer_acquire(frame, io_cb);
 1885|      0|    }
 1886|      0|    if (fp == NULL) {
  ------------------
  |  Branch (1886:9): [True: 0, False: 0]
  ------------------
 1887|      0|      BLOSC_TRACE_ERROR("Error opening file in: %s", frame->urlpath);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1888|      0|      return BLOSC2_ERROR_FILE_OPEN;
 1889|      0|    }
 1890|      0|    int64_t io_pos = frame->file_offset + FRAME_LEN;
  ------------------
  |  |   31|      0|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  ------------------
  |  |  |  |   30|      0|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  ------------------
  |  |  |  |  |  |   29|      0|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1891|      0|    int64_t swap_len;
 1892|      0|    to_big(&swap_len, &len, sizeof(int64_t));
  ------------------
  |  |   37|      0|#define to_big(dest, src, itemsize)       endian_handler(false, dest, src, itemsize)
  ------------------
 1893|      0|    int64_t wbytes = io_cb->write(&swap_len, 1, sizeof(int64_t), io_pos, fp);
 1894|      0|    int close_rc = frame_writer_release(frame, io_cb, fp);
 1895|      0|    if (wbytes != sizeof(int64_t)) {
  ------------------
  |  Branch (1895:9): [True: 0, False: 0]
  ------------------
 1896|      0|      BLOSC_TRACE_ERROR("Cannot write the frame length in header.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1897|      0|      return BLOSC2_ERROR_FILE_WRITE;
 1898|      0|    }
 1899|      0|    if (close_rc < 0) {
  ------------------
  |  Branch (1899:9): [True: 0, False: 0]
  ------------------
 1900|      0|      return close_rc;
 1901|      0|    }
 1902|      0|  }
 1903|    820|  return rc;
 1904|    820|}
frame_update_trailer:
 1907|    820|int frame_update_trailer(blosc2_frame_s* frame, blosc2_schunk* schunk) {
 1908|    820|  if (frame != NULL && frame->len == 0) {
  ------------------
  |  Branch (1908:7): [True: 820, False: 0]
  |  Branch (1908:24): [True: 0, False: 820]
  ------------------
 1909|      0|    BLOSC_TRACE_ERROR("The trailer cannot be updated on empty frames.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1910|      0|  }
 1911|       |
 1912|       |  // Create the trailer in msgpack (see the frame format document)
 1913|    820|  uint32_t trailer_len = FRAME_TRAILER_MINLEN;
  ------------------
  |  |   58|    820|#define FRAME_TRAILER_MINLEN (25)  // minimum length for the trailer (msgpack overhead)
  ------------------
 1914|    820|  uint8_t* trailer = (uint8_t*)calloc((size_t)trailer_len, 1);
 1915|    820|  uint8_t* ptrailer = trailer;
 1916|    820|  *ptrailer = 0x90 + 4;  // fixarray with 4 elements
 1917|    820|  ptrailer += 1;
 1918|       |  // Trailer format version
 1919|    820|  *ptrailer = FRAME_TRAILER_VERSION;
  ------------------
  |  |   56|    820|#define FRAME_TRAILER_VERSION (1U)        // can be up to 127
  ------------------
 1920|    820|  ptrailer += 1;
 1921|       |
 1922|    820|  int32_t current_trailer_len = (int32_t)(ptrailer - trailer);
 1923|       |
 1924|       |  // Now, deal with variable-length metalayers
 1925|    820|  int16_t nvlmetalayers = schunk->nvlmetalayers;
 1926|    820|  if (nvlmetalayers < 0 || nvlmetalayers > BLOSC2_MAX_METALAYERS) {
  ------------------
  |  | 1895|    820|#define BLOSC2_MAX_METALAYERS 16
  ------------------
  |  Branch (1926:7): [True: 0, False: 820]
  |  Branch (1926:28): [True: 0, False: 820]
  ------------------
 1927|      0|    return -1;
 1928|      0|  }
 1929|       |
 1930|       |  // Make space for the header of metalayers (array marker, size, map of offsets)
 1931|    820|  trailer = realloc(trailer, (size_t) current_trailer_len + 1 + 1 + 2 + 1 + 2);
 1932|    820|  ptrailer = trailer + current_trailer_len;
 1933|       |
 1934|       |  // The msgpack header for the metalayers (array_marker, size, map of offsets, list of metalayers)
 1935|    820|  *ptrailer = 0x90 + 3;  // array with 3 elements
 1936|    820|  ptrailer += 1;
 1937|       |
 1938|    820|  int32_t tsize = (int32_t)(ptrailer - trailer);
 1939|       |
 1940|       |  // Size for the map (index) of metalayer offsets, including this uint16 size (to be filled out later on)
 1941|    820|  *ptrailer = 0xcd;  // uint16
 1942|    820|  ptrailer += 1 + 2;
 1943|       |
 1944|       |  // Map (index) of offsets for optional metalayers
 1945|    820|  *ptrailer = 0xde;  // map 16 with N keys
 1946|    820|  ptrailer += 1;
 1947|    820|  to_big(ptrailer, &nvlmetalayers, sizeof(nvlmetalayers));
  ------------------
  |  |   37|    820|#define to_big(dest, src, itemsize)       endian_handler(false, dest, src, itemsize)
  ------------------
 1948|    820|  ptrailer += sizeof(nvlmetalayers);
 1949|    820|  current_trailer_len = (int32_t)(ptrailer - trailer);
 1950|    820|  int32_t *offtodata = malloc(nvlmetalayers * sizeof(int32_t));
 1951|    820|  for (int nvlmetalayer = 0; nvlmetalayer < nvlmetalayers; nvlmetalayer++) {
  ------------------
  |  Branch (1951:30): [True: 0, False: 820]
  ------------------
 1952|      0|    if (frame == NULL) {
  ------------------
  |  Branch (1952:9): [True: 0, False: 0]
  ------------------
 1953|      0|      return -1;
 1954|      0|    }
 1955|      0|    blosc2_metalayer *vlmetalayer = schunk->vlmetalayers[nvlmetalayer];
 1956|      0|    uint8_t name_len = (uint8_t) strlen(vlmetalayer->name);
 1957|      0|    trailer = realloc(trailer, (size_t)current_trailer_len + 1 + name_len + 1 + 4);
 1958|      0|    ptrailer = trailer + current_trailer_len;
 1959|       |    // Store the vlmetalayer
 1960|      0|    if (name_len >= (1U << 5U)) {  // metalayer strings cannot be longer than 32 bytes
  ------------------
  |  Branch (1960:9): [True: 0, False: 0]
  ------------------
 1961|      0|      free(offtodata);
 1962|      0|      return -1;
 1963|      0|    }
 1964|      0|    *ptrailer = (uint8_t)0xa0 + name_len;  // str
 1965|      0|    ptrailer += 1;
 1966|      0|    memcpy(ptrailer, vlmetalayer->name, name_len);
 1967|      0|    ptrailer += name_len;
 1968|       |    // Space for storing the offset for the value of this vlmetalayer
 1969|      0|    *ptrailer = 0xd2;  // int32
 1970|      0|    ptrailer += 1;
 1971|      0|    offtodata[nvlmetalayer] = (int32_t)(ptrailer - trailer);
 1972|      0|    ptrailer += 4;
 1973|      0|    current_trailer_len += 1 + name_len + 1 + 4;
 1974|      0|  }
 1975|    820|  int32_t tsize2 = (int32_t)(ptrailer - trailer);
 1976|    820|  if (tsize2 != current_trailer_len) {  // sanity check
  ------------------
  |  Branch (1976:7): [True: 0, False: 820]
  ------------------
 1977|      0|    return -1;
 1978|      0|  }
 1979|       |
 1980|       |  // Map size + int16 size
 1981|    820|  if ((uint32_t) (tsize2 - tsize) >= (1U << 16U)) {
  ------------------
  |  Branch (1981:7): [True: 0, False: 820]
  ------------------
 1982|      0|    return -1;
 1983|      0|  }
 1984|    820|  uint16_t map_size = (uint16_t) (tsize2 - tsize);
 1985|    820|  to_big(trailer + 4, &map_size, sizeof(map_size));
  ------------------
  |  |   37|    820|#define to_big(dest, src, itemsize)       endian_handler(false, dest, src, itemsize)
  ------------------
 1986|       |
 1987|       |  // Make space for an (empty) array
 1988|    820|  tsize = (int32_t)(ptrailer - trailer);
 1989|    820|  trailer = realloc(trailer, (size_t) tsize + 2 + 1 + 2);
 1990|    820|  ptrailer = trailer + tsize;
 1991|       |
 1992|       |  // Now, store the values in an array
 1993|    820|  *ptrailer = 0xdc;  // array 16 with N elements
 1994|    820|  ptrailer += 1;
 1995|    820|  to_big(ptrailer, &nvlmetalayers, sizeof(nvlmetalayers));
  ------------------
  |  |   37|    820|#define to_big(dest, src, itemsize)       endian_handler(false, dest, src, itemsize)
  ------------------
 1996|    820|  ptrailer += sizeof(nvlmetalayers);
 1997|    820|  current_trailer_len = (int32_t)(ptrailer - trailer);
 1998|    820|  for (int nvlmetalayer = 0; nvlmetalayer < nvlmetalayers; nvlmetalayer++) {
  ------------------
  |  Branch (1998:30): [True: 0, False: 820]
  ------------------
 1999|      0|    if (frame == NULL) {
  ------------------
  |  Branch (1999:9): [True: 0, False: 0]
  ------------------
 2000|      0|      return -1;
 2001|      0|    }
 2002|      0|    blosc2_metalayer *vlmetalayer = schunk->vlmetalayers[nvlmetalayer];
 2003|      0|    trailer = realloc(trailer, (size_t)current_trailer_len + 1 + 4 + vlmetalayer->content_len);
 2004|      0|    ptrailer = trailer + current_trailer_len;
 2005|       |    // Store the serialized contents for this vlmetalayer
 2006|      0|    *ptrailer = 0xc6;  // bin32
 2007|      0|    ptrailer += 1;
 2008|      0|    to_big(ptrailer, &(vlmetalayer->content_len), sizeof(vlmetalayer->content_len));
  ------------------
  |  |   37|      0|#define to_big(dest, src, itemsize)       endian_handler(false, dest, src, itemsize)
  ------------------
 2009|      0|    ptrailer += 4;
 2010|      0|    memcpy(ptrailer, vlmetalayer->content, vlmetalayer->content_len);  // buffer, no need to swap
 2011|      0|    ptrailer += vlmetalayer->content_len;
 2012|       |    // Update the offset now that we know it
 2013|      0|    to_big(trailer + offtodata[nvlmetalayer], &current_trailer_len, sizeof(current_trailer_len));
  ------------------
  |  |   37|      0|#define to_big(dest, src, itemsize)       endian_handler(false, dest, src, itemsize)
  ------------------
 2014|      0|    current_trailer_len += 1 + 4 + vlmetalayer->content_len;
 2015|      0|  }
 2016|    820|  free(offtodata);
 2017|    820|  tsize = (int32_t)(ptrailer - trailer);
 2018|    820|  if (tsize != current_trailer_len) {  // sanity check
  ------------------
  |  Branch (2018:7): [True: 0, False: 820]
  ------------------
 2019|      0|    return -1;
 2020|      0|  }
 2021|       |
 2022|    820|  trailer = realloc(trailer, (size_t)current_trailer_len + 23);
 2023|    820|  ptrailer = trailer + current_trailer_len;
 2024|    820|  trailer_len = (ptrailer - trailer) + 23;
 2025|       |
 2026|       |  // Trailer length
 2027|    820|  *ptrailer = 0xce;  // uint32
 2028|    820|  ptrailer += 1;
 2029|    820|  to_big(ptrailer, &trailer_len, sizeof(uint32_t));
  ------------------
  |  |   37|    820|#define to_big(dest, src, itemsize)       endian_handler(false, dest, src, itemsize)
  ------------------
 2030|    820|  ptrailer += sizeof(uint32_t);
 2031|       |  // Up to 16 bytes for frame fingerprint (using XXH3 included in https://github.com/Cyan4973/xxHash)
 2032|       |  // Maybe someone would need 256-bit in the future, but for the time being 128-bit seems like a good tradeoff
 2033|    820|  *ptrailer = 0xd8;  // fixext 16
 2034|    820|  ptrailer += 1;
 2035|    820|  *ptrailer = 0;  // fingerprint type: 0 -> no fp; 1 -> 32-bit; 2 -> 64-bit; 3 -> 128-bit
 2036|    820|  ptrailer += 1;
 2037|       |
 2038|       |  // Remove call to memset when we compute an actual fingerprint
 2039|    820|  memset(ptrailer, 0, 16);
 2040|       |  // Uncomment call to memcpy when we compute an actual fingerprint
 2041|       |  // memcpy(ptrailer, xxh3_fingerprint, sizeof(xxh3_fingerprint));
 2042|    820|  ptrailer += 16;
 2043|       |
 2044|       |  // Sanity check
 2045|    820|  ptrdiff_t actual_trailer_len = ptrailer - trailer;
 2046|    820|  if (actual_trailer_len < 0 || (uint64_t)actual_trailer_len != (uint64_t)trailer_len) {
  ------------------
  |  Branch (2046:7): [True: 0, False: 820]
  |  Branch (2046:33): [True: 0, False: 820]
  ------------------
 2047|      0|    return BLOSC2_ERROR_DATA;
 2048|      0|  }
 2049|       |
 2050|    820|  int32_t header_len;
 2051|    820|  int64_t frame_len;
 2052|    820|  int64_t nbytes;
 2053|    820|  int64_t cbytes;
 2054|    820|  int32_t blocksize;
 2055|    820|  int32_t chunksize;
 2056|    820|  int64_t nchunks;
 2057|    820|  int ret = get_header_info(frame, &header_len, &frame_len, &nbytes, &cbytes,
 2058|    820|                            &blocksize, &chunksize, &nchunks,
 2059|    820|                            NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
 2060|    820|                            frame->schunk->storage->io);
 2061|    820|  if (ret < 0) {
  ------------------
  |  Branch (2061:7): [True: 0, False: 820]
  ------------------
 2062|      0|    BLOSC_TRACE_ERROR("Unable to get meta info from frame.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2063|      0|    return ret;
 2064|      0|  }
 2065|       |
 2066|    820|  int64_t trailer_offset = get_trailer_offset(frame, header_len, nbytes > 0);
 2067|       |
 2068|    820|  if (trailer_offset < BLOSC_EXTENDED_HEADER_LENGTH) {
  ------------------
  |  Branch (2068:7): [True: 0, False: 820]
  ------------------
 2069|      0|    BLOSC_TRACE_ERROR("Unable to get trailer offset in frame.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2070|      0|    return BLOSC2_ERROR_READ_BUFFER;
 2071|      0|  }
 2072|       |
 2073|    820|  blosc2_io_cb *io_cb = blosc2_get_io_cb(frame->schunk->storage->io->id);
 2074|    820|  if (io_cb == NULL) {
  ------------------
  |  Branch (2074:7): [True: 0, False: 820]
  ------------------
 2075|      0|    BLOSC_TRACE_ERROR("Error getting the input/output API");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2076|      0|    return BLOSC2_ERROR_PLUGIN_IO;
 2077|      0|  }
 2078|       |  // Update the trailer.  As there are no internal offsets to the trailer section,
 2079|       |  // and it is always at the end of the frame, we can just write (or overwrite) it
 2080|       |  // at the end of the frame.
 2081|    820|  if (frame->cframe != NULL) {
  ------------------
  |  Branch (2081:7): [True: 820, False: 0]
  ------------------
 2082|    820|    frame->cframe = realloc(frame->cframe, (size_t)(trailer_offset + trailer_len));
 2083|    820|    if (frame->cframe == NULL) {
  ------------------
  |  Branch (2083:9): [True: 0, False: 820]
  ------------------
 2084|      0|      BLOSC_TRACE_ERROR("Cannot realloc space for the frame.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2085|      0|      free(trailer);
 2086|      0|      return BLOSC2_ERROR_MEMORY_ALLOC;
 2087|      0|    }
 2088|    820|    memcpy(frame->cframe + trailer_offset, trailer, trailer_len);
 2089|    820|  }
 2090|      0|  else {
 2091|      0|    void* fp = NULL;
 2092|      0|    if (frame->sframe) {
  ------------------
  |  Branch (2092:9): [True: 0, False: 0]
  ------------------
 2093|      0|      fp = sframe_open_index(frame->urlpath, "rb+",
 2094|      0|                             frame->schunk->storage->io);
 2095|      0|    }
 2096|      0|    else {
 2097|      0|      fp = frame_writer_acquire(frame, io_cb);
 2098|      0|    }
 2099|      0|    if (fp == NULL) {
  ------------------
  |  Branch (2099:9): [True: 0, False: 0]
  ------------------
 2100|      0|      BLOSC_TRACE_ERROR("Error opening file in: %s", frame->urlpath);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2101|      0|      free(trailer);
 2102|      0|      return BLOSC2_ERROR_FILE_OPEN;
 2103|      0|    }
 2104|      0|    int64_t io_pos = frame->file_offset + trailer_offset;
 2105|      0|    int64_t wbytes = io_cb->write(trailer, 1, trailer_len, io_pos, fp);
 2106|      0|    if (wbytes != trailer_len) {
  ------------------
  |  Branch (2106:9): [True: 0, False: 0]
  ------------------
 2107|      0|      BLOSC_TRACE_ERROR("Cannot write the trailer length in trailer.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2108|      0|      frame->file_end = 0;  // a partial write may have moved the end of the file
 2109|      0|      frame_writer_release(frame, io_cb, fp);
 2110|      0|      free(trailer);
 2111|      0|      return BLOSC2_ERROR_FILE_WRITE;
 2112|      0|    }
 2113|      0|    int64_t trunc_pos = frame->file_offset + trailer_offset + trailer_len;
 2114|       |    // Only cut the file when the frame really got shorter than it.  A growing
 2115|       |    // frame leaves no stale bytes behind its trailer, and a truncate is never
 2116|       |    // free: on NFS it is a synchronous flush plus a SETATTR round trip, and XFS
 2117|       |    // flushes the file on the next close after any truncate that does not grow
 2118|       |    // it.  Other backends keep truncating unconditionally.
 2119|       |    //
 2120|       |    // file_end is the size we last left the file at.  A write that failed
 2121|       |    // halfway through an earlier update can have left bytes past it, which are
 2122|       |    // then only cut by the next update that shrinks the frame.  That is
 2123|       |    // harmless: the frame length is read from the header, not the file size.
 2124|      0|    bool must_truncate = true;
 2125|      0|    if (!frame->sframe && frame->schunk->storage->io->id == BLOSC2_IO_FILESYSTEM) {
  ------------------
  |  Branch (2125:9): [True: 0, False: 0]
  |  Branch (2125:27): [True: 0, False: 0]
  ------------------
 2126|      0|      if (frame->file_end <= 0) {
  ------------------
  |  Branch (2126:11): [True: 0, False: 0]
  ------------------
 2127|      0|        frame->file_end = io_cb->size(fp);  // once per handle; negative on error
 2128|      0|      }
 2129|      0|      must_truncate = frame->file_end <= 0 || trunc_pos < frame->file_end;
  ------------------
  |  Branch (2129:23): [True: 0, False: 0]
  |  Branch (2129:47): [True: 0, False: 0]
  ------------------
 2130|      0|    }
 2131|      0|    if (must_truncate && io_cb->truncate(fp, trunc_pos) != 0) {
  ------------------
  |  Branch (2131:9): [True: 0, False: 0]
  |  Branch (2131:26): [True: 0, False: 0]
  ------------------
 2132|      0|      BLOSC_TRACE_ERROR("Cannot truncate the frame.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2133|      0|      frame->file_end = 0;
 2134|      0|      frame_writer_release(frame, io_cb, fp);
 2135|      0|      free(trailer);
 2136|      0|      return BLOSC2_ERROR_FILE_TRUNCATE;
 2137|      0|    }
 2138|      0|    frame->file_end = trunc_pos;
 2139|      0|    if (frame_writer_release(frame, io_cb, fp) < 0) {
  ------------------
  |  Branch (2139:9): [True: 0, False: 0]
  ------------------
 2140|      0|      frame->file_end = 0;
 2141|      0|      free(trailer);
 2142|      0|      return BLOSC2_ERROR_FILE_WRITE;
 2143|      0|    }
 2144|       |
 2145|      0|  }
 2146|    820|  free(trailer);
 2147|       |
 2148|    820|  int rc = update_frame_len(frame, trailer_offset + trailer_len);
 2149|    820|  if (rc < 0) {
  ------------------
  |  Branch (2149:7): [True: 0, False: 820]
  ------------------
 2150|      0|    return rc;
 2151|      0|  }
 2152|    820|  frame->len = trailer_offset + trailer_len;
 2153|    820|  frame->trailer_len = trailer_len;
 2154|       |
 2155|    820|  return 1;
 2156|    820|}
frame_from_cframe:
 2394|  1.95k|blosc2_frame_s* frame_from_cframe(uint8_t *cframe, int64_t len, bool copy) {
 2395|       |  // Get the length of the frame
 2396|  1.95k|  const uint8_t* header = cframe;
 2397|  1.95k|  int64_t frame_len;
 2398|  1.95k|  if (len < FRAME_HEADER_MINLEN) {
  ------------------
  |  |   49|  1.95k|#define FRAME_HEADER_MINLEN (FRAME_FILTER_PIPELINE + 1 + 16)  // 87 <- minimum length
  |  |  ------------------
  |  |  |  |   44|  1.95k|#define FRAME_FILTER_PIPELINE (FRAME_HAS_VLMETALAYERS + 1 + 1) // 70
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|  1.95k|#define FRAME_HAS_VLMETALAYERS (FRAME_NTHREADS_D + 2)  // 68
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|  1.95k|#define FRAME_NTHREADS_D (FRAME_NTHREADS_C + 2 + 1)  // 66
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   41|  1.95k|#define FRAME_NTHREADS_C (FRAME_CHUNKSIZE + 4 + 1)  // 63
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   40|  1.95k|#define FRAME_CHUNKSIZE (FRAME_BLOCKSIZE + 4 + 1)  // 58
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   39|  1.95k|#define FRAME_BLOCKSIZE (FRAME_TYPESIZE + 4 + 1)  // 53
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   38|  1.95k|#define FRAME_TYPESIZE (FRAME_CBYTES + 8 + 1) // 48
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|  1.95k|#define FRAME_CBYTES (FRAME_NBYTES + 8 + 1)  // 39
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   36|  1.95k|#define FRAME_NBYTES (FRAME_FLAGS + 4 + 1)  // 30
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   32|  1.95k|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   31|  1.95k|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   30|  1.95k|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   29|  1.95k|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2398:7): [True: 0, False: 1.95k]
  ------------------
 2399|      0|    return NULL;
 2400|      0|  }
 2401|       |
 2402|  1.95k|  from_big(&frame_len, header + FRAME_LEN, sizeof(frame_len));
  ------------------
  |  |   38|  1.95k|#define from_big(dest, src, itemsize)     endian_handler(false, dest, src, itemsize)
  ------------------
 2403|  1.95k|  if (frame_len != len) {   // sanity check
  ------------------
  |  Branch (2403:7): [True: 3, False: 1.95k]
  ------------------
 2404|      3|    return NULL;
 2405|      3|  }
 2406|       |
 2407|  1.95k|  blosc2_frame_s* frame = frame_alloc();
 2408|  1.95k|  if (frame == NULL) {
  ------------------
  |  Branch (2408:7): [True: 0, False: 1.95k]
  ------------------
 2409|      0|    return NULL;
 2410|      0|  }
 2411|  1.95k|  frame->len = frame_len;
 2412|  1.95k|  frame->file_offset = 0;
 2413|       |
 2414|       |  // Now, the trailer length
 2415|  1.95k|  const uint8_t* trailer = cframe + frame_len - FRAME_TRAILER_MINLEN;
  ------------------
  |  |   58|  1.95k|#define FRAME_TRAILER_MINLEN (25)  // minimum length for the trailer (msgpack overhead)
  ------------------
 2416|  1.95k|  int trailer_offset = FRAME_TRAILER_MINLEN - FRAME_TRAILER_LEN_OFFSET;
  ------------------
  |  |   58|  1.95k|#define FRAME_TRAILER_MINLEN (25)  // minimum length for the trailer (msgpack overhead)
  ------------------
                int trailer_offset = FRAME_TRAILER_MINLEN - FRAME_TRAILER_LEN_OFFSET;
  ------------------
  |  |   59|  1.95k|#define FRAME_TRAILER_LEN_OFFSET (22)  // offset to trailer length (counting from the end)
  ------------------
 2417|  1.95k|  if (trailer[trailer_offset - 1] != 0xce) {
  ------------------
  |  Branch (2417:7): [True: 0, False: 1.95k]
  ------------------
 2418|      0|    blosc2_pthread_mutex_destroy(&frame->read_fp_mutex);
  ------------------
  |  |   91|      0|#define blosc2_pthread_mutex_destroy(a) pthread_mutex_destroy((a))
  ------------------
 2419|      0|    free(frame);
 2420|      0|    return NULL;
 2421|      0|  }
 2422|  1.95k|  uint32_t trailer_len;
 2423|  1.95k|  from_big(&trailer_len, trailer + trailer_offset, sizeof(trailer_len));
  ------------------
  |  |   38|  1.95k|#define from_big(dest, src, itemsize)     endian_handler(false, dest, src, itemsize)
  ------------------
 2424|  1.95k|  if (trailer_len < FRAME_TRAILER_MINLEN || trailer_len > INT32_MAX ||
  ------------------
  |  |   58|  3.91k|#define FRAME_TRAILER_MINLEN (25)  // minimum length for the trailer (msgpack overhead)
  ------------------
  |  Branch (2424:7): [True: 0, False: 1.95k]
  |  Branch (2424:45): [True: 2, False: 1.95k]
  ------------------
 2425|  1.95k|      (int64_t)trailer_len > frame_len ||
  ------------------
  |  Branch (2425:7): [True: 0, False: 1.95k]
  ------------------
 2426|  1.95k|      (int64_t)trailer_len > frame_len - FRAME_HEADER_MINLEN) {
  ------------------
  |  |   49|  1.95k|#define FRAME_HEADER_MINLEN (FRAME_FILTER_PIPELINE + 1 + 16)  // 87 <- minimum length
  |  |  ------------------
  |  |  |  |   44|  1.95k|#define FRAME_FILTER_PIPELINE (FRAME_HAS_VLMETALAYERS + 1 + 1) // 70
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|  1.95k|#define FRAME_HAS_VLMETALAYERS (FRAME_NTHREADS_D + 2)  // 68
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|  1.95k|#define FRAME_NTHREADS_D (FRAME_NTHREADS_C + 2 + 1)  // 66
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   41|  1.95k|#define FRAME_NTHREADS_C (FRAME_CHUNKSIZE + 4 + 1)  // 63
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   40|  1.95k|#define FRAME_CHUNKSIZE (FRAME_BLOCKSIZE + 4 + 1)  // 58
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   39|  1.95k|#define FRAME_BLOCKSIZE (FRAME_TYPESIZE + 4 + 1)  // 53
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   38|  1.95k|#define FRAME_TYPESIZE (FRAME_CBYTES + 8 + 1) // 48
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|  1.95k|#define FRAME_CBYTES (FRAME_NBYTES + 8 + 1)  // 39
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   36|  1.95k|#define FRAME_NBYTES (FRAME_FLAGS + 4 + 1)  // 30
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   32|  1.95k|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   31|  1.95k|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   30|  1.95k|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   29|  1.95k|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2426:7): [True: 0, False: 1.95k]
  ------------------
 2427|      2|    blosc2_pthread_mutex_destroy(&frame->read_fp_mutex);
  ------------------
  |  |   91|      2|#define blosc2_pthread_mutex_destroy(a) pthread_mutex_destroy((a))
  ------------------
 2428|      2|    free(frame);
 2429|      2|    return NULL;
 2430|      2|  }
 2431|  1.95k|  frame->trailer_len = trailer_len;
 2432|       |
 2433|  1.95k|  if (copy) {
  ------------------
  |  Branch (2433:7): [True: 0, False: 1.95k]
  ------------------
 2434|      0|    frame->cframe = malloc((size_t)len);
 2435|      0|    memcpy(frame->cframe, cframe, (size_t)len);
 2436|      0|  }
 2437|  1.95k|  else {
 2438|  1.95k|    frame->cframe = cframe;
 2439|  1.95k|    frame->avoid_cframe_free = true;
 2440|  1.95k|  }
 2441|       |
 2442|  1.95k|  return frame;
 2443|  1.95k|}
frame_from_schunk:
 2450|     70|int64_t frame_from_schunk(blosc2_schunk *schunk, blosc2_frame_s *frame) {
 2451|     70|  frame->file_offset = 0;
 2452|     70|  int64_t nchunks = schunk->nchunks;
 2453|     70|  int64_t cbytes = schunk->cbytes;
 2454|     70|  int32_t chunk_cbytes;
 2455|     70|  int32_t chunk_nbytes;
 2456|     70|  uint64_t* data_tmp = NULL;
 2457|     70|  uint8_t* off_chunk = NULL;
 2458|     70|  blosc2_io_cb* io_cb = NULL;
 2459|     70|  void* fp = NULL;
 2460|     70|  int rc;
 2461|       |
 2462|     70|  uint8_t* h2 = new_header_frame(schunk, frame);
 2463|     70|  if (h2 == NULL) {
  ------------------
  |  Branch (2463:7): [True: 0, False: 70]
  ------------------
 2464|      0|    return BLOSC2_ERROR_DATA;
 2465|      0|  }
 2466|     70|  uint32_t h2len;
 2467|     70|  from_big(&h2len, h2 + FRAME_HEADER_LEN, sizeof(h2len));
  ------------------
  |  |   38|     70|#define from_big(dest, src, itemsize)     endian_handler(false, dest, src, itemsize)
  ------------------
 2468|       |  // Build the offsets chunk
 2469|     70|  int32_t chunksize = -1;
 2470|     70|  int32_t off_cbytes = 0;
 2471|     70|  uint64_t coffset = 0;
 2472|     70|  int32_t off_nbytes;
 2473|     70|  if (!blosc2_nchunks_to_offsets_nbytes(nchunks, &off_nbytes)) {
  ------------------
  |  Branch (2473:7): [True: 0, False: 70]
  ------------------
 2474|      0|    BLOSC_TRACE_ERROR("Too many chunks for offsets representation.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2475|      0|    rc = BLOSC2_ERROR_DATA;
 2476|      0|    goto failed;
 2477|      0|  }
 2478|     70|  data_tmp = malloc((size_t)off_nbytes);
 2479|     70|  if (data_tmp == NULL) {
  ------------------
  |  Branch (2479:7): [True: 0, False: 70]
  ------------------
 2480|      0|    BLOSC_TRACE_ERROR("Cannot allocate memory for offset data.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2481|      0|    rc = BLOSC2_ERROR_MEMORY_ALLOC;
 2482|      0|    goto failed;
 2483|      0|  }
 2484|     70|  for (int64_t i = 0; i < nchunks; i++) {
  ------------------
  |  Branch (2484:23): [True: 0, False: 70]
  ------------------
 2485|      0|    rc = blosc2_cbuffer_sizes(schunk->data[i], &chunk_nbytes, &chunk_cbytes, NULL);
 2486|      0|    if (rc < 0) {
  ------------------
  |  Branch (2486:9): [True: 0, False: 0]
  ------------------
 2487|      0|      goto failed;
 2488|      0|    }
 2489|      0|    data_tmp[i] = coffset;
 2490|      0|    coffset += chunk_cbytes;
 2491|      0|    if (i == 0) {
  ------------------
  |  Branch (2491:9): [True: 0, False: 0]
  ------------------
 2492|      0|      chunksize = chunk_nbytes;
 2493|      0|    }
 2494|      0|    else if (chunksize != chunk_nbytes) {
  ------------------
  |  Branch (2494:14): [True: 0, False: 0]
  ------------------
 2495|       |      // Variable size  // TODO: update flags for this (or do not use them at all)
 2496|      0|      chunksize = 0;
 2497|      0|    }
 2498|      0|  }
 2499|     70|  if ((int64_t)coffset != cbytes) {
  ------------------
  |  Branch (2499:7): [True: 0, False: 70]
  ------------------
 2500|      0|    rc = BLOSC2_ERROR_DATA;
 2501|      0|    goto failed;
 2502|      0|  }
 2503|     70|  if (nchunks > 0) {
  ------------------
  |  Branch (2503:7): [True: 0, False: 70]
  ------------------
 2504|      0|    off_cbytes = compress_offsets((const int64_t*)data_tmp, off_nbytes, off_nbytes + BLOSC2_MAX_OVERHEAD,
 2505|      0|                                  &off_chunk);
 2506|      0|    if (off_cbytes < 0) {
  ------------------
  |  Branch (2506:9): [True: 0, False: 0]
  ------------------
 2507|      0|      rc = off_cbytes;
 2508|      0|      goto failed;
 2509|      0|    }
 2510|      0|  }
 2511|     70|  else {
 2512|     70|    off_cbytes = 0;
 2513|     70|  }
 2514|       |
 2515|       |  // Now that we know them, fill the chunksize and frame length in header
 2516|     70|  to_big(h2 + FRAME_CHUNKSIZE, &chunksize, sizeof(chunksize));
  ------------------
  |  |   37|     70|#define to_big(dest, src, itemsize)       endian_handler(false, dest, src, itemsize)
  ------------------
 2517|     70|  if (chunksize == 0) {
  ------------------
  |  Branch (2517:7): [True: 0, False: 70]
  ------------------
 2518|      0|    h2[FRAME_FLAGS] |= FRAME_VARIABLE_CHUNKS;
  ------------------
  |  |   32|      0|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  ------------------
  |  |  |  |   31|      0|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  ------------------
  |  |  |  |  |  |   30|      0|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   29|      0|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                  h2[FRAME_FLAGS] |= FRAME_VARIABLE_CHUNKS;
  ------------------
  |  |   26|      0|#define FRAME_VARIABLE_CHUNKS (1U << 6)
  ------------------
 2519|      0|  }
 2520|     70|  else {
 2521|     70|    h2[FRAME_FLAGS] &= (uint8_t)~FRAME_VARIABLE_CHUNKS;
  ------------------
  |  |   32|     70|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  ------------------
  |  |  |  |   31|     70|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  ------------------
  |  |  |  |  |  |   30|     70|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   29|     70|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                  h2[FRAME_FLAGS] &= (uint8_t)~FRAME_VARIABLE_CHUNKS;
  ------------------
  |  |   26|     70|#define FRAME_VARIABLE_CHUNKS (1U << 6)
  ------------------
 2522|     70|  }
 2523|     70|  if (schunk->chunksize == 0 || (schunk->flags2 & BLOSC2_VL_BLOCKS)) {
  ------------------
  |  Branch (2523:7): [True: 0, False: 70]
  |  Branch (2523:33): [True: 0, False: 70]
  ------------------
 2524|      0|    h2[FRAME_FLAGS] = (uint8_t)((h2[FRAME_FLAGS] & (uint8_t)~0x0fu) | BLOSC2_VERSION_FRAME_FORMAT_VL_BLOCKS);
  ------------------
  |  |   32|      0|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  ------------------
  |  |  |  |   31|      0|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  ------------------
  |  |  |  |  |  |   30|      0|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   29|      0|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                  h2[FRAME_FLAGS] = (uint8_t)((h2[FRAME_FLAGS] & (uint8_t)~0x0fu) | BLOSC2_VERSION_FRAME_FORMAT_VL_BLOCKS);
  ------------------
  |  |   32|      0|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  ------------------
  |  |  |  |   31|      0|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  ------------------
  |  |  |  |  |  |   30|      0|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   29|      0|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2525|      0|    h2[FRAME_FLAGS] |= FRAME_VL_BLOCKS;
  ------------------
  |  |   32|      0|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  ------------------
  |  |  |  |   31|      0|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  ------------------
  |  |  |  |  |  |   30|      0|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   29|      0|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                  h2[FRAME_FLAGS] |= FRAME_VL_BLOCKS;
  ------------------
  |  |   27|      0|#define FRAME_VL_BLOCKS (1U << 7)
  ------------------
 2526|      0|  }
 2527|     70|  else {
 2528|     70|    h2[FRAME_FLAGS] = (uint8_t)((h2[FRAME_FLAGS] & (uint8_t)~0x0fu) | BLOSC2_VERSION_FRAME_FORMAT_RC1);
  ------------------
  |  |   32|     70|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  ------------------
  |  |  |  |   31|     70|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  ------------------
  |  |  |  |  |  |   30|     70|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   29|     70|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                  h2[FRAME_FLAGS] = (uint8_t)((h2[FRAME_FLAGS] & (uint8_t)~0x0fu) | BLOSC2_VERSION_FRAME_FORMAT_RC1);
  ------------------
  |  |   32|     70|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  ------------------
  |  |  |  |   31|     70|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  ------------------
  |  |  |  |  |  |   30|     70|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   29|     70|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2529|     70|    h2[FRAME_FLAGS] &= (uint8_t)~FRAME_VL_BLOCKS;
  ------------------
  |  |   32|     70|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  ------------------
  |  |  |  |   31|     70|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  ------------------
  |  |  |  |  |  |   30|     70|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   29|     70|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                  h2[FRAME_FLAGS] &= (uint8_t)~FRAME_VL_BLOCKS;
  ------------------
  |  |   27|     70|#define FRAME_VL_BLOCKS (1U << 7)
  ------------------
 2530|     70|  }
 2531|     70|  frame->len = h2len + cbytes + off_cbytes + FRAME_TRAILER_MINLEN;
  ------------------
  |  |   58|     70|#define FRAME_TRAILER_MINLEN (25)  // minimum length for the trailer (msgpack overhead)
  ------------------
 2532|     70|  if (frame->sframe) {
  ------------------
  |  Branch (2532:7): [True: 0, False: 70]
  ------------------
 2533|      0|    frame->len = h2len + off_cbytes + FRAME_TRAILER_MINLEN;
  ------------------
  |  |   58|      0|#define FRAME_TRAILER_MINLEN (25)  // minimum length for the trailer (msgpack overhead)
  ------------------
 2534|      0|  }
 2535|     70|  int64_t tbytes = frame->len;
 2536|     70|  to_big(h2 + FRAME_LEN, &tbytes, sizeof(tbytes));
  ------------------
  |  |   37|     70|#define to_big(dest, src, itemsize)       endian_handler(false, dest, src, itemsize)
  ------------------
 2537|       |
 2538|     70|  const blosc2_io* io = frame->schunk->storage->io;
 2539|     70|  io_cb = blosc2_get_io_cb(io->id);
 2540|     70|  if (io_cb == NULL) {
  ------------------
  |  Branch (2540:7): [True: 0, False: 70]
  ------------------
 2541|      0|    BLOSC_TRACE_ERROR("Error getting the input/output API");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2542|      0|    rc = BLOSC2_ERROR_PLUGIN_IO;
 2543|      0|    goto failed;
 2544|      0|  }
 2545|       |
 2546|       |  // Create the frame and put the header at the beginning
 2547|     70|  int64_t io_pos = 0;
 2548|     70|  if (frame->urlpath == NULL) {
  ------------------
  |  Branch (2548:7): [True: 70, False: 0]
  ------------------
 2549|     70|    frame->cframe = malloc((size_t)frame->len);
 2550|     70|    memcpy(frame->cframe, h2, h2len);
 2551|     70|  }
 2552|      0|  else {
 2553|      0|    if (frame->sframe) {
  ------------------
  |  Branch (2553:9): [True: 0, False: 0]
  ------------------
 2554|      0|      fp = sframe_open_index(frame->urlpath, "wb", io);
 2555|      0|    }
 2556|      0|    else {
 2557|       |      // The file is about to be recreated from scratch; drop any cached reader
 2558|      0|      frame_reader_invalidate(frame);
 2559|       |      // Where the handle can stay open as the cached writer (which is "rb+"
 2560|       |      // everywhere else), open it readable too
 2561|      0|      fp = io_cb->open(frame->urlpath, reader_cacheable(io) ? "wb+" : "wb", io->params);
  ------------------
  |  Branch (2561:40): [True: 0, False: 0]
  ------------------
 2562|      0|    }
 2563|      0|    if (fp == NULL) {
  ------------------
  |  Branch (2563:9): [True: 0, False: 0]
  ------------------
 2564|      0|      BLOSC_TRACE_ERROR("Error creating file in: %s", frame->urlpath);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2565|      0|      rc = BLOSC2_ERROR_FILE_OPEN;
 2566|      0|      goto failed;
 2567|      0|    }
 2568|      0|    if (io_cb->write(h2, h2len, 1, io_pos, fp) != 1) {
  ------------------
  |  Branch (2568:9): [True: 0, False: 0]
  ------------------
 2569|      0|      BLOSC_TRACE_ERROR("Cannot write the header to %s.", frame->urlpath);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2570|      0|      rc = BLOSC2_ERROR_FILE_WRITE;
 2571|      0|      goto failed;
 2572|      0|    }
 2573|      0|    io_pos += h2len;
 2574|      0|  }
 2575|       |
 2576|       |  // Fill the frame with the actual data chunks
 2577|     70|  if (!frame->sframe) {
  ------------------
  |  Branch (2577:7): [True: 70, False: 0]
  ------------------
 2578|     70|    coffset = 0;
 2579|     70|    for (int64_t i = 0; i < nchunks; i++) {
  ------------------
  |  Branch (2579:25): [True: 0, False: 70]
  ------------------
 2580|      0|      uint8_t* data_chunk = schunk->data[i];
 2581|      0|      rc = blosc2_cbuffer_sizes(data_chunk, NULL, &chunk_cbytes, NULL);
 2582|      0|      if (rc < 0) {
  ------------------
  |  Branch (2582:11): [True: 0, False: 0]
  ------------------
 2583|      0|        goto failed;
 2584|      0|      }
 2585|      0|      if (frame->urlpath == NULL) {
  ------------------
  |  Branch (2585:11): [True: 0, False: 0]
  ------------------
 2586|      0|        memcpy(frame->cframe + h2len + coffset, data_chunk, (size_t)chunk_cbytes);
 2587|      0|      } else {
 2588|      0|        if (io_cb->write(data_chunk, chunk_cbytes, 1, io_pos, fp) != 1) {
  ------------------
  |  Branch (2588:13): [True: 0, False: 0]
  ------------------
 2589|      0|          BLOSC_TRACE_ERROR("Cannot write chunk %" PRId64 " to %s.", i, frame->urlpath);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2590|      0|          rc = BLOSC2_ERROR_FILE_WRITE;
 2591|      0|          goto failed;
 2592|      0|        }
 2593|      0|        io_pos += chunk_cbytes;
 2594|      0|      }
 2595|      0|      coffset += chunk_cbytes;
 2596|      0|    }
 2597|     70|    if ((int64_t)coffset != cbytes) {
  ------------------
  |  Branch (2597:9): [True: 0, False: 70]
  ------------------
 2598|      0|      rc = BLOSC2_ERROR_FAILURE;
 2599|      0|      goto failed;
 2600|      0|    }
 2601|     70|  }
 2602|       |
 2603|       |  // Copy the offsets chunk at the end of the frame (there is none without chunks)
 2604|     70|  if (frame->urlpath == NULL) {
  ------------------
  |  Branch (2604:7): [True: 70, False: 0]
  ------------------
 2605|     70|    if (off_cbytes > 0) {
  ------------------
  |  Branch (2605:9): [True: 0, False: 70]
  ------------------
 2606|      0|      memcpy(frame->cframe + h2len + cbytes, off_chunk, off_cbytes);
 2607|      0|    }
 2608|     70|  }
 2609|      0|  else {
 2610|      0|    if (off_cbytes > 0) {
  ------------------
  |  Branch (2610:9): [True: 0, False: 0]
  ------------------
 2611|      0|      if (io_cb->write(off_chunk, off_cbytes, 1, io_pos, fp) != 1) {
  ------------------
  |  Branch (2611:11): [True: 0, False: 0]
  ------------------
 2612|      0|        BLOSC_TRACE_ERROR("Cannot write offsets chunk to %s.", frame->urlpath);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2613|      0|        rc = BLOSC2_ERROR_FILE_WRITE;
 2614|      0|        goto failed;
 2615|      0|      }
 2616|      0|    }
 2617|      0|    if (!frame->sframe) {
  ------------------
  |  Branch (2617:9): [True: 0, False: 0]
  ------------------
 2618|      0|      frame->needs_sync = true;
 2619|      0|    }
 2620|       |    // Only a handle opened readable above can be adopted
 2621|      0|    if (!frame_writer_adopt(frame, io, fp)) {
  ------------------
  |  Branch (2621:9): [True: 0, False: 0]
  ------------------
 2622|      0|      int close_rc = io_cb->close(fp);
 2623|      0|      fp = NULL;
 2624|      0|      if (close_rc != 0) {
  ------------------
  |  Branch (2624:11): [True: 0, False: 0]
  ------------------
 2625|      0|        BLOSC_TRACE_ERROR("Cannot close the frame file %s.", frame->urlpath);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2626|      0|        rc = BLOSC2_ERROR_FILE_WRITE;
 2627|      0|        goto failed;
 2628|      0|      }
 2629|      0|    }
 2630|      0|    fp = NULL;
 2631|       |    // The file was created from scratch, so its size is exactly what we wrote
 2632|      0|    frame->file_end = frame->sframe ? 0 : io_pos + off_cbytes;
  ------------------
  |  Branch (2632:23): [True: 0, False: 0]
  ------------------
 2633|      0|  }
 2634|     70|  free(off_chunk);
 2635|     70|  free(data_tmp);
 2636|     70|  free(h2);
 2637|     70|  rc = frame_update_trailer(frame, schunk);
 2638|     70|  if (rc < 0) {
  ------------------
  |  Branch (2638:7): [True: 0, False: 70]
  ------------------
 2639|      0|    return rc;
 2640|      0|  }
 2641|       |
 2642|     70|  return frame->len;
 2643|       |
 2644|      0|  failed:
 2645|      0|  if (fp != NULL) {
  ------------------
  |  Branch (2645:7): [True: 0, False: 0]
  ------------------
 2646|      0|    io_cb->close(fp);
 2647|      0|  }
 2648|      0|  free(off_chunk);
 2649|      0|  free(data_tmp);
 2650|      0|  free(h2);
 2651|      0|  return rc;
 2652|     70|}
get_coffsets:
 2657|  5.04k|                      int64_t nchunks, int32_t *off_cbytes) {
 2658|  5.04k|  int32_t chunk_cbytes;
 2659|  5.04k|  int rc;
 2660|       |
 2661|  5.04k|  if (frame->coffsets != NULL) {
  ------------------
  |  Branch (2661:7): [True: 0, False: 5.04k]
  ------------------
 2662|      0|    if (off_cbytes != NULL) {
  ------------------
  |  Branch (2662:9): [True: 0, False: 0]
  ------------------
 2663|      0|      rc = blosc2_cbuffer_sizes(frame->coffsets, NULL, &chunk_cbytes, NULL);
 2664|      0|      if (rc < 0) {
  ------------------
  |  Branch (2664:11): [True: 0, False: 0]
  ------------------
 2665|      0|        return NULL;
 2666|      0|      }
 2667|      0|      *off_cbytes = (int32_t)chunk_cbytes;
 2668|      0|    }
 2669|      0|    return frame->coffsets;
 2670|      0|  }
 2671|  5.04k|  if (frame->cframe != NULL) {
  ------------------
  |  Branch (2671:7): [True: 5.04k, False: 0]
  ------------------
 2672|  5.04k|    int64_t off_pos = header_len;
 2673|  5.04k|    if (cbytes < INT64_MAX - header_len) {
  ------------------
  |  Branch (2673:9): [True: 5.01k, False: 35]
  ------------------
 2674|  5.01k|      off_pos += cbytes;
 2675|  5.01k|    }
 2676|       |    // Check that there is enough room to read Blosc header
 2677|  5.04k|    if (off_pos < 0 || off_pos > INT64_MAX - BLOSC_EXTENDED_HEADER_LENGTH ||
  ------------------
  |  Branch (2677:9): [True: 0, False: 5.04k]
  |  Branch (2677:24): [True: 1, False: 5.04k]
  ------------------
 2678|  5.04k|        off_pos + BLOSC_EXTENDED_HEADER_LENGTH > frame->len) {
  ------------------
  |  Branch (2678:9): [True: 4, False: 5.04k]
  ------------------
 2679|      5|      BLOSC_TRACE_ERROR("Cannot read the offsets outside of frame boundary.");
  ------------------
  |  |   93|      5|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      5|    do {                                            \
  |  |  |  |   98|      5|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      5|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 5, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      5|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2680|      5|      return NULL;
 2681|      5|    }
 2682|       |    // For in-memory frames, the coffset is just one pointer away
 2683|  5.04k|    uint8_t* off_start = frame->cframe + off_pos;
 2684|  5.04k|    if (off_cbytes != NULL) {
  ------------------
  |  Branch (2684:9): [True: 5.04k, False: 0]
  ------------------
 2685|  5.04k|      int32_t chunk_nbytes;
 2686|  5.04k|      int32_t chunk_blocksize;
 2687|  5.04k|      rc = blosc2_cbuffer_sizes(off_start, &chunk_nbytes, &chunk_cbytes, &chunk_blocksize);
 2688|  5.04k|      if (rc < 0) {
  ------------------
  |  Branch (2688:11): [True: 1, False: 5.04k]
  ------------------
 2689|      1|        return NULL;
 2690|      1|      }
 2691|  5.04k|      *off_cbytes = (int32_t)chunk_cbytes;
 2692|  5.04k|      if (*off_cbytes < 0 || off_pos + *off_cbytes > frame->len) {
  ------------------
  |  Branch (2692:11): [True: 0, False: 5.04k]
  |  Branch (2692:30): [True: 31, False: 5.01k]
  ------------------
 2693|     31|        BLOSC_TRACE_ERROR("Cannot read the cbytes outside of frame boundary.");
  ------------------
  |  |   93|     31|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|     31|    do {                                            \
  |  |  |  |   98|     31|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|     31|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 31, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|     31|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2694|     31|        return NULL;
 2695|     31|      }
 2696|  5.01k|      int32_t expected_off_nbytes;
 2697|  5.01k|      if (!blosc2_nchunks_to_offsets_nbytes(nchunks, &expected_off_nbytes)) {
  ------------------
  |  Branch (2697:11): [True: 0, False: 5.01k]
  ------------------
 2698|      0|        BLOSC_TRACE_ERROR("Too many chunks for offsets representation.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2699|      0|        return NULL;
 2700|      0|      }
 2701|  5.01k|      if (chunk_nbytes != expected_off_nbytes) {
  ------------------
  |  Branch (2701:11): [True: 3, False: 5.00k]
  ------------------
 2702|      3|        BLOSC_TRACE_ERROR("The number of chunks in offset idx "
  ------------------
  |  |   93|      3|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      3|    do {                                            \
  |  |  |  |   98|      3|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      3|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 3, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      3|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2703|      3|                          "does not match the ones in the header frame.");
 2704|      3|        return NULL;
 2705|      3|      }
 2706|       |
 2707|  5.01k|    }
 2708|  5.00k|    return off_start;
 2709|  5.04k|  }
 2710|       |
 2711|      0|  int64_t trailer_offset = get_trailer_offset(frame, header_len, true);
 2712|       |
 2713|      0|  if (trailer_offset < BLOSC_EXTENDED_HEADER_LENGTH || trailer_offset + FRAME_TRAILER_MINLEN > frame->len) {
  ------------------
  |  |   58|      0|#define FRAME_TRAILER_MINLEN (25)  // minimum length for the trailer (msgpack overhead)
  ------------------
  |  Branch (2713:7): [True: 0, False: 0]
  |  Branch (2713:56): [True: 0, False: 0]
  ------------------
 2714|      0|    BLOSC_TRACE_ERROR("Cannot read the trailer out of the frame.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2715|      0|    return NULL;
 2716|      0|  }
 2717|       |
 2718|      0|  int64_t coffsets_cbytes64;
 2719|      0|  if (frame->sframe) {
  ------------------
  |  Branch (2719:7): [True: 0, False: 0]
  ------------------
 2720|      0|    coffsets_cbytes64 = trailer_offset - header_len;
 2721|      0|  }
 2722|      0|  else {
 2723|      0|    coffsets_cbytes64 = trailer_offset - (header_len + cbytes);
 2724|      0|  }
 2725|      0|  if (coffsets_cbytes64 <= 0 || coffsets_cbytes64 > INT32_MAX) {
  ------------------
  |  Branch (2725:7): [True: 0, False: 0]
  |  Branch (2725:33): [True: 0, False: 0]
  ------------------
 2726|      0|    BLOSC_TRACE_ERROR("Offsets chunk size is out of bounds.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2727|      0|    return NULL;
 2728|      0|  }
 2729|      0|  int32_t coffsets_cbytes = (int32_t)coffsets_cbytes64;
 2730|       |
 2731|      0|  if (off_cbytes != NULL) {
  ------------------
  |  Branch (2731:7): [True: 0, False: 0]
  ------------------
 2732|      0|    *off_cbytes = coffsets_cbytes;
 2733|      0|  }
 2734|       |
 2735|      0|  blosc2_io_cb *io_cb = blosc2_get_io_cb(frame->schunk->storage->io->id);
 2736|      0|  if (io_cb == NULL) {
  ------------------
  |  Branch (2736:7): [True: 0, False: 0]
  ------------------
 2737|      0|    BLOSC_TRACE_ERROR("Error getting the input/output API");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2738|      0|    return NULL;
 2739|      0|  }
 2740|       |
 2741|      0|  void* fp = NULL;
 2742|      0|  uint8_t* coffsets;
 2743|      0|  if (io_cb->is_allocation_necessary) {
  ------------------
  |  Branch (2743:7): [True: 0, False: 0]
  ------------------
 2744|      0|    coffsets = malloc((size_t)coffsets_cbytes);
 2745|      0|    frame->coffsets_needs_free = true;
 2746|      0|  }
 2747|      0|  else {
 2748|      0|    frame->coffsets_needs_free = false;
 2749|      0|  }
 2750|       |
 2751|      0|  int64_t io_pos = 0;
 2752|      0|  if (frame->sframe) {
  ------------------
  |  Branch (2752:7): [True: 0, False: 0]
  ------------------
 2753|      0|    fp = sframe_open_index(frame->urlpath, "rb",
 2754|      0|                           frame->schunk->storage->io);
 2755|      0|    if (fp == NULL) {
  ------------------
  |  Branch (2755:9): [True: 0, False: 0]
  ------------------
 2756|      0|      BLOSC_TRACE_ERROR("Error opening file in: %s", frame->urlpath);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2757|      0|      return NULL;
 2758|      0|    }
 2759|      0|    io_pos = header_len + 0;
 2760|      0|  }
 2761|      0|  else {
 2762|      0|    fp = frame_reader_acquire(frame, frame->schunk->storage->io);
 2763|      0|    if (fp == NULL) {
  ------------------
  |  Branch (2763:9): [True: 0, False: 0]
  ------------------
 2764|      0|      BLOSC_TRACE_ERROR("Error opening file in: %s", frame->urlpath);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2765|      0|      return NULL;
 2766|      0|    }
 2767|      0|    io_pos = frame->file_offset + header_len + cbytes;
 2768|      0|  }
 2769|      0|  int64_t rbytes = io_cb->read((void**)&coffsets, 1, coffsets_cbytes, io_pos, fp);
 2770|      0|  frame_reader_release(frame, io_cb, fp);
 2771|      0|  if (rbytes != coffsets_cbytes) {
  ------------------
  |  Branch (2771:7): [True: 0, False: 0]
  ------------------
 2772|      0|    BLOSC_TRACE_ERROR("Cannot read the offsets out of the frame.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2773|      0|    if (frame->coffsets_needs_free)
  ------------------
  |  Branch (2773:9): [True: 0, False: 0]
  ------------------
 2774|      0|      free(coffsets);
 2775|      0|    return NULL;
 2776|      0|  }
 2777|      0|  frame->coffsets = coffsets;
 2778|      0|  return coffsets;
 2779|      0|}
frame_update_header:
 2839|    750|int frame_update_header(blosc2_frame_s* frame, blosc2_schunk* schunk, bool new) {
 2840|    750|  uint8_t* framep = frame->cframe;
 2841|    750|  uint8_t* header_ptr;
 2842|    750|  uint8_t header[FRAME_HEADER_MINLEN];
 2843|       |
 2844|    750|  if (frame->len <= 0) {
  ------------------
  |  Branch (2844:7): [True: 0, False: 750]
  ------------------
 2845|      0|    return BLOSC2_ERROR_INVALID_PARAM;
 2846|      0|  }
 2847|       |
 2848|    750|  if (new && schunk->cbytes > 0) {
  ------------------
  |  Branch (2848:7): [True: 70, False: 680]
  |  Branch (2848:14): [True: 0, False: 70]
  ------------------
 2849|      0|    BLOSC_TRACE_ERROR("New metalayers cannot be added after actual data "
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2850|      0|                      "has been appended.");
 2851|      0|    return BLOSC2_ERROR_INVALID_PARAM;
 2852|      0|  }
 2853|       |
 2854|    750|  blosc2_io_cb *io_cb = blosc2_get_io_cb(frame->schunk->storage->io->id);
 2855|    750|  if (io_cb == NULL) {
  ------------------
  |  Branch (2855:7): [True: 0, False: 750]
  ------------------
 2856|      0|    BLOSC_TRACE_ERROR("Error getting the input/output API");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2857|      0|    return BLOSC2_ERROR_PLUGIN_IO;
 2858|      0|  }
 2859|       |
 2860|    750|  if (frame->cframe == NULL) {
  ------------------
  |  Branch (2860:7): [True: 0, False: 750]
  ------------------
 2861|      0|    int64_t rbytes = 0;
 2862|      0|    void* fp = NULL;
 2863|      0|    int64_t io_pos = 0;
 2864|      0|    if (frame->sframe) {
  ------------------
  |  Branch (2864:9): [True: 0, False: 0]
  ------------------
 2865|      0|      fp = sframe_open_index(frame->urlpath, "rb+",
 2866|      0|                             frame->schunk->storage->io);
 2867|      0|      if (fp == NULL) {
  ------------------
  |  Branch (2867:11): [True: 0, False: 0]
  ------------------
 2868|      0|        BLOSC_TRACE_ERROR("Error opening file in: %s", frame->urlpath);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2869|      0|        return BLOSC2_ERROR_FILE_OPEN;
 2870|      0|      }
 2871|      0|    }
 2872|      0|    else {
 2873|      0|      frame_reader_revalidate(frame);
 2874|      0|      fp = frame_reader_acquire(frame, frame->schunk->storage->io);
 2875|      0|      if (fp == NULL) {
  ------------------
  |  Branch (2875:11): [True: 0, False: 0]
  ------------------
 2876|      0|        BLOSC_TRACE_ERROR("Error opening file in: %s", frame->urlpath);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2877|      0|        return BLOSC2_ERROR_FILE_OPEN;
 2878|      0|      }
 2879|      0|      io_pos = frame->file_offset;
 2880|      0|    }
 2881|      0|    if (fp != NULL) {
  ------------------
  |  Branch (2881:9): [True: 0, False: 0]
  ------------------
 2882|      0|      if (io_cb->is_allocation_necessary)
  ------------------
  |  Branch (2882:11): [True: 0, False: 0]
  ------------------
 2883|      0|        header_ptr = header;
 2884|      0|      rbytes = io_cb->read((void**)&header_ptr, 1, FRAME_HEADER_MINLEN, io_pos, fp);
  ------------------
  |  |   49|      0|#define FRAME_HEADER_MINLEN (FRAME_FILTER_PIPELINE + 1 + 16)  // 87 <- minimum length
  |  |  ------------------
  |  |  |  |   44|      0|#define FRAME_FILTER_PIPELINE (FRAME_HAS_VLMETALAYERS + 1 + 1) // 70
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|      0|#define FRAME_HAS_VLMETALAYERS (FRAME_NTHREADS_D + 2)  // 68
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define FRAME_NTHREADS_D (FRAME_NTHREADS_C + 2 + 1)  // 66
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   41|      0|#define FRAME_NTHREADS_C (FRAME_CHUNKSIZE + 4 + 1)  // 63
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   40|      0|#define FRAME_CHUNKSIZE (FRAME_BLOCKSIZE + 4 + 1)  // 58
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   39|      0|#define FRAME_BLOCKSIZE (FRAME_TYPESIZE + 4 + 1)  // 53
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   38|      0|#define FRAME_TYPESIZE (FRAME_CBYTES + 8 + 1) // 48
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|      0|#define FRAME_CBYTES (FRAME_NBYTES + 8 + 1)  // 39
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   36|      0|#define FRAME_NBYTES (FRAME_FLAGS + 4 + 1)  // 30
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   32|      0|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   31|      0|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   30|      0|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   29|      0|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2885|      0|      frame_reader_release(frame, io_cb, fp);
 2886|      0|    }
 2887|      0|    (void) rbytes;
 2888|      0|    if (rbytes != FRAME_HEADER_MINLEN) {
  ------------------
  |  |   49|      0|#define FRAME_HEADER_MINLEN (FRAME_FILTER_PIPELINE + 1 + 16)  // 87 <- minimum length
  |  |  ------------------
  |  |  |  |   44|      0|#define FRAME_FILTER_PIPELINE (FRAME_HAS_VLMETALAYERS + 1 + 1) // 70
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|      0|#define FRAME_HAS_VLMETALAYERS (FRAME_NTHREADS_D + 2)  // 68
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define FRAME_NTHREADS_D (FRAME_NTHREADS_C + 2 + 1)  // 66
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   41|      0|#define FRAME_NTHREADS_C (FRAME_CHUNKSIZE + 4 + 1)  // 63
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   40|      0|#define FRAME_CHUNKSIZE (FRAME_BLOCKSIZE + 4 + 1)  // 58
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   39|      0|#define FRAME_BLOCKSIZE (FRAME_TYPESIZE + 4 + 1)  // 53
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   38|      0|#define FRAME_TYPESIZE (FRAME_CBYTES + 8 + 1) // 48
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|      0|#define FRAME_CBYTES (FRAME_NBYTES + 8 + 1)  // 39
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   36|      0|#define FRAME_NBYTES (FRAME_FLAGS + 4 + 1)  // 30
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   32|      0|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   31|      0|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   30|      0|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   29|      0|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2888:9): [True: 0, False: 0]
  ------------------
 2889|      0|      return BLOSC2_ERROR_FILE_WRITE;
 2890|      0|    }
 2891|      0|    framep = header_ptr;
 2892|      0|  }
 2893|    750|  uint32_t prev_h2len;
 2894|    750|  from_big(&prev_h2len, framep + FRAME_HEADER_LEN, sizeof(prev_h2len));
  ------------------
  |  |   38|    750|#define from_big(dest, src, itemsize)     endian_handler(false, dest, src, itemsize)
  ------------------
 2895|       |
 2896|       |  // Build a new header
 2897|    750|  uint8_t* h2 = new_header_frame(schunk, frame);
 2898|    750|  if (h2 == NULL) {
  ------------------
  |  Branch (2898:7): [True: 0, False: 750]
  ------------------
 2899|      0|    return BLOSC2_ERROR_MEMORY_ALLOC;
 2900|      0|  }
 2901|    750|  uint32_t h2len;
 2902|    750|  from_big(&h2len, h2 + FRAME_HEADER_LEN, sizeof(h2len));
  ------------------
  |  |   38|    750|#define from_big(dest, src, itemsize)     endian_handler(false, dest, src, itemsize)
  ------------------
 2903|       |
 2904|       |  // The frame length is outdated when adding a new metalayer, so update it
 2905|    750|  if (new) {
  ------------------
  |  Branch (2905:7): [True: 70, False: 680]
  ------------------
 2906|     70|    int64_t frame_len = h2len;  // at adding time, we only have to worry of the header for now
 2907|     70|    to_big(h2 + FRAME_LEN, &frame_len, sizeof(frame_len));
  ------------------
  |  |   37|     70|#define to_big(dest, src, itemsize)       endian_handler(false, dest, src, itemsize)
  ------------------
 2908|     70|    frame->len = frame_len;
 2909|     70|  }
 2910|       |
 2911|    750|  if (!new && prev_h2len != h2len) {
  ------------------
  |  Branch (2911:7): [True: 680, False: 70]
  |  Branch (2911:15): [True: 0, False: 680]
  ------------------
 2912|      0|    BLOSC_TRACE_ERROR("The new metalayer sizes should be equal the existing ones.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2913|      0|    free(h2);
 2914|      0|    return BLOSC2_ERROR_DATA;
 2915|      0|  }
 2916|       |
 2917|    750|  void* fp = NULL;
 2918|    750|  if (frame->cframe == NULL) {
  ------------------
  |  Branch (2918:7): [True: 0, False: 750]
  ------------------
 2919|       |    // Write updated header down to file
 2920|      0|    if (frame->sframe) {
  ------------------
  |  Branch (2920:9): [True: 0, False: 0]
  ------------------
 2921|      0|      fp = sframe_open_index(frame->urlpath, "rb+",
 2922|      0|                             frame->schunk->storage->io);
 2923|      0|    }
 2924|      0|    else {
 2925|      0|      fp = frame_writer_acquire(frame, io_cb);
 2926|      0|    }
 2927|      0|    if (fp == NULL) {
  ------------------
  |  Branch (2927:9): [True: 0, False: 0]
  ------------------
 2928|      0|      BLOSC_TRACE_ERROR("Error opening file in: %s", frame->urlpath);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2929|      0|      free(h2);
 2930|      0|      return BLOSC2_ERROR_FILE_OPEN;
 2931|      0|    }
 2932|      0|    int64_t io_pos = frame->file_offset;
 2933|      0|    int64_t wbytes = io_cb->write(h2, h2len, 1, io_pos, fp);
 2934|      0|    int close_rc = frame_writer_release(frame, io_cb, fp);
 2935|      0|    if (wbytes != 1) {
  ------------------
  |  Branch (2935:9): [True: 0, False: 0]
  ------------------
 2936|      0|      BLOSC_TRACE_ERROR("Cannot write the header to %s.", frame->urlpath);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2937|      0|      free(h2);
 2938|      0|      return BLOSC2_ERROR_FILE_WRITE;
 2939|      0|    }
 2940|      0|    if (close_rc < 0) {
  ------------------
  |  Branch (2940:9): [True: 0, False: 0]
  ------------------
 2941|      0|      free(h2);
 2942|      0|      return close_rc;
 2943|      0|    }
 2944|      0|  }
 2945|    750|  else {
 2946|    750|    if (new) {
  ------------------
  |  Branch (2946:9): [True: 70, False: 680]
  ------------------
 2947|     70|      void *new_cframe = realloc(frame->cframe, h2len);
 2948|     70|      if (new_cframe == NULL) {
  ------------------
  |  Branch (2948:11): [True: 0, False: 70]
  ------------------
 2949|      0|        free(h2);
 2950|      0|        return BLOSC2_ERROR_MEMORY_ALLOC;
 2951|      0|      }
 2952|     70|      frame->cframe = new_cframe;
 2953|     70|    }
 2954|    750|    memcpy(frame->cframe, h2, h2len);
 2955|    750|  }
 2956|    750|  free(h2);
 2957|       |
 2958|    750|  return 1;
 2959|    750|}
frame_get_metalayers:
 3088|    176|int frame_get_metalayers(blosc2_frame_s* frame, blosc2_schunk* schunk) {
 3089|    176|  int32_t header_len;
 3090|    176|  int64_t frame_len;
 3091|    176|  int64_t nbytes;
 3092|    176|  int64_t cbytes;
 3093|    176|  int32_t blocksize;
 3094|    176|  int32_t chunksize;
 3095|    176|  int64_t nchunks;
 3096|    176|  int ret = get_header_info(frame, &header_len, &frame_len, &nbytes, &cbytes,
 3097|    176|                            &blocksize, &chunksize, &nchunks,
 3098|    176|                            NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
 3099|    176|                            schunk->storage->io);
 3100|    176|  if (ret < 0) {
  ------------------
  |  Branch (3100:7): [True: 0, False: 176]
  ------------------
 3101|      0|    BLOSC_TRACE_ERROR("Unable to get the header info from frame.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3102|      0|    return ret;
 3103|      0|  }
 3104|       |
 3105|       |  // Get the header
 3106|    176|  uint8_t* header = NULL;
 3107|    176|  bool needs_free = false;
 3108|    176|  if (frame->cframe != NULL) {
  ------------------
  |  Branch (3108:7): [True: 176, False: 0]
  ------------------
 3109|    176|    header = frame->cframe;
 3110|    176|  } else {
 3111|      0|    int64_t rbytes = 0;
 3112|      0|    blosc2_io_cb *io_cb = blosc2_get_io_cb(frame->schunk->storage->io->id);
 3113|      0|    if (io_cb == NULL) {
  ------------------
  |  Branch (3113:9): [True: 0, False: 0]
  ------------------
 3114|      0|      BLOSC_TRACE_ERROR("Error getting the input/output API");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3115|      0|      return BLOSC2_ERROR_PLUGIN_IO;
 3116|      0|    }
 3117|       |
 3118|      0|    if (io_cb->is_allocation_necessary) {
  ------------------
  |  Branch (3118:9): [True: 0, False: 0]
  ------------------
 3119|      0|      header = malloc(header_len);
 3120|      0|      needs_free = true;
 3121|      0|    }
 3122|      0|    else {
 3123|      0|      needs_free = false;
 3124|      0|    }
 3125|       |
 3126|      0|    void* fp = NULL;
 3127|      0|    int64_t io_pos = 0;
 3128|      0|    if (frame->sframe) {
  ------------------
  |  Branch (3128:9): [True: 0, False: 0]
  ------------------
 3129|      0|      fp = sframe_open_index(frame->urlpath, "rb",
 3130|      0|                             frame->schunk->storage->io);
 3131|      0|      if (fp == NULL) {
  ------------------
  |  Branch (3131:11): [True: 0, False: 0]
  ------------------
 3132|      0|        BLOSC_TRACE_ERROR("Error opening file in: %s", frame->urlpath);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3133|      0|        return BLOSC2_ERROR_FILE_OPEN;
 3134|      0|      }
 3135|      0|    }
 3136|      0|    else {
 3137|      0|      fp = frame_reader_acquire(frame, frame->schunk->storage->io);
 3138|      0|      if (fp == NULL) {
  ------------------
  |  Branch (3138:11): [True: 0, False: 0]
  ------------------
 3139|      0|        BLOSC_TRACE_ERROR("Error opening file in: %s", frame->urlpath);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3140|      0|        return BLOSC2_ERROR_FILE_OPEN;
 3141|      0|      }
 3142|      0|      io_pos = frame->file_offset;
 3143|      0|    }
 3144|      0|    if (fp != NULL) {
  ------------------
  |  Branch (3144:9): [True: 0, False: 0]
  ------------------
 3145|      0|      rbytes = io_cb->read((void**)&header, 1, header_len, io_pos, fp);
 3146|      0|      frame_reader_release(frame, io_cb, fp);
 3147|      0|    }
 3148|      0|    if (rbytes != header_len) {
  ------------------
  |  Branch (3148:9): [True: 0, False: 0]
  ------------------
 3149|      0|      BLOSC_TRACE_ERROR("Cannot access the header out of the frame.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3150|      0|      if (needs_free)
  ------------------
  |  Branch (3150:11): [True: 0, False: 0]
  ------------------
 3151|      0|        free(header);
 3152|      0|      return BLOSC2_ERROR_FILE_READ;
 3153|      0|    }
 3154|      0|  }
 3155|       |
 3156|    176|  ret = get_meta_from_header(frame, schunk, header, header_len);
 3157|       |
 3158|    176|  if (frame->cframe == NULL && needs_free) {
  ------------------
  |  Branch (3158:7): [True: 0, False: 176]
  |  Branch (3158:32): [True: 0, False: 0]
  ------------------
 3159|      0|    free(header);
 3160|      0|  }
 3161|       |
 3162|    176|  return ret;
 3163|    176|}
frame_get_vlmetalayers:
 3299|    112|int frame_get_vlmetalayers(blosc2_frame_s* frame, blosc2_schunk* schunk) {
 3300|    112|  int32_t header_len;
 3301|    112|  int64_t frame_len;
 3302|    112|  int64_t nbytes;
 3303|    112|  int64_t cbytes;
 3304|    112|  int32_t blocksize;
 3305|    112|  int32_t chunksize;
 3306|    112|  int64_t nchunks;
 3307|    112|  int ret = get_header_info(frame, &header_len, &frame_len, &nbytes, &cbytes,
 3308|    112|                            &blocksize, &chunksize, &nchunks,
 3309|    112|                            NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
 3310|    112|                            schunk->storage->io);
 3311|    112|  if (ret < 0) {
  ------------------
  |  Branch (3311:7): [True: 0, False: 112]
  ------------------
 3312|      0|    BLOSC_TRACE_ERROR("Unable to get the trailer info from frame.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3313|      0|    return ret;
 3314|      0|  }
 3315|       |
 3316|    112|  int64_t trailer_offset = get_trailer_offset(frame, header_len, nbytes > 0);
 3317|    112|  int32_t trailer_len = (int32_t) frame->trailer_len;
 3318|       |
 3319|    112|  if (trailer_offset < BLOSC_EXTENDED_HEADER_LENGTH || trailer_offset + trailer_len > frame->len) {
  ------------------
  |  Branch (3319:7): [True: 0, False: 112]
  |  Branch (3319:56): [True: 43, False: 69]
  ------------------
 3320|     43|    BLOSC_TRACE_ERROR("Cannot access the trailer out of the frame.");
  ------------------
  |  |   93|     43|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|     43|    do {                                            \
  |  |  |  |   98|     43|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|     43|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 43, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|     43|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3321|     43|    return BLOSC2_ERROR_READ_BUFFER;
 3322|     43|  }
 3323|       |
 3324|       |  // Get the trailer
 3325|     69|  uint8_t* trailer = NULL;
 3326|     69|  bool needs_free = false;
 3327|     69|  if (frame->cframe != NULL) {
  ------------------
  |  Branch (3327:7): [True: 69, False: 0]
  ------------------
 3328|     69|    trailer = frame->cframe + trailer_offset;
 3329|     69|  } else {
 3330|      0|    int64_t rbytes = 0;
 3331|       |
 3332|      0|    blosc2_io_cb *io_cb = blosc2_get_io_cb(frame->schunk->storage->io->id);
 3333|      0|    if (io_cb == NULL) {
  ------------------
  |  Branch (3333:9): [True: 0, False: 0]
  ------------------
 3334|      0|      BLOSC_TRACE_ERROR("Error getting the input/output API");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3335|      0|      return BLOSC2_ERROR_PLUGIN_IO;
 3336|      0|    }
 3337|       |
 3338|      0|    if (io_cb->is_allocation_necessary) {
  ------------------
  |  Branch (3338:9): [True: 0, False: 0]
  ------------------
 3339|      0|      trailer = malloc(trailer_len);
 3340|      0|      needs_free = true;
 3341|      0|    }
 3342|      0|    else {
 3343|      0|      needs_free = false;
 3344|      0|    }
 3345|       |
 3346|      0|    void* fp = NULL;
 3347|      0|    int64_t io_pos = 0;
 3348|      0|    if (frame->sframe) {
  ------------------
  |  Branch (3348:9): [True: 0, False: 0]
  ------------------
 3349|       |      // Check for overflow before calculating length
 3350|      0|      if (strlen(frame->urlpath) > SIZE_MAX - strlen("/chunks.b2frame") - 1) {
  ------------------
  |  Branch (3350:11): [True: 0, False: 0]
  ------------------
 3351|      0|        BLOSC_TRACE_ERROR("Path too long for frame filename.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3352|      0|        if (needs_free) free(trailer);
  ------------------
  |  Branch (3352:13): [True: 0, False: 0]
  ------------------
 3353|      0|        return BLOSC2_ERROR_INVALID_PARAM;
 3354|      0|      }
 3355|      0|      size_t _len = strlen(frame->urlpath) + strlen("/chunks.b2frame") + 1;
 3356|      0|      char* eframe_name = malloc(_len);
 3357|      0|      if (eframe_name == NULL) {
  ------------------
  |  Branch (3357:11): [True: 0, False: 0]
  ------------------
 3358|      0|        BLOSC_TRACE_ERROR("Unable to allocate memory for frame filename.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3359|      0|        if (needs_free) free(trailer);
  ------------------
  |  Branch (3359:13): [True: 0, False: 0]
  ------------------
 3360|      0|        return BLOSC2_ERROR_MEMORY_ALLOC;
 3361|      0|      }
 3362|      0|      int _w = snprintf(eframe_name, _len, "%s/chunks.b2frame", frame->urlpath);
 3363|      0|      if (_w < 0 || (size_t)_w >= _len) {
  ------------------
  |  Branch (3363:11): [True: 0, False: 0]
  |  Branch (3363:21): [True: 0, False: 0]
  ------------------
 3364|      0|        BLOSC_TRACE_ERROR("Error building frame filename");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3365|      0|        free(eframe_name);
 3366|      0|        if (needs_free) free(trailer);
  ------------------
  |  Branch (3366:13): [True: 0, False: 0]
  ------------------
 3367|      0|        return BLOSC2_ERROR_INVALID_PARAM;
 3368|      0|      }
 3369|      0|      fp = io_cb->open(eframe_name, "rb", frame->schunk->storage->io->params);
 3370|      0|      if (fp == NULL) {
  ------------------
  |  Branch (3370:11): [True: 0, False: 0]
  ------------------
 3371|      0|        BLOSC_TRACE_ERROR("Error opening file in: %s", eframe_name);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3372|      0|        free(eframe_name);
 3373|      0|        return BLOSC2_ERROR_FILE_OPEN;
 3374|      0|      }
 3375|      0|      free(eframe_name);
 3376|      0|      io_pos = trailer_offset;
 3377|      0|    }
 3378|      0|    else {
 3379|      0|      fp = frame_reader_acquire(frame, frame->schunk->storage->io);
 3380|      0|      if (fp == NULL) {
  ------------------
  |  Branch (3380:11): [True: 0, False: 0]
  ------------------
 3381|      0|        BLOSC_TRACE_ERROR("Error opening file in: %s", frame->urlpath);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3382|      0|        return BLOSC2_ERROR_FILE_OPEN;
 3383|      0|      }
 3384|      0|      io_pos = frame->file_offset + trailer_offset;
 3385|      0|    }
 3386|      0|    if (fp != NULL) {
  ------------------
  |  Branch (3386:9): [True: 0, False: 0]
  ------------------
 3387|      0|      rbytes = io_cb->read((void**)&trailer, 1, trailer_len, io_pos, fp);
 3388|      0|      frame_reader_release(frame, io_cb, fp);
 3389|      0|    }
 3390|      0|    if (rbytes != trailer_len) {
  ------------------
  |  Branch (3390:9): [True: 0, False: 0]
  ------------------
 3391|      0|      BLOSC_TRACE_ERROR("Cannot access the trailer out of the fileframe.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3392|      0|      if (needs_free)
  ------------------
  |  Branch (3392:11): [True: 0, False: 0]
  ------------------
 3393|      0|        free(trailer);
 3394|      0|      return BLOSC2_ERROR_FILE_READ;
 3395|      0|    }
 3396|      0|  }
 3397|       |
 3398|     69|  ret = get_vlmeta_from_trailer(frame, schunk, trailer, trailer_len);
 3399|       |
 3400|     69|  if (frame->cframe == NULL && needs_free) {
  ------------------
  |  Branch (3400:7): [True: 0, False: 69]
  |  Branch (3400:32): [True: 0, False: 0]
  ------------------
 3401|      0|    free(trailer);
 3402|      0|  }
 3403|       |
 3404|     69|  return ret;
 3405|     69|}
get_new_storage:
 3411|  1.92k|                                const blosc2_io* iodefaults) {
 3412|       |
 3413|  1.92k|  blosc2_storage* new_storage = (blosc2_storage*)calloc(1, sizeof(blosc2_storage));
 3414|  1.92k|  memcpy(new_storage, storage, sizeof(blosc2_storage));
 3415|  1.92k|  if (storage->urlpath != NULL) {
  ------------------
  |  Branch (3415:7): [True: 0, False: 1.92k]
  ------------------
 3416|      0|    char* urlpath = normalize_urlpath(storage->urlpath);
 3417|      0|    new_storage->urlpath = malloc(strlen(urlpath) + 1);
 3418|      0|    strcpy(new_storage->urlpath, urlpath);
 3419|      0|  }
 3420|       |
 3421|       |  // cparams
 3422|  1.92k|  blosc2_cparams* cparams = malloc(sizeof(blosc2_cparams));
 3423|  1.92k|  if (storage->cparams != NULL) {
  ------------------
  |  Branch (3423:7): [True: 70, False: 1.85k]
  ------------------
 3424|     70|    memcpy(cparams, storage->cparams, sizeof(blosc2_cparams));
 3425|  1.85k|  } else {
 3426|  1.85k|    memcpy(cparams, cdefaults, sizeof(blosc2_cparams));
 3427|  1.85k|  }
 3428|  1.92k|  new_storage->cparams = cparams;
 3429|       |
 3430|       |  // dparams
 3431|  1.92k|  blosc2_dparams* dparams = malloc(sizeof(blosc2_dparams));
 3432|  1.92k|  if (storage->dparams != NULL) {
  ------------------
  |  Branch (3432:7): [True: 70, False: 1.85k]
  ------------------
 3433|     70|    memcpy(dparams, storage->dparams, sizeof(blosc2_dparams));
 3434|     70|  }
 3435|  1.85k|  else {
 3436|  1.85k|    memcpy(dparams, ddefaults, sizeof(blosc2_dparams));
 3437|  1.85k|  }
 3438|  1.92k|  new_storage->dparams = dparams;
 3439|       |
 3440|       |  // iodefaults
 3441|  1.92k|  blosc2_io* udio = malloc(sizeof(blosc2_io));
 3442|  1.92k|  if (storage->io != NULL) {
  ------------------
  |  Branch (3442:7): [True: 0, False: 1.92k]
  ------------------
 3443|      0|    memcpy(udio, storage->io, sizeof(blosc2_io));
 3444|      0|  }
 3445|  1.92k|  else {
 3446|  1.92k|    memcpy(udio, iodefaults, sizeof(blosc2_io));
 3447|  1.92k|  }
 3448|  1.92k|  new_storage->io = udio;
 3449|       |
 3450|  1.92k|  return new_storage;
 3451|  1.92k|}
frame_to_schunk:
 3515|  1.95k|blosc2_schunk* frame_to_schunk(blosc2_frame_s* frame, bool copy, const blosc2_io *udio) {
 3516|  1.95k|  int32_t header_len;
 3517|  1.95k|  int64_t frame_len;
 3518|  1.95k|  int rc;
 3519|  1.95k|  bool frame_attached = true;
 3520|  1.95k|  blosc2_schunk* schunk = calloc(1, sizeof(blosc2_schunk));
 3521|  1.95k|  blosc2_cparams *cparams = NULL;
 3522|  1.95k|  blosc2_dparams *dparams = NULL;
 3523|  1.95k|  int64_t *offsets = NULL;
 3524|  1.95k|  if (schunk == NULL) {
  ------------------
  |  Branch (3524:7): [True: 0, False: 1.95k]
  ------------------
 3525|      0|    return NULL;
 3526|      0|  }
 3527|  1.95k|  schunk->frame = (blosc2_frame*)frame;
 3528|  1.95k|  frame->schunk = schunk;
 3529|       |
 3530|  1.95k|  rc = get_header_info(frame, &header_len, &frame_len, &schunk->nbytes,
 3531|  1.95k|                       &schunk->cbytes, &schunk->blocksize,
 3532|  1.95k|                       &schunk->chunksize, &schunk->nchunks, &schunk->typesize,
 3533|  1.95k|                       &schunk->compcode, &schunk->compcode_meta, &schunk->clevel, schunk->filters,
 3534|  1.95k|                       schunk->filters_meta, &schunk->splitmode, &schunk->use_dict, udio);
 3535|  1.95k|  if (rc < 0) {
  ------------------
  |  Branch (3535:7): [True: 95, False: 1.85k]
  ------------------
 3536|     95|    BLOSC_TRACE_ERROR("Unable to get meta info from frame.");
  ------------------
  |  |   93|     95|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|     95|    do {                                            \
  |  |  |  |   98|     95|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|     95|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 95, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|     95|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3537|     95|    goto error;
 3538|     95|  }
 3539|  1.85k|  int64_t nchunks = schunk->nchunks;
 3540|  1.85k|  int64_t nbytes = schunk->nbytes;
 3541|  1.85k|  (void) nbytes;
 3542|  1.85k|  int64_t cbytes = schunk->cbytes;
 3543|       |
 3544|       |  // Compression and decompression contexts
 3545|  1.85k|  blosc2_schunk_get_cparams(schunk, &cparams);
 3546|  1.85k|  schunk->cctx = blosc2_create_cctx(*cparams);
 3547|  1.85k|  if (schunk->cctx == NULL) {
  ------------------
  |  Branch (3547:7): [True: 5, False: 1.85k]
  ------------------
 3548|      5|    BLOSC_TRACE_ERROR("Error while creating the compression context");
  ------------------
  |  |   93|      5|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      5|    do {                                            \
  |  |  |  |   98|      5|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      5|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 5, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      5|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3549|      5|    goto error;
 3550|      5|  }
 3551|  1.85k|  blosc2_schunk_get_dparams(schunk, &dparams);
 3552|  1.85k|  schunk->dctx = blosc2_create_dctx(*dparams);
 3553|  1.85k|  if (schunk->dctx == NULL) {
  ------------------
  |  Branch (3553:7): [True: 0, False: 1.85k]
  ------------------
 3554|      0|    BLOSC_TRACE_ERROR("Error while creating the decompression context");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3555|      0|    goto error;
 3556|      0|  }
 3557|  1.85k|  blosc2_storage storage = {.contiguous = copy ? false : true};
  ------------------
  |  Branch (3557:43): [True: 0, False: 1.85k]
  ------------------
 3558|  1.85k|  schunk->storage = get_new_storage(&storage, cparams, dparams, udio);
 3559|  1.85k|  free(cparams);
 3560|  1.85k|  cparams = NULL;
 3561|  1.85k|  free(dparams);
 3562|  1.85k|  dparams = NULL;
 3563|  1.85k|  if (nchunks > 0) {
  ------------------
  |  Branch (3563:7): [True: 1.74k, False: 107]
  ------------------
 3564|  1.74k|    rc = validate_offsets_chunk(frame, header_len, cbytes, nchunks);
 3565|  1.74k|    if (rc < 0) {
  ------------------
  |  Branch (3565:9): [True: 1.55k, False: 195]
  ------------------
 3566|  1.55k|      BLOSC_TRACE_ERROR("Cannot validate frame offsets.");
  ------------------
  |  |   93|  1.55k|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|  1.55k|    do {                                            \
  |  |  |  |   98|  1.55k|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|  1.55k|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 1.55k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|  1.55k|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3567|  1.55k|      goto error;
 3568|  1.55k|    }
 3569|  1.74k|  }
 3570|    302|  if (nchunks > 0) {
  ------------------
  |  Branch (3570:7): [True: 195, False: 107]
  ------------------
 3571|    195|    uint8_t *chunk;
 3572|    195|    bool needs_free;
 3573|       |    // A lazy chunk is enough here: only the header is needed for the flags2 byte
 3574|    195|    rc = frame_get_lazychunk(frame, 0, &chunk, &needs_free);
 3575|    195|    if (rc < 0) {
  ------------------
  |  Branch (3575:9): [True: 126, False: 69]
  ------------------
 3576|    126|      BLOSC_TRACE_ERROR("Cannot inspect the first chunk in frame.");
  ------------------
  |  |   93|    126|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|    126|    do {                                            \
  |  |  |  |   98|    126|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|    126|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 126, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|    126|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3577|    126|      goto error;
 3578|    126|    }
 3579|     69|    schunk->flags2 = (rc >= BLOSC_EXTENDED_HEADER_LENGTH) ? chunk[BLOSC2_CHUNK_BLOSC2_FLAGS2] : 0;
  ------------------
  |  Branch (3579:22): [True: 69, False: 0]
  ------------------
 3580|     69|    if (needs_free) {
  ------------------
  |  Branch (3580:9): [True: 2, False: 67]
  ------------------
 3581|      2|      free(chunk);
 3582|      2|    }
 3583|     69|  }
 3584|    176|  if (!copy) {
  ------------------
  |  Branch (3584:7): [True: 176, False: 0]
  ------------------
 3585|    176|    goto out;
 3586|    176|  }
 3587|       |
 3588|       |  // We are not attached to a frame anymore
 3589|      0|  schunk->frame = NULL;
 3590|      0|  frame_attached = false;
 3591|       |
 3592|      0|  if (nchunks == 0) {
  ------------------
  |  Branch (3592:7): [True: 0, False: 0]
  ------------------
 3593|      0|    frame->schunk = NULL;
 3594|      0|    goto out;
 3595|      0|  }
 3596|       |
 3597|       |  // Get the compressed offsets
 3598|      0|  int32_t coffsets_cbytes = 0;
 3599|      0|  uint8_t* coffsets = get_coffsets(frame, header_len, cbytes, nchunks, &coffsets_cbytes);
 3600|      0|  if (coffsets == NULL) {
  ------------------
  |  Branch (3600:7): [True: 0, False: 0]
  ------------------
 3601|      0|    BLOSC_TRACE_ERROR("Cannot get the offsets for the frame.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3602|      0|    goto error;
 3603|      0|  }
 3604|       |
 3605|       |  // Decompress offsets
 3606|      0|  blosc2_dparams off_dparams = BLOSC2_DPARAMS_DEFAULTS;
 3607|      0|  blosc2_context *dctx = blosc2_create_dctx(off_dparams);
 3608|      0|  if (dctx == NULL) {
  ------------------
  |  Branch (3608:7): [True: 0, False: 0]
  ------------------
 3609|      0|    BLOSC_TRACE_ERROR("Error while creating the decompression context");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3610|      0|    goto error;
 3611|      0|  }
 3612|      0|  int32_t offsets_nbytes;
 3613|      0|  if (!blosc2_nchunks_to_offsets_nbytes(nchunks, &offsets_nbytes)) {
  ------------------
  |  Branch (3613:7): [True: 0, False: 0]
  ------------------
 3614|      0|    blosc2_free_ctx(dctx);
 3615|      0|    BLOSC_TRACE_ERROR("Too many chunks for offsets representation.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3616|      0|    goto error;
 3617|      0|  }
 3618|      0|  offsets = (int64_t *) malloc((size_t)offsets_nbytes);
 3619|      0|  if (offsets == NULL) {
  ------------------
  |  Branch (3619:7): [True: 0, False: 0]
  ------------------
 3620|      0|    blosc2_free_ctx(dctx);
 3621|      0|    BLOSC_TRACE_ERROR("Cannot allocate memory for offsets.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3622|      0|    goto error;
 3623|      0|  }
 3624|      0|  int32_t off_nbytes = blosc2_decompress_ctx(dctx, coffsets, coffsets_cbytes,
 3625|      0|                                             offsets, offsets_nbytes);
 3626|      0|  blosc2_free_ctx(dctx);
 3627|      0|  if (off_nbytes < 0) {
  ------------------
  |  Branch (3627:7): [True: 0, False: 0]
  ------------------
 3628|      0|    BLOSC_TRACE_ERROR("Cannot decompress the offsets chunk.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3629|      0|    goto error;
 3630|      0|  }
 3631|       |
 3632|       |  // We want the contiguous schunk, so create the actual data chunks (and, while doing this,
 3633|       |  // get a guess at the blocksize used in this frame)
 3634|      0|  int64_t acc_nbytes = 0;
 3635|      0|  int64_t acc_cbytes = 0;
 3636|      0|  int32_t blocksize = 0;
 3637|      0|  int32_t chunk_nbytes;
 3638|      0|  int32_t chunk_cbytes;
 3639|      0|  int32_t chunk_blocksize;
 3640|      0|  size_t prev_alloc = BLOSC_EXTENDED_HEADER_LENGTH;
 3641|      0|  uint8_t* data_chunk = NULL;
 3642|      0|  bool needs_free = false;
 3643|      0|  const blosc2_io_cb *io_cb = blosc2_get_io_cb(udio->id);
 3644|      0|  if (io_cb == NULL) {
  ------------------
  |  Branch (3644:7): [True: 0, False: 0]
  ------------------
 3645|      0|    blosc2_schunk_free(schunk);
 3646|      0|    BLOSC_TRACE_ERROR("Error getting the input/output API");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3647|      0|    return NULL;
 3648|      0|  }
 3649|       |
 3650|      0|  void* fp = NULL;
 3651|      0|  if (frame->cframe == NULL) {
  ------------------
  |  Branch (3651:7): [True: 0, False: 0]
  ------------------
 3652|      0|    if (io_cb->is_allocation_necessary) {
  ------------------
  |  Branch (3652:9): [True: 0, False: 0]
  ------------------
 3653|      0|      data_chunk = malloc((size_t)prev_alloc);
 3654|      0|      needs_free = true;
 3655|      0|    }
 3656|      0|    else {
 3657|      0|      needs_free = false;
 3658|      0|    }
 3659|       |
 3660|      0|    if (!frame->sframe) {
  ------------------
  |  Branch (3660:9): [True: 0, False: 0]
  ------------------
 3661|       |      // If not the chunks won't be in the frame
 3662|      0|      fp = frame_reader_acquire(frame, udio);
 3663|      0|      if (fp == NULL) {
  ------------------
  |  Branch (3663:11): [True: 0, False: 0]
  ------------------
 3664|      0|        BLOSC_TRACE_ERROR("Error opening file in: %s", frame->urlpath);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3665|      0|        rc = BLOSC2_ERROR_FILE_OPEN;
 3666|      0|        goto end;
 3667|      0|      }
 3668|      0|    }
 3669|      0|  }
 3670|       |  /* calloc(): the loop below can stop at a bad chunk, and the error path frees
 3671|       |     every data[i] with i < nchunks, also the ones never set */
 3672|      0|  schunk->data = calloc(nchunks, sizeof(void*));
 3673|      0|  if (schunk->data == NULL && nchunks > 0) {
  ------------------
  |  Branch (3673:7): [True: 0, False: 0]
  |  Branch (3673:31): [True: 0, False: 0]
  ------------------
 3674|      0|    BLOSC_TRACE_ERROR("Cannot allocate the chunk pointers.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3675|      0|    rc = BLOSC2_ERROR_MEMORY_ALLOC;
 3676|      0|    goto end;
 3677|      0|  }
 3678|      0|  for (int64_t i = 0; i < nchunks; i++) {
  ------------------
  |  Branch (3678:23): [True: 0, False: 0]
  ------------------
 3679|      0|    if (frame->cframe != NULL) {
  ------------------
  |  Branch (3679:9): [True: 0, False: 0]
  ------------------
 3680|      0|      if (needs_free) {
  ------------------
  |  Branch (3680:11): [True: 0, False: 0]
  ------------------
 3681|      0|        free(data_chunk);
 3682|      0|      }
 3683|      0|      if (offsets[i] < 0) {
  ------------------
  |  Branch (3683:11): [True: 0, False: 0]
  ------------------
 3684|      0|        int64_t rbytes = frame_get_chunk(frame, i, &data_chunk, &needs_free);
 3685|      0|        if (rbytes < 0) {
  ------------------
  |  Branch (3685:13): [True: 0, False: 0]
  ------------------
 3686|      0|          break;
 3687|      0|        }
 3688|      0|      }
 3689|      0|      else {
 3690|      0|        if (offsets[i] > INT64_MAX - header_len ||
  ------------------
  |  Branch (3690:13): [True: 0, False: 0]
  ------------------
 3691|      0|            header_len + offsets[i] > frame->len - BLOSC_EXTENDED_HEADER_LENGTH ||
  ------------------
  |  Branch (3691:13): [True: 0, False: 0]
  ------------------
 3692|      0|            offsets[i] > cbytes - BLOSC_EXTENDED_HEADER_LENGTH) {
  ------------------
  |  Branch (3692:13): [True: 0, False: 0]
  ------------------
 3693|      0|          rc = BLOSC2_ERROR_INVALID_HEADER;
 3694|      0|          break;
 3695|      0|        }
 3696|      0|        data_chunk = frame->cframe + header_len + offsets[i];
 3697|      0|        needs_free = false;
 3698|      0|      }
 3699|      0|      rc = blosc2_cbuffer_sizes(data_chunk, NULL, &chunk_cbytes, NULL);
 3700|      0|      if (rc < 0) {
  ------------------
  |  Branch (3700:11): [True: 0, False: 0]
  ------------------
 3701|      0|        break;
 3702|      0|      }
 3703|      0|      if (offsets[i] >= 0 &&
  ------------------
  |  Branch (3703:11): [True: 0, False: 0]
  ------------------
 3704|      0|          (chunk_cbytes < BLOSC_EXTENDED_HEADER_LENGTH ||
  ------------------
  |  Branch (3704:12): [True: 0, False: 0]
  ------------------
 3705|      0|           offsets[i] > INT64_MAX - chunk_cbytes ||
  ------------------
  |  Branch (3705:12): [True: 0, False: 0]
  ------------------
 3706|      0|           offsets[i] + chunk_cbytes > cbytes)) {
  ------------------
  |  Branch (3706:12): [True: 0, False: 0]
  ------------------
 3707|      0|        rc = BLOSC2_ERROR_INVALID_HEADER;
 3708|      0|        break;
 3709|      0|      }
 3710|      0|    }
 3711|      0|    else {
 3712|      0|      int64_t rbytes;
 3713|      0|      if (offsets[i] < 0 || frame->sframe) {
  ------------------
  |  Branch (3713:11): [True: 0, False: 0]
  |  Branch (3713:29): [True: 0, False: 0]
  ------------------
 3714|      0|        if (needs_free) {
  ------------------
  |  Branch (3714:13): [True: 0, False: 0]
  ------------------
 3715|      0|          free(data_chunk);
 3716|      0|        }
 3717|      0|        rbytes = frame_get_chunk(frame, i, &data_chunk, &needs_free);
 3718|      0|        if (rbytes < 0) {
  ------------------
  |  Branch (3718:13): [True: 0, False: 0]
  ------------------
 3719|      0|          break;
 3720|      0|        }
 3721|      0|      }
 3722|      0|      else {
 3723|      0|        if (offsets[i] > INT64_MAX - header_len ||
  ------------------
  |  Branch (3723:13): [True: 0, False: 0]
  ------------------
 3724|      0|            header_len + offsets[i] > frame->len - BLOSC_EXTENDED_HEADER_LENGTH ||
  ------------------
  |  Branch (3724:13): [True: 0, False: 0]
  ------------------
 3725|      0|            offsets[i] > cbytes - BLOSC_EXTENDED_HEADER_LENGTH) {
  ------------------
  |  Branch (3725:13): [True: 0, False: 0]
  ------------------
 3726|      0|          rc = BLOSC2_ERROR_INVALID_HEADER;
 3727|      0|          break;
 3728|      0|        }
 3729|      0|        int64_t io_pos = frame->file_offset + header_len + offsets[i];
 3730|      0|        rbytes = io_cb->read((void**)&data_chunk, 1, BLOSC_EXTENDED_HEADER_LENGTH, io_pos, fp);
 3731|      0|      }
 3732|      0|      if (rbytes != BLOSC_EXTENDED_HEADER_LENGTH) {
  ------------------
  |  Branch (3732:11): [True: 0, False: 0]
  ------------------
 3733|      0|        rc = BLOSC2_ERROR_READ_BUFFER;
 3734|      0|        break;
 3735|      0|      }
 3736|      0|      rc = blosc2_cbuffer_sizes(data_chunk, NULL, &chunk_cbytes, NULL);
 3737|      0|      if (rc < 0) {
  ------------------
  |  Branch (3737:11): [True: 0, False: 0]
  ------------------
 3738|      0|        break;
 3739|      0|      }
 3740|      0|      if (offsets[i] >= 0 &&
  ------------------
  |  Branch (3740:11): [True: 0, False: 0]
  ------------------
 3741|      0|          (chunk_cbytes < BLOSC_EXTENDED_HEADER_LENGTH ||
  ------------------
  |  Branch (3741:12): [True: 0, False: 0]
  ------------------
 3742|      0|           offsets[i] > INT64_MAX - chunk_cbytes ||
  ------------------
  |  Branch (3742:12): [True: 0, False: 0]
  ------------------
 3743|      0|           offsets[i] + chunk_cbytes > cbytes)) {
  ------------------
  |  Branch (3743:12): [True: 0, False: 0]
  ------------------
 3744|      0|        rc = BLOSC2_ERROR_INVALID_HEADER;
 3745|      0|        break;
 3746|      0|      }
 3747|      0|      if (chunk_cbytes > (int32_t)prev_alloc) {
  ------------------
  |  Branch (3747:11): [True: 0, False: 0]
  ------------------
 3748|      0|        if (io_cb->is_allocation_necessary)
  ------------------
  |  Branch (3748:13): [True: 0, False: 0]
  ------------------
 3749|      0|          data_chunk = realloc(data_chunk, chunk_cbytes);
 3750|      0|        if (data_chunk == NULL) {
  ------------------
  |  Branch (3750:13): [True: 0, False: 0]
  ------------------
 3751|      0|          BLOSC_TRACE_ERROR("Cannot realloc space for the data_chunk.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3752|      0|          rc = BLOSC2_ERROR_MEMORY_ALLOC;
 3753|      0|          break;
 3754|      0|        }
 3755|      0|        prev_alloc = chunk_cbytes;
 3756|      0|      }
 3757|      0|      if (!frame->sframe) {
  ------------------
  |  Branch (3757:11): [True: 0, False: 0]
  ------------------
 3758|      0|        int64_t io_pos = frame->file_offset + header_len + offsets[i];
 3759|      0|        rbytes = io_cb->read((void**)&data_chunk, 1, chunk_cbytes, io_pos, fp);
 3760|      0|        if (rbytes != chunk_cbytes) {
  ------------------
  |  Branch (3760:13): [True: 0, False: 0]
  ------------------
 3761|      0|          rc = BLOSC2_ERROR_READ_BUFFER;
 3762|      0|          break;
 3763|      0|        }
 3764|      0|      }
 3765|      0|    }
 3766|      0|    uint8_t* new_chunk = malloc(chunk_cbytes);
 3767|      0|    memcpy(new_chunk, data_chunk, chunk_cbytes);
 3768|      0|    schunk->data[i] = new_chunk;
 3769|      0|    rc = blosc2_cbuffer_sizes(data_chunk, &chunk_nbytes, NULL, &chunk_blocksize);
 3770|      0|    if (rc < 0) {
  ------------------
  |  Branch (3770:9): [True: 0, False: 0]
  ------------------
 3771|      0|      break;
 3772|      0|    }
 3773|      0|    acc_nbytes += chunk_nbytes;
 3774|      0|    acc_cbytes += chunk_cbytes;
 3775|      0|    if (i == 0) {
  ------------------
  |  Branch (3775:9): [True: 0, False: 0]
  ------------------
 3776|      0|      blocksize = chunk_blocksize;
 3777|      0|    }
 3778|      0|    else if (blocksize != chunk_blocksize) {
  ------------------
  |  Branch (3778:14): [True: 0, False: 0]
  ------------------
 3779|       |      // Blocksize varies
 3780|      0|      blocksize = 0;
 3781|      0|    }
 3782|      0|  }
 3783|       |
 3784|       |  // We are not attached to a schunk anymore
 3785|      0|  frame->schunk = NULL;
 3786|       |
 3787|      0|  end:
 3788|      0|  if (needs_free) {
  ------------------
  |  Branch (3788:7): [True: 0, False: 0]
  ------------------
 3789|      0|    free(data_chunk);
 3790|      0|  }
 3791|      0|  if (frame->cframe == NULL) {
  ------------------
  |  Branch (3791:7): [True: 0, False: 0]
  ------------------
 3792|      0|    if (!frame->sframe) {
  ------------------
  |  Branch (3792:9): [True: 0, False: 0]
  ------------------
 3793|      0|      frame_reader_release(frame, io_cb, fp);
 3794|      0|    }
 3795|      0|  }
 3796|      0|  free(offsets);
 3797|       |  // Avoid a double-free in the `error:` cleanup below, which is reached
 3798|       |  // when frame_get_metalayers / frame_get_vlmetalayers reject a malformed
 3799|       |  // metalayer index after we've already freed `offsets` here.
 3800|      0|  offsets = NULL;
 3801|       |
 3802|       |  // cframes and sframes have different ways to store chunks with special values:
 3803|       |  // 1) cframes represent special chunks as negative offsets
 3804|       |  // 2) sframes does not have the concept of offsets, but rather of data pointers (.data)
 3805|       |  //    so they always have a pointer to a special chunk
 3806|       |  // This is why cframes and sframes have different cbytes and hence, we cannot enforce acc_bytes == schunk->cbytes
 3807|       |  // In the future, maybe we could provide special meanings for .data[i] > 0x7FFFFFFF, but not there yet
 3808|       |  // if (rc < 0 || acc_nbytes != nbytes || acc_cbytes != cbytes) {
 3809|      0|  if (rc < 0 || acc_nbytes != nbytes) {
  ------------------
  |  Branch (3809:7): [True: 0, False: 0]
  |  Branch (3809:17): [True: 0, False: 0]
  ------------------
 3810|      0|    goto error;
 3811|      0|  }
 3812|       |  // Update counters
 3813|      0|  schunk->cbytes = acc_cbytes;
 3814|      0|  schunk->blocksize = blocksize;
 3815|       |
 3816|    176|  out:
 3817|    176|  rc = frame_get_metalayers(frame, schunk);
 3818|    176|  if (rc < 0) {
  ------------------
  |  Branch (3818:7): [True: 64, False: 112]
  ------------------
 3819|     64|    BLOSC_TRACE_ERROR("Cannot access the metalayers.");
  ------------------
  |  |   93|     64|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|     64|    do {                                            \
  |  |  |  |   98|     64|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|     64|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 64, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|     64|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3820|     64|    goto error;
 3821|     64|  }
 3822|       |
 3823|    112|  rc = frame_get_vlmetalayers(frame, schunk);
 3824|    112|  if (rc < 0) {
  ------------------
  |  Branch (3824:7): [True: 43, False: 69]
  ------------------
 3825|     43|    BLOSC_TRACE_ERROR("Cannot access the vlmetalayers.");
  ------------------
  |  |   93|     43|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|     43|    do {                                            \
  |  |  |  |   98|     43|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|     43|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 43, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|     43|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3826|     43|    goto error;
 3827|     43|  }
 3828|       |
 3829|     69|  return schunk;
 3830|       |
 3831|  1.88k|error:
 3832|  1.88k|  free(cparams);
 3833|  1.88k|  free(dparams);
 3834|  1.88k|  free(offsets);
 3835|  1.88k|  if (schunk != NULL) {
  ------------------
  |  Branch (3835:7): [True: 1.88k, False: 0]
  ------------------
 3836|  1.88k|    blosc2_schunk_free(schunk);
 3837|  1.88k|  }
 3838|  1.88k|  if (!frame_attached) {
  ------------------
  |  Branch (3838:7): [True: 0, False: 1.88k]
  ------------------
 3839|      0|    frame->schunk = NULL;
 3840|      0|    frame_free(frame);
 3841|      0|  }
 3842|       |  return NULL;
 3843|    112|}
get_coffset:
 3865|  2.55k|                int64_t nchunk, int64_t nchunks, int64_t *offset) {
 3866|  2.55k|  int32_t off_cbytes;
 3867|       |  // Get the offset to nchunk
 3868|  2.55k|  uint8_t *coffsets = get_coffsets(frame, header_len, cbytes, nchunks, &off_cbytes);
 3869|  2.55k|  if (coffsets == NULL) {
  ------------------
  |  Branch (3869:7): [True: 0, False: 2.55k]
  ------------------
 3870|      0|    BLOSC_TRACE_ERROR("Cannot get the offset for chunk %" PRId64 " for the frame.", nchunk);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3871|      0|    return BLOSC2_ERROR_DATA;
 3872|      0|  }
 3873|       |
 3874|       |  // Get the 64-bit offset
 3875|  2.55k|  int rc = blosc2_getitem(coffsets, off_cbytes, (int32_t)nchunk, 1, offset, (int32_t)sizeof(int64_t));
 3876|  2.55k|  if (rc < 0) {
  ------------------
  |  Branch (3876:7): [True: 29, False: 2.52k]
  ------------------
 3877|     29|    BLOSC_TRACE_ERROR("Problems retrieving a chunk offset.");
  ------------------
  |  |   93|     29|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|     29|    do {                                            \
  |  |  |  |   98|     29|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|     29|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 29, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|     29|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3878|  2.52k|  } else if (!frame->sframe && *offset >= 0) {
  ------------------
  |  Branch (3878:14): [True: 2.52k, False: 0]
  |  Branch (3878:32): [True: 1.77k, False: 751]
  ------------------
 3879|  1.77k|    if (cbytes < 0 || cbytes > INT64_MAX - header_len) {
  ------------------
  |  Branch (3879:9): [True: 39, False: 1.73k]
  |  Branch (3879:23): [True: 0, False: 1.73k]
  ------------------
 3880|     39|      BLOSC_TRACE_ERROR("Invalid compressed size in frame header.");
  ------------------
  |  |   93|     39|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|     39|    do {                                            \
  |  |  |  |   98|     39|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|     39|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 39, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|     39|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3881|     39|      return BLOSC2_ERROR_INVALID_HEADER;
 3882|     39|    }
 3883|  1.73k|    if (*offset > INT64_MAX - header_len) {
  ------------------
  |  Branch (3883:9): [True: 0, False: 1.73k]
  ------------------
 3884|      0|      BLOSC_TRACE_ERROR("Offset for chunk %" PRId64 " overflows frame position.", nchunk);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3885|      0|      return BLOSC2_ERROR_INVALID_HEADER;
 3886|      0|    }
 3887|  1.73k|    int64_t chunk_pos = header_len + *offset;
 3888|  1.73k|    int64_t data_limit = header_len + cbytes;
 3889|  1.73k|    if (chunk_pos < header_len ||
  ------------------
  |  Branch (3889:9): [True: 0, False: 1.73k]
  ------------------
 3890|  1.73k|        chunk_pos > data_limit - BLOSC_EXTENDED_HEADER_LENGTH ||
  ------------------
  |  Branch (3890:9): [True: 0, False: 1.73k]
  ------------------
 3891|  1.73k|        chunk_pos > frame->len - BLOSC_EXTENDED_HEADER_LENGTH) {
  ------------------
  |  Branch (3891:9): [True: 0, False: 1.73k]
  ------------------
 3892|      0|      BLOSC_TRACE_ERROR("Cannot read chunk %" PRId64 " outside of frame boundary.", nchunk);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3893|      0|      return BLOSC2_ERROR_INVALID_HEADER;
 3894|      0|    }
 3895|  1.73k|  }
 3896|       |
 3897|  2.51k|  return rc;
 3898|  2.55k|}
frame_get_chunks_special:
 3969|    138|int frame_get_chunks_special(blosc2_frame_s *frame, const int64_t *nchunks, int64_t n, uint8_t *special) {
 3970|    138|  int64_t *off;
 3971|    138|  int64_t lo;
 3972|    138|  int64_t span_end;
 3973|    138|  int32_t header_len;
 3974|    138|  int64_t cbytes;
 3975|    138|  int32_t chunksize;
 3976|    138|  int rc = frame_read_index_span(frame, nchunks, n, 0, &off, &lo, &span_end, &header_len, &cbytes, &chunksize);
 3977|    138|  if (rc < 0 || off == NULL) {
  ------------------
  |  Branch (3977:7): [True: 0, False: 138]
  |  Branch (3977:17): [True: 0, False: 138]
  ------------------
 3978|      0|    return rc;
 3979|      0|  }
 3980|  1.35k|  for (int64_t k = 0; k < n; ++k) {
  ------------------
  |  Branch (3980:23): [True: 1.22k, False: 138]
  ------------------
 3981|  1.22k|    int64_t offset = off[nchunks[k] - lo];
 3982|  1.22k|    special[k] = offset < 0 ? (uint8_t) (((uint64_t) offset >> (8 * 7)) & BLOSC2_SPECIAL_MASK) : 0;
  ------------------
  |  Branch (3982:18): [True: 64, False: 1.15k]
  ------------------
 3983|  1.22k|  }
 3984|    138|  free(off);
 3985|    138|  return BLOSC2_ERROR_SUCCESS;
 3986|    138|}
frame_special_chunk:
 4081|      2|                        uint8_t** chunk, int32_t cbytes, bool *needs_free) {
 4082|      2|  *chunk = malloc(cbytes);
 4083|      2|  *needs_free = true;
 4084|      2|  int rc = *chunk == NULL ? BLOSC2_ERROR_MEMORY_ALLOC
  ------------------
  |  Branch (4084:12): [True: 0, False: 2]
  ------------------
 4085|      2|                          : special_chunk_into(special_value, nbytes, typesize, blocksize, *chunk, cbytes);
 4086|      2|  if (rc < 0) {
  ------------------
  |  Branch (4086:7): [True: 0, False: 2]
  ------------------
 4087|      0|    free(*chunk);
 4088|      0|    *needs_free = false;
 4089|      0|    *chunk = NULL;
 4090|      0|  }
 4091|       |
 4092|      2|  return rc;
 4093|      2|}
frame_get_lazychunk:
 4290|    197|int frame_get_lazychunk(blosc2_frame_s *frame, int64_t nchunk, uint8_t **chunk, bool *needs_free) {
 4291|    197|  int32_t header_len;
 4292|    197|  int64_t frame_len;
 4293|    197|  int64_t nbytes;
 4294|    197|  int64_t cbytes;
 4295|    197|  int32_t blocksize;
 4296|    197|  int32_t chunksize;
 4297|    197|  int64_t nchunks;
 4298|    197|  int32_t typesize;
 4299|    197|  int32_t lazychunk_cbytes;
 4300|    197|  int64_t offset;
 4301|    197|  void* fp = NULL;
 4302|    197|  int32_t* block_csizes = NULL;
 4303|    197|  struct csize_idx *csize_idx = NULL;
 4304|       |
 4305|    197|  *chunk = NULL;
 4306|    197|  *needs_free = false;
 4307|    197|  int rc = get_header_info(frame, &header_len, &frame_len, &nbytes, &cbytes,
 4308|    197|                           &blocksize, &chunksize, &nchunks,
 4309|    197|                           &typesize, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
 4310|    197|                           frame->schunk->storage->io);
 4311|    197|  if (rc < 0) {
  ------------------
  |  Branch (4311:7): [True: 0, False: 197]
  ------------------
 4312|      0|    BLOSC_TRACE_ERROR("Unable to get meta info from frame.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4313|      0|    return rc;
 4314|      0|  }
 4315|    197|  rc = frame_refresh_if_stale(frame, frame_len);
 4316|    197|  if (rc < 0) {
  ------------------
  |  Branch (4316:7): [True: 0, False: 197]
  ------------------
 4317|      0|    BLOSC_TRACE_ERROR("Unable to refresh the frame state from disk.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4318|      0|    return rc;
 4319|      0|  }
 4320|    197|  if (rc > 0) {
  ------------------
  |  Branch (4320:7): [True: 0, False: 197]
  ------------------
 4321|       |    // Keep the schunk-level counters in sync with the refreshed on-disk state
 4322|       |    // (see frame_get_chunk).
 4323|      0|    frame->schunk->nbytes = nbytes;
 4324|      0|    frame->schunk->cbytes = cbytes;
 4325|      0|    frame->schunk->nchunks = nchunks;
 4326|      0|  }
 4327|       |
 4328|    197|  if (nchunk >= nchunks) {
  ------------------
  |  Branch (4328:7): [True: 0, False: 197]
  ------------------
 4329|      0|    BLOSC_TRACE_ERROR("nchunk ('%" PRId64 "') exceeds the number of chunks "
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4330|      0|                      "('%" PRId64 "') in frame.", nchunk, nchunks);
 4331|      0|    return BLOSC2_ERROR_INVALID_PARAM;
 4332|      0|  }
 4333|       |
 4334|       |  // Get the offset to nchunk
 4335|    197|  rc = get_coffset(frame, header_len, cbytes, nchunk, nchunks, &offset);
 4336|    197|  if (rc < 0) {
  ------------------
  |  Branch (4336:7): [True: 68, False: 129]
  ------------------
 4337|     68|    BLOSC_TRACE_ERROR("Unable to get offset to chunk %" PRId64 ".", nchunk);
  ------------------
  |  |   93|     68|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|     68|    do {                                            \
  |  |  |  |   98|     68|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|     68|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 68, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|     68|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4338|     68|    return rc;
 4339|     68|  }
 4340|       |
 4341|    129|  if (offset < 0) {
  ------------------
  |  Branch (4341:7): [True: 60, False: 69]
  ------------------
 4342|       |    // Special value
 4343|     60|    if (chunksize <= 0) {
  ------------------
  |  Branch (4343:9): [True: 58, False: 2]
  ------------------
 4344|     58|      BLOSC_TRACE_ERROR("Cannot synthesize special chunk with chunksize <= 0.");
  ------------------
  |  |   93|     58|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|     58|    do {                                            \
  |  |  |  |   98|     58|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|     58|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 58, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|     58|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4345|     58|      return BLOSC2_ERROR_INVALID_HEADER;
 4346|     58|    }
 4347|      2|    lazychunk_cbytes = BLOSC_EXTENDED_HEADER_LENGTH;
 4348|      2|    int32_t chunksize_ = chunksize;
 4349|      2|    if ((nchunk == nchunks - 1) && (nbytes % chunksize)) {
  ------------------
  |  Branch (4349:9): [True: 0, False: 2]
  |  Branch (4349:36): [True: 0, False: 0]
  ------------------
 4350|       |      // Last chunk is incomplete.  Compute its actual size.
 4351|      0|      chunksize_ = (int32_t) (nbytes % chunksize);
 4352|      0|    }
 4353|      2|    rc = frame_special_chunk(offset, chunksize_, typesize, blocksize, chunk,
 4354|      2|                             (int32_t)lazychunk_cbytes, needs_free);
 4355|      2|    goto end;
 4356|     60|  }
 4357|       |
 4358|     69|  blosc2_io_cb *io_cb = blosc2_get_io_cb(frame->schunk->storage->io->id);
 4359|     69|  if (io_cb == NULL) {
  ------------------
  |  Branch (4359:7): [True: 0, False: 69]
  ------------------
 4360|      0|    BLOSC_TRACE_ERROR("Error getting the input/output API");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4361|      0|    rc = BLOSC2_ERROR_PLUGIN_IO;
 4362|      0|    goto end;
 4363|      0|  }
 4364|       |
 4365|     69|  if (frame->cframe == NULL) {
  ------------------
  |  Branch (4365:7): [True: 0, False: 69]
  ------------------
 4366|       |    // TODO: make this portable across different endianness
 4367|       |    // Get info for building a lazy chunk
 4368|      0|    int32_t chunk_nbytes;
 4369|      0|    int32_t chunk_cbytes;
 4370|      0|    int32_t chunk_blocksize;
 4371|      0|    uint8_t* header_ptr;
 4372|      0|    uint8_t header[BLOSC_EXTENDED_HEADER_LENGTH];
 4373|      0|    int64_t io_pos = 0;
 4374|      0|    if (frame->sframe) {
  ------------------
  |  Branch (4374:9): [True: 0, False: 0]
  ------------------
 4375|       |      // The chunk is not in the frame
 4376|      0|      fp = sframe_open_chunk(frame->urlpath, offset, "rb",
 4377|      0|                             frame->schunk->storage->io);
 4378|      0|      if (fp == NULL) {
  ------------------
  |  Branch (4378:11): [True: 0, False: 0]
  ------------------
 4379|      0|        BLOSC_TRACE_ERROR("Error opening file in: %s", frame->urlpath);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4380|      0|        return BLOSC2_ERROR_FILE_OPEN;
 4381|      0|      }
 4382|      0|    }
 4383|      0|    else {
 4384|      0|      fp = frame_reader_acquire(frame, frame->schunk->storage->io);
 4385|      0|      if (fp == NULL) {
  ------------------
  |  Branch (4385:11): [True: 0, False: 0]
  ------------------
 4386|      0|        BLOSC_TRACE_ERROR("Error opening file in: %s", frame->urlpath);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4387|      0|        return BLOSC2_ERROR_FILE_OPEN;
 4388|      0|      }
 4389|      0|      io_pos = frame->file_offset + header_len + offset;
 4390|      0|    }
 4391|      0|    if (io_cb->is_allocation_necessary)
  ------------------
  |  Branch (4391:9): [True: 0, False: 0]
  ------------------
 4392|      0|      header_ptr = header;
 4393|      0|    int64_t rbytes = io_cb->read((void**)&header_ptr, 1, BLOSC_EXTENDED_HEADER_LENGTH, io_pos, fp);
 4394|      0|    if (rbytes != BLOSC_EXTENDED_HEADER_LENGTH) {
  ------------------
  |  Branch (4394:9): [True: 0, False: 0]
  ------------------
 4395|      0|      BLOSC_TRACE_ERROR("Cannot read the header for chunk in the frame.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4396|      0|      rc = BLOSC2_ERROR_FILE_READ;
 4397|      0|      goto end;
 4398|      0|    }
 4399|      0|    rc = blosc2_cbuffer_sizes(header_ptr, &chunk_nbytes, &chunk_cbytes, &chunk_blocksize);
 4400|      0|    if (rc < 0) {
  ------------------
  |  Branch (4400:9): [True: 0, False: 0]
  ------------------
 4401|      0|      goto end;
 4402|      0|    }
 4403|      0|    if (chunk_nbytes < 0 || chunk_cbytes < BLOSC_EXTENDED_HEADER_LENGTH || chunk_blocksize <= 0) {
  ------------------
  |  Branch (4403:9): [True: 0, False: 0]
  |  Branch (4403:29): [True: 0, False: 0]
  |  Branch (4403:76): [True: 0, False: 0]
  ------------------
 4404|      0|      rc = BLOSC2_ERROR_INVALID_HEADER;
 4405|      0|      goto end;
 4406|      0|    }
 4407|      0|    bool vlblocks = (header_ptr[BLOSC2_CHUNK_BLOSC2_FLAGS2] & BLOSC2_VL_BLOCKS) != 0;
 4408|      0|    size_t nblocks;
 4409|      0|    size_t leftover_block = 0;
 4410|      0|    if (vlblocks) {
  ------------------
  |  Branch (4410:9): [True: 0, False: 0]
  ------------------
 4411|      0|      nblocks = (size_t)chunk_blocksize;
 4412|      0|    }
 4413|      0|    else {
 4414|      0|      nblocks = (size_t)chunk_nbytes / (size_t)chunk_blocksize;
 4415|      0|      leftover_block = (size_t)chunk_nbytes % (size_t)chunk_blocksize;
 4416|      0|      if (leftover_block) {
  ------------------
  |  Branch (4416:11): [True: 0, False: 0]
  ------------------
 4417|      0|        if (nblocks == SIZE_MAX) {
  ------------------
  |  Branch (4417:13): [True: 0, False: 0]
  ------------------
 4418|      0|          rc = BLOSC2_ERROR_INVALID_HEADER;
 4419|      0|          goto end;
 4420|      0|        }
 4421|      0|        nblocks += 1;
 4422|      0|      }
 4423|      0|    }
 4424|      0|    if (nblocks == 0 || nblocks > (size_t)INT_MAX) {
  ------------------
  |  Branch (4424:9): [True: 0, False: 0]
  |  Branch (4424:25): [True: 0, False: 0]
  ------------------
 4425|      0|      rc = BLOSC2_ERROR_INVALID_HEADER;
 4426|      0|      goto end;
 4427|      0|    }
 4428|       |    // Allocate space for the lazy chunk
 4429|      0|    int32_t special_type = (header_ptr[BLOSC2_CHUNK_BLOSC2_FLAGS] >> 4) & BLOSC2_SPECIAL_MASK;
 4430|      0|    int memcpyed = header_ptr[BLOSC2_CHUNK_FLAGS] & (uint8_t) BLOSC_MEMCPYED;
 4431|       |
 4432|      0|    int32_t trailer_offset;
 4433|      0|    size_t streams_offset = BLOSC_EXTENDED_HEADER_LENGTH;
 4434|      0|    size_t trailer_offset_sz = BLOSC_EXTENDED_HEADER_LENGTH;
 4435|      0|    size_t trailer_len_sz = 0;
 4436|      0|    size_t lazychunk_cbytes_sz = 0;
 4437|      0|    size_t bstarts_nbytes = 0;
 4438|      0|    if (special_type == 0) {
  ------------------
  |  Branch (4438:9): [True: 0, False: 0]
  ------------------
 4439|      0|      if (nblocks > SIZE_MAX / sizeof(int32_t)) {
  ------------------
  |  Branch (4439:11): [True: 0, False: 0]
  ------------------
 4440|      0|        rc = BLOSC2_ERROR_INVALID_HEADER;
 4441|      0|        goto end;
 4442|      0|      }
 4443|      0|      bstarts_nbytes = nblocks * sizeof(int32_t);
 4444|       |
 4445|      0|      if (!memcpyed) {
  ------------------
  |  Branch (4445:11): [True: 0, False: 0]
  ------------------
 4446|      0|        if ((size_t)chunk_cbytes < BLOSC_EXTENDED_HEADER_LENGTH ||
  ------------------
  |  Branch (4446:13): [True: 0, False: 0]
  ------------------
 4447|      0|            bstarts_nbytes > (size_t)chunk_cbytes - BLOSC_EXTENDED_HEADER_LENGTH) {
  ------------------
  |  Branch (4447:13): [True: 0, False: 0]
  ------------------
 4448|      0|          rc = BLOSC2_ERROR_INVALID_HEADER;
 4449|      0|          goto end;
 4450|      0|        }
 4451|      0|      }
 4452|       |
 4453|      0|      if (bstarts_nbytes > SIZE_MAX - trailer_offset_sz) {
  ------------------
  |  Branch (4453:11): [True: 0, False: 0]
  ------------------
 4454|      0|        rc = BLOSC2_ERROR_INVALID_HEADER;
 4455|      0|        goto end;
 4456|      0|      }
 4457|      0|      trailer_offset_sz += bstarts_nbytes;
 4458|       |      // Regular values have offsets for blocks
 4459|      0|      if (!memcpyed) {
  ------------------
  |  Branch (4459:11): [True: 0, False: 0]
  ------------------
 4460|      0|        if (bstarts_nbytes > SIZE_MAX - streams_offset) {
  ------------------
  |  Branch (4460:13): [True: 0, False: 0]
  ------------------
 4461|      0|          rc = BLOSC2_ERROR_INVALID_HEADER;
 4462|      0|          goto end;
 4463|      0|        }
 4464|      0|        streams_offset += bstarts_nbytes;
 4465|      0|      }
 4466|       |
 4467|      0|      if (bstarts_nbytes > SIZE_MAX - (sizeof(int32_t) + sizeof(int64_t))) {
  ------------------
  |  Branch (4467:11): [True: 0, False: 0]
  ------------------
 4468|      0|        rc = BLOSC2_ERROR_INVALID_HEADER;
 4469|      0|        goto end;
 4470|      0|      }
 4471|      0|      trailer_len_sz = sizeof(int32_t) + sizeof(int64_t) + bstarts_nbytes;
 4472|      0|      if (trailer_len_sz > SIZE_MAX - trailer_offset_sz) {
  ------------------
  |  Branch (4472:11): [True: 0, False: 0]
  ------------------
 4473|      0|        rc = BLOSC2_ERROR_INVALID_HEADER;
 4474|      0|        goto end;
 4475|      0|      }
 4476|      0|      lazychunk_cbytes_sz = trailer_offset_sz + trailer_len_sz;
 4477|      0|    }
 4478|      0|    else if (special_type == BLOSC2_SPECIAL_VALUE) {
  ------------------
  |  Branch (4478:14): [True: 0, False: 0]
  ------------------
 4479|      0|      if (typesize <= 0) {
  ------------------
  |  Branch (4479:11): [True: 0, False: 0]
  ------------------
 4480|      0|        rc = BLOSC2_ERROR_INVALID_HEADER;
 4481|      0|        goto end;
 4482|      0|      }
 4483|      0|      if ((size_t)typesize > SIZE_MAX - trailer_offset_sz ||
  ------------------
  |  Branch (4483:11): [True: 0, False: 0]
  ------------------
 4484|      0|          (size_t)typesize > SIZE_MAX - streams_offset) {
  ------------------
  |  Branch (4484:11): [True: 0, False: 0]
  ------------------
 4485|      0|        rc = BLOSC2_ERROR_INVALID_HEADER;
 4486|      0|        goto end;
 4487|      0|      }
 4488|      0|      trailer_offset_sz += (size_t)typesize;
 4489|      0|      streams_offset += (size_t)typesize;
 4490|      0|      lazychunk_cbytes_sz = trailer_offset_sz;
 4491|      0|    }
 4492|      0|    else {
 4493|      0|      rc = BLOSC2_ERROR_INVALID_HEADER;
 4494|      0|      goto end;
 4495|      0|    }
 4496|       |
 4497|      0|    if (streams_offset > (size_t)chunk_cbytes ||
  ------------------
  |  Branch (4497:9): [True: 0, False: 0]
  ------------------
 4498|      0|        trailer_offset_sz > INT32_MAX ||
  ------------------
  |  Branch (4498:9): [True: 0, False: 0]
  ------------------
 4499|      0|        trailer_len_sz > INT32_MAX ||
  ------------------
  |  Branch (4499:9): [True: 0, False: 0]
  ------------------
 4500|      0|        lazychunk_cbytes_sz > INT32_MAX) {
  ------------------
  |  Branch (4500:9): [True: 0, False: 0]
  ------------------
 4501|      0|      rc = BLOSC2_ERROR_INVALID_HEADER;
 4502|      0|      goto end;
 4503|      0|    }
 4504|       |
 4505|      0|    trailer_offset = (int32_t)trailer_offset_sz;
 4506|      0|    lazychunk_cbytes = (int32_t)lazychunk_cbytes_sz;
 4507|       |
 4508|       |    // Read just the full header and bstarts section too (lazy partial length)
 4509|      0|    if (frame->sframe) {
  ------------------
  |  Branch (4509:9): [True: 0, False: 0]
  ------------------
 4510|      0|      io_pos = 0;
 4511|      0|    }
 4512|      0|    else {
 4513|      0|      io_pos = frame->file_offset + header_len + offset;
 4514|      0|    }
 4515|       |
 4516|       |    // The case here is a bit special because more memory is allocated than read from the file
 4517|       |    // and the chunk is modified after reading. Due to the modification, we cannot directly use
 4518|       |    // the memory provided by the io
 4519|      0|    *chunk = malloc((size_t)lazychunk_cbytes);
 4520|      0|    if (*chunk == NULL) {
  ------------------
  |  Branch (4520:9): [True: 0, False: 0]
  ------------------
 4521|      0|      rc = BLOSC2_ERROR_MEMORY_ALLOC;
 4522|      0|      goto end;
 4523|      0|    }
 4524|      0|    *needs_free = true;
 4525|       |
 4526|      0|    if (io_cb->is_allocation_necessary) {
  ------------------
  |  Branch (4526:9): [True: 0, False: 0]
  ------------------
 4527|      0|      rbytes = io_cb->read((void**)chunk, 1, (int64_t)streams_offset, io_pos, fp);
 4528|      0|    }
 4529|      0|    else {
 4530|       |      // The io hands out its own memory (mmap) and none at all for a read past
 4531|       |      // its end, which a damaged offset or header asks for: copy only after a
 4532|       |      // complete read
 4533|      0|      uint8_t* chunk_ptr = NULL;
 4534|      0|      rbytes = io_cb->read((void**)&chunk_ptr, 1, (int64_t)streams_offset, io_pos, fp);
 4535|      0|      if (rbytes == (int64_t)streams_offset && chunk_ptr != NULL) {
  ------------------
  |  Branch (4535:11): [True: 0, False: 0]
  |  Branch (4535:48): [True: 0, False: 0]
  ------------------
 4536|      0|        memcpy(*chunk, chunk_ptr, streams_offset);
 4537|      0|      }
 4538|      0|      else {
 4539|      0|        rbytes = BLOSC2_ERROR_FILE_READ;
 4540|      0|      }
 4541|      0|    }
 4542|       |
 4543|      0|    if (rbytes != (int64_t)streams_offset) {
  ------------------
  |  Branch (4543:9): [True: 0, False: 0]
  ------------------
 4544|      0|      BLOSC_TRACE_ERROR("Cannot read the (lazy) chunk out of the frame.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4545|      0|      rc = BLOSC2_ERROR_FILE_READ;
 4546|      0|      goto end;
 4547|      0|    }
 4548|      0|    if (special_type == BLOSC2_SPECIAL_VALUE) {
  ------------------
  |  Branch (4548:9): [True: 0, False: 0]
  ------------------
 4549|       |      // Value runlen is not returning a lazy chunk.  We are done.
 4550|      0|      goto end;
 4551|      0|    }
 4552|       |
 4553|       |    // Mark chunk as lazy
 4554|      0|    uint8_t* blosc2_flags = *chunk + BLOSC2_CHUNK_BLOSC2_FLAGS;
 4555|      0|    *blosc2_flags |= 0x08U;
 4556|       |
 4557|       |    // Add the trailer (currently, nchunk + offset + block_csizes)
 4558|      0|    if (frame->sframe) {
  ------------------
  |  Branch (4558:9): [True: 0, False: 0]
  ------------------
 4559|      0|      *(int32_t*)(*chunk + trailer_offset) = (int32_t)offset;   // offset is nchunk for sframes
 4560|      0|      *(int64_t*)(*chunk + trailer_offset + sizeof(int32_t)) = offset;
 4561|      0|    }
 4562|      0|    else {
 4563|      0|      *(int32_t*)(*chunk + trailer_offset) = (int32_t)nchunk;
 4564|      0|      *(int64_t*)(*chunk + trailer_offset + sizeof(int32_t)) = header_len + offset;
 4565|      0|    }
 4566|       |
 4567|      0|    block_csizes = malloc(nblocks * sizeof(int32_t));
 4568|      0|    if (block_csizes == NULL) {
  ------------------
  |  Branch (4568:9): [True: 0, False: 0]
  ------------------
 4569|      0|      rc = BLOSC2_ERROR_MEMORY_ALLOC;
 4570|      0|      goto end;
 4571|      0|    }
 4572|       |
 4573|      0|    if (memcpyed) {
  ------------------
  |  Branch (4573:9): [True: 0, False: 0]
  ------------------
 4574|       |      // When memcpyed the blocksizes are trivial to compute
 4575|      0|      for (size_t i = 0; i + 1 < nblocks; i++) {
  ------------------
  |  Branch (4575:26): [True: 0, False: 0]
  ------------------
 4576|      0|        block_csizes[i] = (int)chunk_blocksize;
 4577|      0|      }
 4578|       |      // The last block could be incomplete, mainly due to the fact that the block size is not divisible
 4579|       |      // by the typesize
 4580|      0|      block_csizes[nblocks - 1] = (int32_t)leftover_block ? (int32_t)leftover_block : chunk_blocksize;
  ------------------
  |  Branch (4580:35): [True: 0, False: 0]
  ------------------
 4581|      0|    }
 4582|      0|    else {
 4583|       |      // In regular, compressed chunks, we need to sort the bstarts (they can be out
 4584|       |      // of order because of multi-threading), and get a reverse index too.
 4585|      0|      memcpy(block_csizes, *chunk + BLOSC_EXTENDED_HEADER_LENGTH, nblocks * sizeof(int32_t));
 4586|       |      // Helper structure to keep track of original indexes
 4587|      0|      csize_idx = malloc(nblocks * sizeof(struct csize_idx));
 4588|      0|      if (csize_idx == NULL) {
  ------------------
  |  Branch (4588:11): [True: 0, False: 0]
  ------------------
 4589|      0|        rc = BLOSC2_ERROR_MEMORY_ALLOC;
 4590|      0|        goto end;
 4591|      0|      }
 4592|      0|      for (size_t n = 0; n < nblocks; n++) {
  ------------------
  |  Branch (4592:26): [True: 0, False: 0]
  ------------------
 4593|       |        // A block starts within its chunk, at or after streams_offset; damaged
 4594|       |        // starts would point into chunk headers or overflow the differences below
 4595|       |        // (and in sort_offset())
 4596|      0|        if (block_csizes[n] < (int64_t)streams_offset || block_csizes[n] > chunk_cbytes) {
  ------------------
  |  Branch (4596:13): [True: 0, False: 0]
  |  Branch (4596:58): [True: 0, False: 0]
  ------------------
 4597|      0|          rc = BLOSC2_ERROR_INVALID_HEADER;
 4598|      0|          goto end;
 4599|      0|        }
 4600|      0|        csize_idx[n].val = block_csizes[n];
 4601|      0|        csize_idx[n].idx = (int)n;
 4602|      0|      }
 4603|      0|      qsort(csize_idx, nblocks, sizeof(struct csize_idx), &sort_offset);
 4604|       |      // Compute the actual csizes
 4605|      0|      int idx;
 4606|      0|      for (size_t n = 0; n + 1 < nblocks; n++) {
  ------------------
  |  Branch (4606:26): [True: 0, False: 0]
  ------------------
 4607|      0|        idx = csize_idx[n].idx;
 4608|      0|        block_csizes[idx] = csize_idx[n + 1].val - csize_idx[n].val;
 4609|      0|      }
 4610|      0|      idx = csize_idx[nblocks - 1].idx;
 4611|      0|      block_csizes[idx] = chunk_cbytes - csize_idx[nblocks - 1].val;
 4612|      0|      free(csize_idx);
 4613|      0|      csize_idx = NULL;
 4614|      0|    }
 4615|       |    // Copy the csizes at the end of the trailer
 4616|      0|    void *trailer_csizes = *chunk + lazychunk_cbytes - nblocks * sizeof(int32_t);
 4617|      0|    memcpy(trailer_csizes, block_csizes, nblocks * sizeof(int32_t));
 4618|      0|    free(block_csizes);
 4619|      0|    block_csizes = NULL;
 4620|     69|  } else {
 4621|       |    // The chunk is in memory and just one pointer away
 4622|     69|    int64_t chunk_header_offset = header_len + offset;
 4623|     69|    int64_t chunk_cbytes_offset = chunk_header_offset + BLOSC_MIN_HEADER_LENGTH;
 4624|       |
 4625|     69|    *chunk = frame->cframe + chunk_header_offset;
 4626|       |
 4627|     69|    if (chunk_header_offset < 0 ||
  ------------------
  |  Branch (4627:9): [True: 0, False: 69]
  ------------------
 4628|     69|        chunk_cbytes_offset < chunk_header_offset ||
  ------------------
  |  Branch (4628:9): [True: 0, False: 69]
  ------------------
 4629|     69|        chunk_cbytes_offset > frame->len) {
  ------------------
  |  Branch (4629:9): [True: 0, False: 69]
  ------------------
 4630|      0|      BLOSC_TRACE_ERROR("Cannot read the header for chunk in the (contiguous) frame.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4631|      0|      rc = BLOSC2_ERROR_READ_BUFFER;
 4632|     69|    } else {
 4633|     69|      int32_t chunk_blocksize = 0;
 4634|     69|      rc = blosc2_cbuffer_sizes(*chunk, NULL, &lazychunk_cbytes, &chunk_blocksize);
 4635|     69|      if (rc < 0) {
  ------------------
  |  Branch (4635:11): [True: 0, False: 69]
  ------------------
 4636|      0|        BLOSC_TRACE_ERROR("Cannot read the chunk header.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4637|      0|        rc = BLOSC2_ERROR_READ_BUFFER;
 4638|      0|      }
 4639|     69|      else if (chunk_blocksize <= 0) {
  ------------------
  |  Branch (4639:16): [True: 0, False: 69]
  ------------------
 4640|      0|        BLOSC_TRACE_ERROR("Invalid blocksize %d in chunk header.", chunk_blocksize);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4641|      0|        rc = BLOSC2_ERROR_INVALID_HEADER;
 4642|      0|      }
 4643|     69|      else if (lazychunk_cbytes < BLOSC_EXTENDED_HEADER_LENGTH ||
  ------------------
  |  Branch (4643:16): [True: 0, False: 69]
  ------------------
 4644|     69|               chunk_header_offset > INT64_MAX - lazychunk_cbytes ||
  ------------------
  |  Branch (4644:16): [True: 0, False: 69]
  ------------------
 4645|     69|               chunk_header_offset + lazychunk_cbytes > frame_len) {
  ------------------
  |  Branch (4645:16): [True: 0, False: 69]
  ------------------
 4646|      0|        BLOSC_TRACE_ERROR("Compressed bytes exceed beyond frame length.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4647|      0|        rc = BLOSC2_ERROR_READ_BUFFER;
 4648|      0|      }
 4649|     69|    }
 4650|     69|  }
 4651|       |
 4652|     71|  end:
 4653|     71|  if (csize_idx != NULL) {
  ------------------
  |  Branch (4653:7): [True: 0, False: 71]
  ------------------
 4654|      0|    free(csize_idx);
 4655|      0|  }
 4656|     71|  if (block_csizes != NULL) {
  ------------------
  |  Branch (4656:7): [True: 0, False: 71]
  ------------------
 4657|      0|    free(block_csizes);
 4658|      0|  }
 4659|     71|  if (fp != NULL) {
  ------------------
  |  Branch (4659:7): [True: 0, False: 71]
  ------------------
 4660|      0|    frame_reader_release(frame, io_cb, fp);
 4661|      0|  }
 4662|     71|  if (rc < 0) {
  ------------------
  |  Branch (4662:7): [True: 0, False: 71]
  ------------------
 4663|      0|    if (*needs_free) {
  ------------------
  |  Branch (4663:9): [True: 0, False: 0]
  ------------------
 4664|      0|      free(*chunk);
 4665|      0|      *chunk = NULL;
 4666|      0|      *needs_free = false;
 4667|      0|    }
 4668|      0|    return rc;
 4669|      0|  }
 4670|       |
 4671|     71|  return (int)lazychunk_cbytes;
 4672|     71|}
frame_get_chunk_header:
 4799|  1.20k|int frame_get_chunk_header(blosc2_frame_s* frame, int64_t nchunk, uint8_t* header) {
 4800|  1.20k|  frame_fields f;
 4801|  1.20k|  int rc = get_frame_fields(frame, &f);
 4802|  1.20k|  if (rc < 0) {
  ------------------
  |  Branch (4802:7): [True: 0, False: 1.20k]
  ------------------
 4803|      0|    return rc;
 4804|      0|  }
 4805|  1.20k|  int64_t offset;
 4806|       |  return read_frame_chunk_header(frame, &f, nchunk, NULL, header, &offset);
 4807|  1.20k|}
frame_fill_special:
 4812|     70|                       int32_t chunksize, blosc2_schunk* schunk) {
 4813|     70|  int32_t header_len;
 4814|     70|  int64_t frame_len;
 4815|     70|  int64_t nbytes;
 4816|     70|  int64_t cbytes;
 4817|     70|  int32_t blocksize;
 4818|     70|  int32_t typesize;
 4819|     70|  int64_t nchunks;
 4820|       |
 4821|     70|  int rc = get_header_info(frame, &header_len, &frame_len, &nbytes, &cbytes, &blocksize, NULL,
 4822|     70|                           &nchunks, &typesize, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
 4823|     70|                           schunk->storage->io);
 4824|     70|  if (rc < 0) {
  ------------------
  |  Branch (4824:7): [True: 0, False: 70]
  ------------------
 4825|      0|    BLOSC_TRACE_ERROR("Unable to get meta info from frame.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4826|      0|    return BLOSC2_ERROR_DATA;
 4827|      0|  }
 4828|       |
 4829|     70|  if (nitems == 0) {
  ------------------
  |  Branch (4829:7): [True: 0, False: 70]
  ------------------
 4830|      0|    return frame_len;
 4831|      0|  }
 4832|       |
 4833|     70|  if ((nitems / chunksize) > INT_MAX) {
  ------------------
  |  Branch (4833:7): [True: 0, False: 70]
  ------------------
 4834|      0|    BLOSC_TRACE_ERROR("nitems is too large.  Try increasing the chunksize.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4835|      0|    return BLOSC2_ERROR_FRAME_SPECIAL;
 4836|      0|  }
 4837|       |
 4838|     70|  if ((nbytes > 0) || (cbytes > 0)) {
  ------------------
  |  Branch (4838:7): [True: 0, False: 70]
  |  Branch (4838:23): [True: 0, False: 70]
  ------------------
 4839|      0|    BLOSC_TRACE_ERROR("Filling with special values only works on empty frames");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4840|      0|    return BLOSC2_ERROR_FRAME_SPECIAL;
 4841|      0|  }
 4842|       |
 4843|       |  // Compute the number of chunks and the length of the offsets chunk
 4844|     70|  int32_t chunkitems = chunksize / typesize;
 4845|     70|  if (chunkitems <= 0) {
  ------------------
  |  Branch (4845:7): [True: 0, False: 70]
  ------------------
 4846|      0|    BLOSC_TRACE_ERROR("chunksize must be >= typesize for frame special fill.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4847|      0|    return BLOSC2_ERROR_FRAME_SPECIAL;
 4848|      0|  }
 4849|     70|  nchunks = nitems / chunkitems;
 4850|     70|  int32_t leftover_items = (int32_t)(nitems % chunkitems);
 4851|     70|  if (leftover_items) {
  ------------------
  |  Branch (4851:7): [True: 0, False: 70]
  ------------------
 4852|      0|    nchunks += 1;
 4853|      0|  }
 4854|       |
 4855|     70|  blosc2_cparams* cparams;
 4856|     70|  blosc2_schunk_get_cparams(schunk, &cparams);
 4857|       |
 4858|       |  // Build the offsets with a special chunk
 4859|     70|  int new_off_cbytes = BLOSC_EXTENDED_HEADER_LENGTH + sizeof(int64_t);
 4860|     70|  uint8_t* off_chunk = malloc(new_off_cbytes);
 4861|     70|  uint64_t offset_value = ((uint64_t)1 << 63);
 4862|     70|  uint8_t* sample_chunk = malloc(BLOSC_EXTENDED_HEADER_LENGTH);
 4863|     70|  if (off_chunk == NULL || sample_chunk == NULL) {
  ------------------
  |  Branch (4863:7): [True: 0, False: 70]
  |  Branch (4863:28): [True: 0, False: 70]
  ------------------
 4864|      0|    free(off_chunk);
 4865|      0|    free(sample_chunk);
 4866|      0|    free(cparams);
 4867|      0|    BLOSC_TRACE_ERROR("Cannot allocate memory for special fill chunks.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4868|      0|    return BLOSC2_ERROR_MEMORY_ALLOC;
 4869|      0|  }
 4870|     70|  int csize;
 4871|     70|  switch (special_value) {
 4872|     70|    case BLOSC2_SPECIAL_ZERO:
  ------------------
  |  Branch (4872:5): [True: 70, False: 0]
  ------------------
 4873|     70|      offset_value += (uint64_t) BLOSC2_SPECIAL_ZERO << (8 * 7);
 4874|     70|      csize = blosc2_chunk_zeros(*cparams, chunksize, sample_chunk, BLOSC_EXTENDED_HEADER_LENGTH);
 4875|     70|      break;
 4876|      0|    case BLOSC2_SPECIAL_UNINIT:
  ------------------
  |  Branch (4876:5): [True: 0, False: 70]
  ------------------
 4877|      0|      offset_value += (uint64_t) BLOSC2_SPECIAL_UNINIT << (8 * 7);
 4878|      0|      csize = blosc2_chunk_uninit(*cparams, chunksize, sample_chunk, BLOSC_EXTENDED_HEADER_LENGTH);
 4879|      0|      break;
 4880|      0|    case BLOSC2_SPECIAL_NAN:
  ------------------
  |  Branch (4880:5): [True: 0, False: 70]
  ------------------
 4881|      0|      offset_value += (uint64_t)BLOSC2_SPECIAL_NAN << (8 * 7);
 4882|      0|      csize = blosc2_chunk_nans(*cparams, chunksize, sample_chunk, BLOSC_EXTENDED_HEADER_LENGTH);
 4883|      0|      break;
 4884|      0|    default:
  ------------------
  |  Branch (4884:5): [True: 0, False: 70]
  ------------------
 4885|      0|      free(off_chunk);
 4886|      0|      free(sample_chunk);
 4887|      0|      free(cparams);
 4888|      0|      BLOSC_TRACE_ERROR("Only zeros, NaNs or non-initialized values are supported.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4889|      0|      return BLOSC2_ERROR_FRAME_SPECIAL;
 4890|     70|  }
 4891|     70|  if (csize < 0) {
  ------------------
  |  Branch (4891:7): [True: 0, False: 70]
  ------------------
 4892|      0|    free(off_chunk);
 4893|      0|    free(sample_chunk);
 4894|      0|    free(cparams);
 4895|      0|    BLOSC_TRACE_ERROR("Error creating sample chunk");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4896|      0|    return BLOSC2_ERROR_FRAME_SPECIAL;
 4897|      0|  }
 4898|     70|  cparams->typesize = sizeof(int64_t);  // change it to offsets typesize
 4899|       |  // cparams->blocksize = 0;   // automatic blocksize
 4900|     70|  cparams->blocksize = 8 * 2 * 1024;  // based on experiments with create_frame.c bench
 4901|     70|  cparams->clevel = 5;
 4902|     70|  cparams->compcode = BLOSC_BLOSCLZ;
 4903|     70|  int32_t special_nbytes;
 4904|     70|  if (!blosc2_nchunks_to_offsets_nbytes(nchunks, &special_nbytes)) {
  ------------------
  |  Branch (4904:7): [True: 0, False: 70]
  ------------------
 4905|      0|    free(off_chunk);
 4906|      0|    free(sample_chunk);
 4907|      0|    free(cparams);
 4908|      0|    BLOSC_TRACE_ERROR("Too many chunks for offsets representation.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4909|      0|    return BLOSC2_ERROR_FRAME_SPECIAL;
 4910|      0|  }
 4911|     70|  rc = blosc2_chunk_repeatval(*cparams, special_nbytes, off_chunk, new_off_cbytes, &offset_value);
 4912|     70|  free(cparams);
 4913|     70|  if (rc < 0) {
  ------------------
  |  Branch (4913:7): [True: 0, False: 70]
  ------------------
 4914|      0|    BLOSC_TRACE_ERROR("Error creating a special offsets chunk");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4915|      0|    return BLOSC2_ERROR_DATA;
 4916|      0|  }
 4917|       |
 4918|       |  // Get the blocksize associated to the sample chunk
 4919|     70|  blosc2_cbuffer_sizes(sample_chunk, NULL, NULL, &blocksize);
 4920|     70|  free(sample_chunk);
 4921|       |  // and use it for the super-chunk
 4922|     70|  schunk->blocksize = blocksize;
 4923|       |  // schunk->blocksize = 0;  // for experimenting with automatic blocksize
 4924|       |
 4925|       |  // We have the new offsets; update the frame.
 4926|     70|  blosc2_io_cb *io_cb = blosc2_get_io_cb(frame->schunk->storage->io->id);
 4927|     70|  if (io_cb == NULL) {
  ------------------
  |  Branch (4927:7): [True: 0, False: 70]
  ------------------
 4928|      0|    BLOSC_TRACE_ERROR("Error getting the input/output API");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4929|      0|    return BLOSC2_ERROR_PLUGIN_IO;
 4930|      0|  }
 4931|       |
 4932|     70|  int64_t new_frame_len = header_len + new_off_cbytes + frame->trailer_len;
 4933|     70|  void* fp = NULL;
 4934|     70|  if (frame->cframe != NULL) {
  ------------------
  |  Branch (4934:7): [True: 70, False: 0]
  ------------------
 4935|     70|    uint8_t* framep = frame->cframe;
 4936|       |    /* Make space for the new chunk and copy it */
 4937|     70|    frame->cframe = framep = realloc(framep, (size_t)new_frame_len);
 4938|     70|    if (framep == NULL) {
  ------------------
  |  Branch (4938:9): [True: 0, False: 70]
  ------------------
 4939|      0|      BLOSC_TRACE_ERROR("Cannot realloc space for the frame.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4940|      0|      return BLOSC2_ERROR_FRAME_SPECIAL;
 4941|      0|    }
 4942|       |    /* Copy the offsets */
 4943|     70|    memcpy(framep + header_len, off_chunk, (size_t)new_off_cbytes);
 4944|     70|  }
 4945|      0|  else {
 4946|      0|    size_t wbytes;
 4947|      0|    int64_t io_pos = 0;
 4948|      0|    if (frame->sframe) {
  ------------------
  |  Branch (4948:9): [True: 0, False: 0]
  ------------------
 4949|       |      // Update the offsets chunk in the chunks frame
 4950|      0|      fp = sframe_open_index(frame->urlpath, "rb+", frame->schunk->storage->io);
 4951|      0|      if (fp == NULL) {
  ------------------
  |  Branch (4951:11): [True: 0, False: 0]
  ------------------
 4952|      0|        BLOSC_TRACE_ERROR("Error opening file in: %s", frame->urlpath);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4953|      0|        return BLOSC2_ERROR_FILE_OPEN;
 4954|      0|      }
 4955|      0|      io_pos = frame->file_offset + header_len;
 4956|      0|    }
 4957|      0|    else {
 4958|       |      // Regular frame
 4959|      0|      fp = frame_writer_acquire(frame, io_cb);
 4960|      0|      if (fp == NULL) {
  ------------------
  |  Branch (4960:11): [True: 0, False: 0]
  ------------------
 4961|      0|        BLOSC_TRACE_ERROR("Error opening file in: %s", frame->urlpath);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4962|      0|        return BLOSC2_ERROR_FILE_OPEN;
 4963|      0|      }
 4964|      0|      io_pos = frame->file_offset + header_len + cbytes;
 4965|      0|    }
 4966|      0|    wbytes = io_cb->write(off_chunk, 1, new_off_cbytes, io_pos, fp);  // the new offsets
 4967|      0|    int close_rc = frame_writer_release(frame, io_cb, fp);
 4968|      0|    if (wbytes != (size_t)new_off_cbytes) {
  ------------------
  |  Branch (4968:9): [True: 0, False: 0]
  ------------------
 4969|      0|      BLOSC_TRACE_ERROR("Cannot write the offsets to frame.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4970|      0|      return BLOSC2_ERROR_FRAME_SPECIAL;
 4971|      0|    }
 4972|      0|    if (close_rc < 0) {
  ------------------
  |  Branch (4972:9): [True: 0, False: 0]
  ------------------
 4973|      0|      return close_rc;
 4974|      0|    }
 4975|      0|  }
 4976|       |
 4977|       |  // Invalidate the cache for chunk offsets
 4978|     70|  if (frame->coffsets != NULL) {
  ------------------
  |  Branch (4978:7): [True: 0, False: 70]
  ------------------
 4979|      0|    if (frame->coffsets_needs_free)
  ------------------
  |  Branch (4979:9): [True: 0, False: 0]
  ------------------
 4980|      0|      free(frame->coffsets);
 4981|      0|    frame->coffsets = NULL;
 4982|      0|  }
 4983|     70|  free(off_chunk);
 4984|       |
 4985|     70|  frame->len = new_frame_len;
 4986|     70|  rc = frame_update_header(frame, schunk, false);
 4987|     70|  if (rc < 0) {
  ------------------
  |  Branch (4987:7): [True: 0, False: 70]
  ------------------
 4988|      0|    return BLOSC2_ERROR_FRAME_SPECIAL;
 4989|      0|  }
 4990|       |
 4991|     70|  rc = frame_update_trailer(frame, schunk);
 4992|     70|  if (rc < 0) {
  ------------------
  |  Branch (4992:7): [True: 0, False: 70]
  ------------------
 4993|      0|    return BLOSC2_ERROR_FRAME_SPECIAL;
 4994|      0|  }
 4995|       |
 4996|     70|  return frame->len;
 4997|     70|}
frame_update_chunk:
 6216|    610|                         int32_t cbytes_old) {
 6217|    610|  uint8_t *chunk_ = (uint8_t *) chunk;
 6218|    610|  int64_t* offsets = NULL;
 6219|    610|  uint8_t* off_chunk = NULL;
 6220|    610|  int32_t header_len;
 6221|    610|  int64_t frame_len;
 6222|    610|  int64_t nbytes;
 6223|    610|  int64_t cbytes;
 6224|    610|  int32_t blocksize;
 6225|    610|  int32_t chunksize;
 6226|    610|  int64_t nchunks;
 6227|    610|  int rc = get_header_info(frame, &header_len, &frame_len, &nbytes, &cbytes,
 6228|    610|                           &blocksize, &chunksize, &nchunks,
 6229|    610|                           NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
 6230|    610|                           frame->schunk->storage->io);
 6231|    610|  if (rc < 0) {
  ------------------
  |  Branch (6231:7): [True: 0, False: 610]
  ------------------
 6232|      0|    BLOSC_TRACE_ERROR("Unable to get meta info from frame.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 6233|      0|    goto failed;
 6234|      0|  }
 6235|    610|  rc = frame_refresh_if_stale(frame, frame_len);
 6236|    610|  if (rc < 0) {
  ------------------
  |  Branch (6236:7): [True: 0, False: 610]
  ------------------
 6237|      0|    BLOSC_TRACE_ERROR("Unable to refresh the frame state from disk.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 6238|      0|    goto failed;
 6239|      0|  }
 6240|    610|  if (nchunk >= nchunks) {
  ------------------
  |  Branch (6240:7): [True: 0, False: 610]
  ------------------
 6241|      0|    BLOSC_TRACE_ERROR("The chunk must already exist.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 6242|      0|    goto failed;
 6243|      0|  }
 6244|       |
 6245|    610|  int32_t chunk_cbytes;
 6246|    610|  rc = blosc2_cbuffer_sizes(chunk, NULL, &chunk_cbytes, NULL);
 6247|    610|  if (rc < 0) {
  ------------------
  |  Branch (6247:7): [True: 0, False: 610]
  ------------------
 6248|      0|    goto failed;
 6249|      0|  }
 6250|       |
 6251|       |  // Get the current offsets
 6252|    610|  int32_t off_nbytes;
 6253|    610|  if (!blosc2_nchunks_to_offsets_nbytes(nchunks, &off_nbytes)) {
  ------------------
  |  Branch (6253:7): [True: 0, False: 610]
  ------------------
 6254|      0|    BLOSC_TRACE_ERROR("Too many chunks for offsets representation.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 6255|      0|    goto failed;
 6256|      0|  }
 6257|    610|  offsets = (int64_t *) malloc((size_t)off_nbytes);
 6258|    610|  if (offsets == NULL) {
  ------------------
  |  Branch (6258:7): [True: 0, False: 610]
  ------------------
 6259|      0|    BLOSC_TRACE_ERROR("Cannot allocate memory for offsets.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 6260|      0|    goto failed;
 6261|      0|  }
 6262|    610|  if (nchunks > 0) {
  ------------------
  |  Branch (6262:7): [True: 610, False: 0]
  ------------------
 6263|    610|    int32_t coffsets_cbytes = 0;
 6264|    610|    uint8_t *coffsets = get_coffsets(frame, header_len, cbytes, nchunks, &coffsets_cbytes);
 6265|    610|    if (coffsets == NULL) {
  ------------------
  |  Branch (6265:9): [True: 0, False: 610]
  ------------------
 6266|      0|      BLOSC_TRACE_ERROR("Cannot get the offsets for the frame.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 6267|      0|      goto failed;
 6268|      0|    }
 6269|       |    // Decompress offsets
 6270|    610|    blosc2_dparams off_dparams = BLOSC2_DPARAMS_DEFAULTS;
 6271|    610|    blosc2_context *dctx = blosc2_create_dctx(off_dparams);
 6272|    610|    if (dctx == NULL) {
  ------------------
  |  Branch (6272:9): [True: 0, False: 610]
  ------------------
 6273|      0|      BLOSC_TRACE_ERROR("Error while creating the decompression context");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 6274|      0|      goto failed;
 6275|      0|    }
 6276|    610|    int32_t prev_nbytes = blosc2_decompress_ctx(dctx, coffsets, coffsets_cbytes, offsets, off_nbytes);
 6277|    610|    blosc2_free_ctx(dctx);
 6278|    610|    if (prev_nbytes < 0) {
  ------------------
  |  Branch (6278:9): [True: 0, False: 610]
  ------------------
 6279|      0|      BLOSC_TRACE_ERROR("Cannot decompress the offsets chunk.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 6280|      0|      goto failed;
 6281|      0|    }
 6282|    610|  }
 6283|    610|  int64_t old_offset = 0;
 6284|    610|  if (!frame->sframe) {
  ------------------
  |  Branch (6284:7): [True: 610, False: 0]
  ------------------
 6285|    610|    old_offset = offsets[nchunk];
 6286|    610|  }
 6287|       |
 6288|       |  // Add the new offset
 6289|    610|  int64_t sframe_chunk_id = -1;
 6290|    610|  int64_t old_sframe_chunk_id = -1;
 6291|    610|  int64_t delta_cbytes = 0;
 6292|    610|  bool old_chunk_is_regular = (!frame->sframe && old_offset >= 0);
  ------------------
  |  Branch (6292:32): [True: 610, False: 0]
  |  Branch (6292:50): [True: 0, False: 610]
  ------------------
 6293|    610|  bool new_chunk_is_regular = true;
 6294|    610|  int64_t new_chunk_offset = cbytes;
 6295|       |  // Inside frame_begin_updates(), a resized chunk leaves a hole instead of moving the payload behind it
 6296|    610|  bool defer = !frame->sframe && frame->updates_depth > 0;
  ------------------
  |  Branch (6296:16): [True: 610, False: 0]
  |  Branch (6296:34): [True: 610, False: 0]
  ------------------
 6297|    610|  if (frame->sframe) {
  ------------------
  |  Branch (6297:7): [True: 0, False: 610]
  ------------------
 6298|      0|    if (offsets[nchunk] < 0) {
  ------------------
  |  Branch (6298:9): [True: 0, False: 0]
  ------------------
 6299|      0|      sframe_chunk_id = -1;
 6300|      0|    }
 6301|      0|    else {
 6302|       |      // In case there was a reorder in a sframe
 6303|      0|      sframe_chunk_id = offsets[nchunk];
 6304|      0|      old_sframe_chunk_id = offsets[nchunk];
 6305|      0|    }
 6306|      0|  }
 6307|    610|  int special_value = chunk_special_in_offset(chunk_, chunk_cbytes);
 6308|    610|  bool is_special_chunk = special_value != 0;
 6309|    610|  if (is_special_chunk) {
  ------------------
  |  Branch (6309:7): [True: 32, False: 578]
  ------------------
 6310|     32|    special_offset(offsets + nchunk, special_value);
 6311|     32|  }
 6312|    578|  else if (frame->sframe) {
  ------------------
  |  Branch (6312:12): [True: 0, False: 578]
  ------------------
 6313|      0|    if (sframe_chunk_id < 0) {
  ------------------
  |  Branch (6313:9): [True: 0, False: 0]
  ------------------
 6314|      0|      for (int64_t i = 0; i < nchunks; ++i) {
  ------------------
  |  Branch (6314:27): [True: 0, False: 0]
  ------------------
 6315|      0|        if (offsets[i] > sframe_chunk_id) {
  ------------------
  |  Branch (6315:13): [True: 0, False: 0]
  ------------------
 6316|      0|          sframe_chunk_id = offsets[i];
 6317|      0|        }
 6318|      0|      }
 6319|      0|      offsets[nchunk] = ++sframe_chunk_id;
 6320|      0|    }
 6321|      0|  }
 6322|    578|  else {
 6323|    578|    if (old_chunk_is_regular) {
  ------------------
  |  Branch (6323:9): [True: 0, False: 578]
  ------------------
 6324|      0|      new_chunk_offset = old_offset;
 6325|      0|    }
 6326|    578|    offsets[nchunk] = new_chunk_offset;
 6327|    578|  }
 6328|    610|  if (is_special_chunk) {
  ------------------
  |  Branch (6328:7): [True: 32, False: 578]
  ------------------
 6329|     32|    chunk_cbytes = 0;   // Special chunks are encoded in offsets and have no stored payload.
 6330|     32|    new_chunk_is_regular = false;
 6331|     32|  }
 6332|    610|  if (defer) {
  ------------------
  |  Branch (6332:7): [True: 610, False: 0]
  ------------------
 6333|    610|    if (old_chunk_is_regular || new_chunk_is_regular) {
  ------------------
  |  Branch (6333:9): [True: 0, False: 610]
  |  Branch (6333:33): [True: 578, False: 32]
  ------------------
 6334|    578|      int64_t payload_end = cbytes;
 6335|    578|      new_chunk_offset = holes_place(frame, old_chunk_is_regular ? old_offset : -1, cbytes_old, chunk_cbytes,
  ------------------
  |  Branch (6335:45): [True: 0, False: 578]
  ------------------
 6336|    578|                                     &payload_end);
 6337|    578|      delta_cbytes = payload_end - cbytes;
 6338|    578|      if (new_chunk_is_regular) {
  ------------------
  |  Branch (6338:11): [True: 578, False: 0]
  ------------------
 6339|    578|        offsets[nchunk] = new_chunk_offset;
 6340|    578|      }
 6341|    578|    }
 6342|    610|  }
 6343|      0|  else if (!frame->sframe) {
  ------------------
  |  Branch (6343:12): [True: 0, False: 0]
  ------------------
 6344|      0|    if (old_chunk_is_regular) {
  ------------------
  |  Branch (6344:9): [True: 0, False: 0]
  ------------------
 6345|      0|      delta_cbytes = (int64_t)chunk_cbytes - cbytes_old;
 6346|      0|      for (int64_t i = 0; i < nchunks; ++i) {
  ------------------
  |  Branch (6346:27): [True: 0, False: 0]
  ------------------
 6347|      0|        if (i == nchunk || offsets[i] < 0) {
  ------------------
  |  Branch (6347:13): [True: 0, False: 0]
  |  Branch (6347:28): [True: 0, False: 0]
  ------------------
 6348|      0|          continue;
 6349|      0|        }
 6350|      0|        if (offsets[i] > old_offset) {
  ------------------
  |  Branch (6350:13): [True: 0, False: 0]
  ------------------
 6351|      0|          offsets[i] += delta_cbytes;
 6352|      0|        }
 6353|      0|      }
 6354|      0|    }
 6355|      0|    else if (new_chunk_is_regular) {
  ------------------
  |  Branch (6355:14): [True: 0, False: 0]
  ------------------
 6356|      0|      delta_cbytes = chunk_cbytes;
 6357|      0|    }
 6358|      0|  }
 6359|       |  // Re-compress the offsets again
 6360|    610|  int32_t new_off_cbytes = compress_offsets(offsets, off_nbytes, off_nbytes + BLOSC2_MAX_OVERHEAD,
 6361|    610|                                            &off_chunk);
 6362|    610|  free(offsets);
 6363|    610|  offsets = NULL;
 6364|    610|  if (new_off_cbytes < 0) {
  ------------------
  |  Branch (6364:7): [True: 0, False: 610]
  ------------------
 6365|      0|    goto failed;
 6366|      0|  }
 6367|       |
 6368|    610|  int64_t new_cbytes = cbytes;
 6369|    610|  if (!frame->sframe) {
  ------------------
  |  Branch (6369:7): [True: 610, False: 0]
  ------------------
 6370|    610|    new_cbytes += delta_cbytes;
 6371|    610|  }
 6372|      0|  else {
 6373|      0|    new_cbytes = schunk->cbytes;
 6374|      0|  }
 6375|    610|  int64_t new_frame_len;
 6376|    610|  if (frame->sframe) {
  ------------------
  |  Branch (6376:7): [True: 0, False: 610]
  ------------------
 6377|       |    // The chunk is not stored in the frame
 6378|      0|    new_frame_len = header_len + 0 + new_off_cbytes + frame->trailer_len;
 6379|      0|  }
 6380|    610|  else {
 6381|    610|    new_frame_len = header_len + new_cbytes + new_off_cbytes + frame->trailer_len;
 6382|    610|  }
 6383|       |
 6384|    610|  void* fp = NULL;
 6385|    610|  if (frame->cframe != NULL) {
  ------------------
  |  Branch (6385:7): [True: 610, False: 0]
  ------------------
 6386|    610|    uint8_t* framep = frame->cframe;
 6387|    610|    if (new_frame_len > frame->len) {
  ------------------
  |  Branch (6387:9): [True: 580, False: 30]
  ------------------
 6388|       |      // Keep the frame if the realloc fails
 6389|    580|      framep = realloc(framep, (size_t)new_frame_len);
 6390|    580|      if (framep == NULL) {
  ------------------
  |  Branch (6390:11): [True: 0, False: 580]
  ------------------
 6391|      0|        BLOSC_TRACE_ERROR("Cannot realloc space for the frame.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 6392|      0|        goto failed;
 6393|      0|      }
 6394|    580|      frame->cframe = framep;
 6395|    580|    }
 6396|    610|    if (!frame->sframe && old_chunk_is_regular && !defer) {
  ------------------
  |  Branch (6396:9): [True: 610, False: 0]
  |  Branch (6396:27): [True: 0, False: 610]
  |  Branch (6396:51): [True: 0, False: 0]
  ------------------
 6397|      0|      int64_t tail_src_offset = old_offset + cbytes_old;
 6398|      0|      int64_t tail_dst_offset = old_offset + chunk_cbytes;
 6399|      0|      int64_t tail_nbytes = cbytes - tail_src_offset;
 6400|      0|      if (tail_nbytes > 0 && tail_src_offset != tail_dst_offset) {
  ------------------
  |  Branch (6400:11): [True: 0, False: 0]
  |  Branch (6400:30): [True: 0, False: 0]
  ------------------
 6401|      0|        memmove(framep + header_len + tail_dst_offset, framep + header_len + tail_src_offset, (size_t)tail_nbytes);
 6402|      0|      }
 6403|      0|    }
 6404|    610|    if (!frame->sframe && new_chunk_is_regular) {
  ------------------
  |  Branch (6404:9): [True: 610, False: 0]
  |  Branch (6404:27): [True: 578, False: 32]
  ------------------
 6405|    578|      memcpy(framep + header_len + new_chunk_offset, chunk, (size_t)chunk_cbytes);
 6406|    578|    }
 6407|       |    /* Copy the offsets */
 6408|    610|    memcpy(framep + header_len + new_cbytes, off_chunk, (size_t)new_off_cbytes);
 6409|    610|  } else {
 6410|      0|    int64_t wbytes;
 6411|       |
 6412|      0|    int64_t io_pos = 0;
 6413|      0|    blosc2_io_cb *io_cb = blosc2_get_io_cb(frame->schunk->storage->io->id);
 6414|      0|    if (io_cb == NULL) {
  ------------------
  |  Branch (6414:9): [True: 0, False: 0]
  ------------------
 6415|      0|      BLOSC_TRACE_ERROR("Error getting the input/output API");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 6416|      0|      goto failed;
 6417|      0|    }
 6418|       |
 6419|      0|    if (frame->sframe) {
  ------------------
  |  Branch (6419:9): [True: 0, False: 0]
  ------------------
 6420|       |      // Create or update chunk file only for chunks with stored payload (regular or VALUE)
 6421|      0|      if (!is_special_chunk && sframe_chunk_id >= 0) {
  ------------------
  |  Branch (6421:11): [True: 0, False: 0]
  |  Branch (6421:32): [True: 0, False: 0]
  ------------------
 6422|      0|        if (sframe_create_chunk(frame, chunk, sframe_chunk_id, chunk_cbytes) == NULL) {
  ------------------
  |  Branch (6422:13): [True: 0, False: 0]
  ------------------
 6423|      0|          BLOSC_TRACE_ERROR("Cannot write the full chunk.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 6424|      0|          goto failed;
 6425|      0|        }
 6426|      0|      }
 6427|       |      // Update the offsets chunk in the chunks frame
 6428|      0|      fp = sframe_open_index(frame->urlpath, "rb+",
 6429|      0|                             frame->schunk->storage->io);
 6430|      0|      if (fp == NULL) {
  ------------------
  |  Branch (6430:11): [True: 0, False: 0]
  ------------------
 6431|      0|        BLOSC_TRACE_ERROR("Error opening file in: %s", frame->urlpath);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 6432|      0|        goto failed;
 6433|      0|      }
 6434|      0|      io_pos = frame->file_offset + header_len + 0;
 6435|      0|    }
 6436|      0|    else {
 6437|       |      // Regular frame
 6438|      0|      fp = frame_writer_acquire(frame, io_cb);
 6439|      0|      if (fp == NULL) {
  ------------------
  |  Branch (6439:11): [True: 0, False: 0]
  ------------------
 6440|      0|        BLOSC_TRACE_ERROR("Error opening file in: %s", frame->urlpath);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 6441|      0|        goto failed;
 6442|      0|      }
 6443|      0|      if (old_chunk_is_regular && !defer) {
  ------------------
  |  Branch (6443:11): [True: 0, False: 0]
  |  Branch (6443:35): [True: 0, False: 0]
  ------------------
 6444|      0|        int64_t tail_src_offset = old_offset + cbytes_old;
 6445|      0|        int64_t tail_dst_offset = old_offset + chunk_cbytes;
 6446|      0|        int64_t tail_nbytes = cbytes - tail_src_offset;
 6447|      0|        if (tail_nbytes < 0) {
  ------------------
  |  Branch (6447:13): [True: 0, False: 0]
  ------------------
 6448|      0|          frame_writer_release(frame, io_cb, fp);
 6449|      0|          BLOSC_TRACE_ERROR("Invalid tail length for frame payload compaction.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 6450|      0|          goto failed;
 6451|      0|        }
 6452|      0|        if (tail_nbytes > 0 && tail_src_offset != tail_dst_offset) {
  ------------------
  |  Branch (6452:13): [True: 0, False: 0]
  |  Branch (6452:32): [True: 0, False: 0]
  ------------------
 6453|      0|          int rc_move = frame_move_range(io_cb, fp,
 6454|      0|                                         frame->file_offset + header_len + tail_src_offset,
 6455|      0|                                         frame->file_offset + header_len + tail_dst_offset,
 6456|      0|                                         tail_nbytes, 0);
 6457|      0|          if (rc_move < 0) {
  ------------------
  |  Branch (6457:15): [True: 0, False: 0]
  ------------------
 6458|      0|            frame->file_end = 0;
 6459|      0|            frame_writer_release(frame, io_cb, fp);
 6460|      0|            BLOSC_TRACE_ERROR("Cannot compact the payload tail in frame.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 6461|      0|            goto failed;
 6462|      0|          }
 6463|      0|        }
 6464|      0|      }
 6465|      0|      if (new_chunk_is_regular) {
  ------------------
  |  Branch (6465:11): [True: 0, False: 0]
  ------------------
 6466|      0|        io_pos = frame->file_offset + header_len + new_chunk_offset;
 6467|      0|        wbytes = io_cb->write(chunk, 1, chunk_cbytes, io_pos, fp);  // the new chunk
 6468|      0|        if (wbytes != chunk_cbytes) {
  ------------------
  |  Branch (6468:13): [True: 0, False: 0]
  ------------------
 6469|      0|          BLOSC_TRACE_ERROR("Cannot write the full chunk to frame (wrote %" PRId64 " of %" PRId64
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 6470|      0|                            " bytes at position %" PRId64 ", nchunk=%" PRId64 ").",
 6471|      0|                            wbytes, (int64_t)chunk_cbytes, io_pos, nchunk);
 6472|      0|          frame->file_end = 0;
 6473|      0|          frame_writer_release(frame, io_cb, fp);
 6474|      0|          goto failed;
 6475|      0|        }
 6476|      0|      }
 6477|      0|      io_pos = frame->file_offset + header_len + new_cbytes;
 6478|      0|    }
 6479|      0|    wbytes = io_cb->write(off_chunk, 1, new_off_cbytes, io_pos, fp);  // the new offsets
 6480|      0|    int close_rc = frame_writer_release(frame, io_cb, fp);
 6481|      0|    if (wbytes != new_off_cbytes || close_rc < 0) {
  ------------------
  |  Branch (6481:9): [True: 0, False: 0]
  |  Branch (6481:37): [True: 0, False: 0]
  ------------------
 6482|      0|      BLOSC_TRACE_ERROR("Cannot write or close the offsets in frame.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 6483|      0|      frame->file_end = 0;
 6484|      0|      goto failed;
 6485|      0|    }
 6486|       |    // Invalidate the cache for chunk offsets
 6487|      0|    if (frame->coffsets != NULL) {
  ------------------
  |  Branch (6487:9): [True: 0, False: 0]
  ------------------
 6488|      0|      if (frame->coffsets_needs_free)
  ------------------
  |  Branch (6488:11): [True: 0, False: 0]
  ------------------
 6489|      0|        free(frame->coffsets);
 6490|      0|      frame->coffsets = NULL;
 6491|      0|    }
 6492|      0|  }
 6493|    610|  free(off_chunk);
 6494|    610|  off_chunk = NULL;
 6495|       |
 6496|    610|  if (defer) {
  ------------------
  |  Branch (6496:7): [True: 610, False: 0]
  ------------------
 6497|       |    // The header describes the payload as it lies, holes included
 6498|    610|    schunk->cbytes = new_cbytes;
 6499|    610|  }
 6500|    610|  frame->len = new_frame_len;
 6501|    610|  rc = frame_update_header(frame, schunk, false);
 6502|    610|  if (rc < 0) {
  ------------------
  |  Branch (6502:7): [True: 0, False: 610]
  ------------------
 6503|      0|    frame->len = frame_len;
 6504|      0|    goto failed;
 6505|      0|  }
 6506|       |
 6507|    610|  rc = frame_update_trailer(frame, schunk);
 6508|    610|  if (rc < 0) {
  ------------------
  |  Branch (6508:7): [True: 0, False: 610]
  ------------------
 6509|      0|    frame->len = frame_len;
 6510|      0|    goto failed;
 6511|      0|  }
 6512|       |
 6513|    610|  if (frame->sframe && is_special_chunk && old_sframe_chunk_id >= 0) {
  ------------------
  |  Branch (6513:7): [True: 0, False: 610]
  |  Branch (6513:24): [True: 0, False: 0]
  |  Branch (6513:44): [True: 0, False: 0]
  ------------------
 6514|      0|    const blosc2_io *io = (frame->schunk && frame->schunk->storage) ? frame->schunk->storage->io : NULL;
  ------------------
  |  Branch (6514:28): [True: 0, False: 0]
  |  Branch (6514:45): [True: 0, False: 0]
  ------------------
 6515|      0|    int err = sframe_delete_chunk(frame->urlpath, old_sframe_chunk_id, io);
 6516|      0|    if (err != BLOSC2_ERROR_SUCCESS) {
  ------------------
  |  Branch (6516:9): [True: 0, False: 0]
  ------------------
 6517|      0|      BLOSC_TRACE_WARNING("Unable to evict old chunk %" PRId64 " from sframe (error %d).",
  ------------------
  |  |   94|      0|#define BLOSC_TRACE_WARNING(msg, ...) BLOSC_TRACE(warning, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 6518|      0|                          old_sframe_chunk_id, err);
 6519|       |      // Do not return NULL: the update was already committed to the index and trailer.
 6520|       |      // Distinguish orphan cleanup failure from failure to commit the update.
 6521|      0|    }
 6522|      0|  }
 6523|       |
 6524|    610|  return frame;
 6525|       |
 6526|      0|  failed:
 6527|      0|  free(offsets);
 6528|      0|  free(off_chunk);
 6529|       |  return NULL;
 6530|    610|}
frame_begin_updates:
 6716|     70|int frame_begin_updates(blosc2_frame_s* frame) {
 6717|     70|  if (frame == NULL) {
  ------------------
  |  Branch (6717:7): [True: 0, False: 70]
  ------------------
 6718|      0|    return BLOSC2_ERROR_SUCCESS;
 6719|      0|  }
 6720|     70|  int rc = frame_lock(frame, true);
 6721|     70|  if (rc < 0) {
  ------------------
  |  Branch (6721:7): [True: 0, False: 70]
  ------------------
 6722|      0|    return rc;
 6723|      0|  }
 6724|     70|  if (!frame->sframe && frame->updates_depth++ == 0) {
  ------------------
  |  Branch (6724:7): [True: 70, False: 0]
  |  Branch (6724:25): [True: 70, False: 0]
  ------------------
 6725|     70|    frame->nholes = 0;
 6726|       |    frame->holes_lost = false;
 6727|     70|  }
 6728|     70|  return BLOSC2_ERROR_SUCCESS;
 6729|     70|}
frame_end_updates:
 6732|     70|int frame_end_updates(blosc2_frame_s* frame, blosc2_schunk* schunk) {
 6733|     70|  if (frame == NULL) {
  ------------------
  |  Branch (6733:7): [True: 0, False: 70]
  ------------------
 6734|      0|    return BLOSC2_ERROR_SUCCESS;
 6735|      0|  }
 6736|     70|  int rc = BLOSC2_ERROR_SUCCESS;
 6737|     70|  if (!frame->sframe && frame->updates_depth > 0 && --frame->updates_depth == 0) {
  ------------------
  |  Branch (6737:7): [True: 70, False: 0]
  |  Branch (6737:25): [True: 70, False: 0]
  |  Branch (6737:53): [True: 70, False: 0]
  ------------------
 6738|     70|    if (frame->holes_lost) {
  ------------------
  |  Branch (6738:9): [True: 0, False: 70]
  ------------------
 6739|       |      // Valid, just larger: the holes stay as dead space, like the space of deleted chunks
 6740|      0|      BLOSC_TRACE_WARNING("Lost track of the free space in the frame; it stays.");
  ------------------
  |  |   94|      0|#define BLOSC_TRACE_WARNING(msg, ...) BLOSC_TRACE(warning, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 6741|      0|    }
 6742|     70|    else if (frame->nholes > 0) {
  ------------------
  |  Branch (6742:14): [True: 0, False: 70]
  ------------------
 6743|      0|      rc = frame_compact(frame, schunk);
 6744|      0|    }
 6745|     70|    frame->nholes = 0;
 6746|     70|    frame->holes_lost = false;
 6747|     70|  }
 6748|     70|  int unlock_rc = frame_unlock(frame);
 6749|     70|  return rc < 0 ? rc : unlock_rc;
  ------------------
  |  Branch (6749:10): [True: 0, False: 70]
  ------------------
 6750|     70|}
frame_decompress_chunk:
 7084|  1.15k|int frame_decompress_chunk(blosc2_context *dctx, blosc2_frame_s* frame, int64_t nchunk, void *dest, int32_t nbytes) {
 7085|  1.15k|  uint8_t* src = NULL;
 7086|  1.15k|  bool needs_free = false;
 7087|  1.15k|  int32_t srcsize;
 7088|  1.15k|  int32_t chunk_nbytes;
 7089|  1.15k|  int32_t chunk_cbytes;
 7090|  1.15k|  int rc;
 7091|       |
 7092|  1.15k|  size_t capacity = 0;
 7093|  1.15k|  rc = get_chunk(frame, nchunk, &src, &needs_free, &capacity);
 7094|  1.15k|  if (rc < 0) {
  ------------------
  |  Branch (7094:7): [True: 0, False: 1.15k]
  ------------------
 7095|      0|    BLOSC_TRACE_ERROR("Cannot get the chunk in position %" PRId64 ".", nchunk);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 7096|      0|    goto end;
 7097|      0|  }
 7098|  1.15k|  srcsize = rc;
 7099|  1.15k|  if (srcsize < BLOSC_MIN_HEADER_LENGTH) {
  ------------------
  |  Branch (7099:7): [True: 0, False: 1.15k]
  ------------------
 7100|      0|    BLOSC_TRACE_ERROR("Not enough input to read the header of chunk %" PRId64 ".", nchunk);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 7101|      0|    rc = BLOSC2_ERROR_READ_BUFFER;
 7102|      0|    goto end;
 7103|      0|  }
 7104|       |
 7105|  1.15k|  rc = blosc2_cbuffer_sizes(src, &chunk_nbytes, &chunk_cbytes, NULL);
 7106|  1.15k|  if (rc < 0) {
  ------------------
  |  Branch (7106:7): [True: 0, False: 1.15k]
  ------------------
 7107|      0|    goto end;
 7108|      0|  }
 7109|       |  /* The header cbytes is used as srcsize below, so it must fit in what was read */
 7110|  1.15k|  if (chunk_cbytes > srcsize) {
  ------------------
  |  Branch (7110:7): [True: 0, False: 1.15k]
  ------------------
 7111|      0|    BLOSC_TRACE_ERROR("Invalid chunk size in frame for chunk %" PRId64 ".", nchunk);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 7112|      0|    rc = BLOSC2_ERROR_INVALID_HEADER;
 7113|      0|    goto end;
 7114|      0|  }
 7115|       |
 7116|       |  /* Create a buffer for destination */
 7117|  1.15k|  if (chunk_nbytes > nbytes) {
  ------------------
  |  Branch (7117:7): [True: 0, False: 1.15k]
  ------------------
 7118|      0|    BLOSC_TRACE_ERROR("Not enough space for decompressing in dest.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 7119|      0|    rc = BLOSC2_ERROR_WRITE_BUFFER;
 7120|      0|    goto end;
 7121|      0|  }
 7122|       |  /* And decompress it */
 7123|  1.15k|  dctx->header_overhead = BLOSC_EXTENDED_HEADER_LENGTH;
 7124|  1.15k|  int chunksize = rc = blosc2_decompress_ctx(dctx, src, chunk_cbytes, dest, nbytes);
 7125|  1.15k|  if (chunksize < 0 || chunksize != chunk_nbytes) {
  ------------------
  |  Branch (7125:7): [True: 0, False: 1.15k]
  |  Branch (7125:24): [True: 0, False: 1.15k]
  ------------------
 7126|      0|    BLOSC_TRACE_ERROR("Error in decompressing chunk.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 7127|      0|    if (chunksize >= 0)
  ------------------
  |  Branch (7127:9): [True: 0, False: 0]
  ------------------
 7128|      0|      rc = BLOSC2_ERROR_FAILURE;
 7129|      0|  }
 7130|  1.15k|  end:
 7131|  1.15k|  if (needs_free) {
  ------------------
  |  Branch (7131:7): [True: 0, False: 1.15k]
  ------------------
 7132|      0|    blosc2_tmp_free(src, capacity);
 7133|      0|  }
 7134|  1.15k|  return rc;
 7135|  1.15k|}
frame.c:frame_writer_close_locked:
  474|  2.02k|static int frame_writer_close_locked(blosc2_frame_s* frame) {
  475|  2.02k|  int rc = BLOSC2_ERROR_SUCCESS;
  476|  2.02k|  if (frame->write_fp != NULL) {
  ------------------
  |  Branch (476:7): [True: 0, False: 2.02k]
  ------------------
  477|       |    /* Only the filesystem backend ever populates write_fp */
  478|      0|    int close_rc = blosc2_stdio_close(frame->write_fp);
  479|      0|    frame->write_fp = NULL;
  480|      0|#if !defined(_WIN32)
  481|      0|    reader_cache_return();
  482|      0|#endif
  483|      0|    if (close_rc != 0) {
  ------------------
  |  Branch (483:9): [True: 0, False: 0]
  ------------------
  484|      0|      BLOSC_TRACE_ERROR("Cannot close the cached frame writer handle.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  485|      0|      rc = BLOSC2_ERROR_FILE_WRITE;
  486|      0|    }
  487|      0|  }
  488|       |  frame->write_fp_stale = false;
  489|  2.02k|  frame->file_end = 0;
  490|  2.02k|  return rc;
  491|  2.02k|}
frame.c:frame_reader_close_locked:
  441|  2.02k|static int frame_reader_close_locked(blosc2_frame_s* frame, bool force) {
  442|  2.02k|  if (frame->read_fp == NULL) {
  ------------------
  |  Branch (442:7): [True: 2.02k, False: 0]
  ------------------
  443|  2.02k|    return BLOSC2_ERROR_SUCCESS;
  444|  2.02k|  }
  445|      0|  if (frame->read_fp_refs > 0 && !force) {
  ------------------
  |  Branch (445:7): [True: 0, False: 0]
  |  Branch (445:34): [True: 0, False: 0]
  ------------------
  446|       |    /* A caller up the stack is reading through it (frame_to_schunk holds it
  447|       |       across its whole chunk loop, and that loop re-enters get_header_info).
  448|       |       Closing it here would hand that caller a dangling handle, and its own
  449|       |       release would then close it a second time.  Leave it: the operation in
  450|       |       flight finishes on the file it started on, and the next revalidate --
  451|       |       past that release -- drops it. */
  452|      0|    return 1;
  453|      0|  }
  454|       |  /* read_fp only ever comes from the filesystem backend, so close it directly:
  455|       |     blosc2_get_io_cb() would return NULL after a blosc2_destroy(), and then the
  456|       |     descriptor would leak while its cache slot got handed back anyway. */
  457|      0|  int close_rc = blosc2_stdio_close(frame->read_fp);
  458|      0|  frame->read_fp = NULL;
  459|      0|  frame->read_fp_refs = 0;
  460|      0|#if !defined(_WIN32)
  461|      0|  reader_cache_return();
  462|      0|#endif
  463|      0|  if (close_rc != 0) {
  ------------------
  |  Branch (463:7): [True: 0, False: 0]
  ------------------
  464|      0|    BLOSC_TRACE_ERROR("Cannot close the cached frame reader handle.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  465|      0|    return BLOSC2_ERROR_FILE_WRITE;
  466|      0|  }
  467|      0|  return BLOSC2_ERROR_SUCCESS;
  468|      0|}
frame.c:frame_alloc:
  308|  2.02k|static blosc2_frame_s* frame_alloc(void) {
  309|  2.02k|  blosc2_frame_s* frame = calloc(1, sizeof(blosc2_frame_s));
  310|  2.02k|  if (frame != NULL) {
  ------------------
  |  Branch (310:7): [True: 2.02k, False: 0]
  ------------------
  311|  2.02k|    blosc2_pthread_mutex_init(&frame->read_fp_mutex, NULL);
  ------------------
  |  |   90|  2.02k|#define blosc2_pthread_mutex_init(a, b) pthread_mutex_init((a), (b))
  ------------------
  312|  2.02k|  }
  313|  2.02k|  return frame;
  314|  2.02k|}
frame.c:frame_refresh_if_stale:
 1568|  3.30k|static int frame_refresh_if_stale(blosc2_frame_s *frame, int64_t frame_len_on_disk) {
 1569|  3.30k|  if (frame->cframe != NULL || frame->schunk == NULL ||
  ------------------
  |  Branch (1569:7): [True: 3.30k, False: 0]
  |  Branch (1569:32): [True: 0, False: 0]
  ------------------
 1570|  3.30k|      (!frame->force_refresh && frame_len_on_disk == frame->len)) {
  ------------------
  |  Branch (1570:8): [True: 0, False: 0]
  |  Branch (1570:33): [True: 0, False: 0]
  ------------------
 1571|  3.30k|    return 0;
 1572|  3.30k|  }
 1573|       |  // Saved so the metalayer-reload retry loop below can roll back to a fully
 1574|       |  // consistent state on exhaustion, rather than leaving frame->len/trailer_len
 1575|       |  // committed to the new value with no metalayers to match it.
 1576|      0|  int64_t old_len = frame->len;
 1577|      0|  uint32_t old_trailer_len = frame->trailer_len;
 1578|       |
 1579|      0|  if (frame_len_on_disk < FRAME_HEADER_MINLEN + FRAME_TRAILER_MINLEN) {
  ------------------
  |  |   49|      0|#define FRAME_HEADER_MINLEN (FRAME_FILTER_PIPELINE + 1 + 16)  // 87 <- minimum length
  |  |  ------------------
  |  |  |  |   44|      0|#define FRAME_FILTER_PIPELINE (FRAME_HAS_VLMETALAYERS + 1 + 1) // 70
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|      0|#define FRAME_HAS_VLMETALAYERS (FRAME_NTHREADS_D + 2)  // 68
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define FRAME_NTHREADS_D (FRAME_NTHREADS_C + 2 + 1)  // 66
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   41|      0|#define FRAME_NTHREADS_C (FRAME_CHUNKSIZE + 4 + 1)  // 63
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   40|      0|#define FRAME_CHUNKSIZE (FRAME_BLOCKSIZE + 4 + 1)  // 58
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   39|      0|#define FRAME_BLOCKSIZE (FRAME_TYPESIZE + 4 + 1)  // 53
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   38|      0|#define FRAME_TYPESIZE (FRAME_CBYTES + 8 + 1) // 48
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|      0|#define FRAME_CBYTES (FRAME_NBYTES + 8 + 1)  // 39
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   36|      0|#define FRAME_NBYTES (FRAME_FLAGS + 4 + 1)  // 30
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   32|      0|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   31|      0|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   30|      0|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   29|      0|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                if (frame_len_on_disk < FRAME_HEADER_MINLEN + FRAME_TRAILER_MINLEN) {
  ------------------
  |  |   58|      0|#define FRAME_TRAILER_MINLEN (25)  // minimum length for the trailer (msgpack overhead)
  ------------------
  |  Branch (1579:7): [True: 0, False: 0]
  ------------------
 1580|      0|    BLOSC_TRACE_ERROR("Invalid on-disk frame length (%" PRId64 ").", frame_len_on_disk);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1581|      0|    return BLOSC2_ERROR_FILE_READ;
 1582|      0|  }
 1583|       |
 1584|       |  // Read and validate the trailer *before* mutating any frame state below,
 1585|       |  // so a transient torn read (a writer without locking has no coordination
 1586|       |  // preventing a reader from landing mid-rewrite here -- the documented
 1587|       |  // SWMR-without-locking tradeoff) can be handled opportunistically: keep
 1588|       |  // the old cached view and let the next access retry, the same way
 1589|       |  // frame_check_stale()'s header read already does a few lines up in the
 1590|       |  // caller. Once frame->len/coffsets are overwritten below, a failure
 1591|       |  // partway through would leave the frame in a self-inconsistent state
 1592|       |  // (new length, stale trailer/offsets), so those mutations only happen
 1593|       |  // after the trailer is confirmed good.
 1594|      0|  blosc2_io_cb *io_cb = blosc2_get_io_cb(frame->schunk->storage->io->id);
 1595|      0|  if (io_cb == NULL) {
  ------------------
  |  Branch (1595:7): [True: 0, False: 0]
  ------------------
 1596|      0|    BLOSC_TRACE_ERROR("Error getting the input/output API");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1597|      0|    return BLOSC2_ERROR_PLUGIN_IO;
 1598|      0|  }
 1599|      0|  void* fp;
 1600|      0|  if (frame->sframe) {
  ------------------
  |  Branch (1600:7): [True: 0, False: 0]
  ------------------
 1601|      0|    fp = sframe_open_index(frame->urlpath, "rb", frame->schunk->storage->io);
 1602|      0|  }
 1603|      0|  else {
 1604|      0|    fp = frame_reader_acquire(frame, frame->schunk->storage->io);
 1605|      0|  }
 1606|      0|  if (fp == NULL) {
  ------------------
  |  Branch (1606:7): [True: 0, False: 0]
  ------------------
 1607|      0|    BLOSC_TRACE_ERROR("Error opening file in: %s", frame->urlpath);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1608|      0|    return BLOSC2_ERROR_FILE_OPEN;
 1609|      0|  }
 1610|      0|  uint8_t trailer[FRAME_TRAILER_MINLEN];
 1611|      0|  uint8_t* trailer_ptr = trailer;
 1612|      0|  int64_t io_pos = frame->file_offset + frame_len_on_disk - FRAME_TRAILER_MINLEN;
  ------------------
  |  |   58|      0|#define FRAME_TRAILER_MINLEN (25)  // minimum length for the trailer (msgpack overhead)
  ------------------
 1613|      0|  int64_t rbytes = io_cb->read((void**)&trailer_ptr, 1, FRAME_TRAILER_MINLEN, io_pos, fp);
  ------------------
  |  |   58|      0|#define FRAME_TRAILER_MINLEN (25)  // minimum length for the trailer (msgpack overhead)
  ------------------
 1614|      0|  frame_reader_release(frame, io_cb, fp);
 1615|      0|  if (rbytes != FRAME_TRAILER_MINLEN) {
  ------------------
  |  |   58|      0|#define FRAME_TRAILER_MINLEN (25)  // minimum length for the trailer (msgpack overhead)
  ------------------
  |  Branch (1615:7): [True: 0, False: 0]
  ------------------
 1616|      0|    BLOSC_TRACE_ERROR("Cannot read the trailer out of the frame.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1617|      0|    return 0;  // opportunistic: transient, keep the cached view, retry later
 1618|      0|  }
 1619|      0|  int trailer_offset = FRAME_TRAILER_MINLEN - FRAME_TRAILER_LEN_OFFSET;
  ------------------
  |  |   58|      0|#define FRAME_TRAILER_MINLEN (25)  // minimum length for the trailer (msgpack overhead)
  ------------------
                int trailer_offset = FRAME_TRAILER_MINLEN - FRAME_TRAILER_LEN_OFFSET;
  ------------------
  |  |   59|      0|#define FRAME_TRAILER_LEN_OFFSET (22)  // offset to trailer length (counting from the end)
  ------------------
 1620|      0|  if (trailer_ptr[trailer_offset - 1] != 0xce) {
  ------------------
  |  Branch (1620:7): [True: 0, False: 0]
  ------------------
 1621|       |    // Not a valid trailer; most likely we are reading a frame in the middle of
 1622|       |    // being rewritten by another handle without locking (locked handles
 1623|       |    // fully serialize, so this only happens under the no-locking contract).
 1624|      0|    BLOSC_TRACE_ERROR("Invalid trailer in frame.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1625|      0|    return 0;  // opportunistic, same reasoning as above
 1626|      0|  }
 1627|      0|  uint32_t trailer_len;
 1628|      0|  from_big(&trailer_len, trailer_ptr + trailer_offset, sizeof(trailer_len));
  ------------------
  |  |   38|      0|#define from_big(dest, src, itemsize)     endian_handler(false, dest, src, itemsize)
  ------------------
 1629|      0|  if (trailer_len < FRAME_TRAILER_MINLEN || trailer_len > INT32_MAX ||
  ------------------
  |  |   58|      0|#define FRAME_TRAILER_MINLEN (25)  // minimum length for the trailer (msgpack overhead)
  ------------------
  |  Branch (1629:7): [True: 0, False: 0]
  |  Branch (1629:45): [True: 0, False: 0]
  ------------------
 1630|      0|      (int64_t)trailer_len > frame_len_on_disk - FRAME_HEADER_MINLEN) {
  ------------------
  |  |   49|      0|#define FRAME_HEADER_MINLEN (FRAME_FILTER_PIPELINE + 1 + 16)  // 87 <- minimum length
  |  |  ------------------
  |  |  |  |   44|      0|#define FRAME_FILTER_PIPELINE (FRAME_HAS_VLMETALAYERS + 1 + 1) // 70
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|      0|#define FRAME_HAS_VLMETALAYERS (FRAME_NTHREADS_D + 2)  // 68
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define FRAME_NTHREADS_D (FRAME_NTHREADS_C + 2 + 1)  // 66
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   41|      0|#define FRAME_NTHREADS_C (FRAME_CHUNKSIZE + 4 + 1)  // 63
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   40|      0|#define FRAME_CHUNKSIZE (FRAME_BLOCKSIZE + 4 + 1)  // 58
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   39|      0|#define FRAME_BLOCKSIZE (FRAME_TYPESIZE + 4 + 1)  // 53
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   38|      0|#define FRAME_TYPESIZE (FRAME_CBYTES + 8 + 1) // 48
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|      0|#define FRAME_CBYTES (FRAME_NBYTES + 8 + 1)  // 39
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   36|      0|#define FRAME_NBYTES (FRAME_FLAGS + 4 + 1)  // 30
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   32|      0|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   31|      0|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   30|      0|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   29|      0|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1630:7): [True: 0, False: 0]
  ------------------
 1631|      0|    BLOSC_TRACE_ERROR("Invalid trailer length (%" PRIu32 ") in frame.", trailer_len);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1632|      0|    return 0;  // opportunistic, same reasoning as above
 1633|      0|  }
 1634|       |
 1635|       |  // Trailer confirmed good: now safe to commit the new length. The lock
 1636|       |  // generation counter (see frame_lock) may have flagged a mutation that
 1637|       |  // left the frame length unchanged; only clear that flag here, once a
 1638|       |  // refresh has actually happened -- clearing it earlier and then bailing
 1639|       |  // out opportunistically above would permanently lose a same-length
 1640|       |  // mutation notification on a torn-read retry. The cached offsets index is
 1641|       |  // dropped further down, only once the metalayer/vlmetalayer reload below
 1642|       |  // has actually succeeded -- neither of those touches frame->coffsets, so
 1643|       |  // deferring this keeps the old view of it fully intact for the
 1644|       |  // opportunistic rollback path below, exactly as strong as the trailer
 1645|       |  // read's own bail-outs above.
 1646|      0|  frame->force_refresh = false;
 1647|      0|  frame->len = frame_len_on_disk;
 1648|      0|  frame->file_end = 0;  // another handle wrote the file; its size is unknown again
 1649|      0|  if (frame->nholes > 0) {
  ------------------
  |  Branch (1649:7): [True: 0, False: 0]
  ------------------
 1650|       |    // Nor do we know its free space any more (only an unlocked writer gets here inside frame_begin_updates())
 1651|      0|    frame->nholes = 0;
 1652|      0|    frame->holes_lost = true;
 1653|      0|  }
 1654|      0|  frame->trailer_len = trailer_len;
 1655|       |
 1656|       |  // The header metalayers and trailer vlmetalayers were cached at open time;
 1657|       |  // reload them so metadata changes made by another handle (e.g. a b2nd shape
 1658|       |  // update) become visible too.  The guard protects against re-entering from
 1659|       |  // the reload path itself (get_header_info does not refresh, but cheap
 1660|       |  // insurance against future changes there).
 1661|       |  //
 1662|       |  // frame_get_metalayers()/frame_get_vlmetalayers() each do their own fully
 1663|       |  // independent header/trailer re-read (separate from the trailer read
 1664|       |  // above), so without locking they can hit the same transient torn-read
 1665|       |  // window. Unlike that trailer read, there's no way to validate first and
 1666|       |  // commit after: schunk_free_metalayers()/schunk_free_vlmetalayers() must
 1667|       |  // run before a reload attempt (the parsers write straight into
 1668|       |  // schunk->metalayers[]/vlmetalayers[] as they go), so a single failed
 1669|       |  // attempt already discards the old cached set. Retry a bounded number of
 1670|       |  // times -- both free helpers are NULL-safe and re-run cleanly against a
 1671|       |  // partial prior attempt, and each attempt is a fresh independent read, so
 1672|       |  // this self-heals once the writer's rewrite stabilizes.
 1673|       |  //
 1674|       |  // This reasoning only holds without locking, though: frame_check_stale()
 1675|       |  // (the only caller) holds the shared frame lock across this entire call
 1676|       |  // when frame->locking is set, which fully excludes writers for its
 1677|       |  // duration -- so under locking a reload failure here cannot be a torn
 1678|       |  // read, it is a genuine problem (corruption or a real I/O error), and
 1679|       |  // retrying 50 times would just waste ~50ms holding that shared lock
 1680|       |  // before silently masking it. Retry once (i.e. don't retry) and propagate
 1681|       |  // the error under locking; keep the opportunistic bounded retry + silent
 1682|       |  // rollback for the no-locking case only.
 1683|       |  //
 1684|       |  // On exhaustion in the no-locking case, roll back frame->len/trailer_len
 1685|       |  // to what they were before this call and force a full retry on the next
 1686|       |  // poll (frame->force_refresh = true) -- otherwise frame_len_on_disk ==
 1687|       |  // frame->len would short-circuit every subsequent call at the top of this
 1688|       |  // function, permanently stranding this handle with an empty metalayer set.
 1689|      0|  if (!frame->refreshing) {
  ------------------
  |  Branch (1689:7): [True: 0, False: 0]
  ------------------
 1690|      0|    frame->refreshing = true;
 1691|      0|    int rc = -1;
 1692|      0|    const int max_attempts = frame->locking ? 1 : 50;
  ------------------
  |  Branch (1692:30): [True: 0, False: 0]
  ------------------
 1693|      0|    for (int attempt = 0; attempt < max_attempts; attempt++) {
  ------------------
  |  Branch (1693:27): [True: 0, False: 0]
  ------------------
 1694|      0|      schunk_free_metalayers(frame->schunk);
 1695|      0|      rc = frame_get_metalayers(frame, frame->schunk);
 1696|      0|      if (rc >= 0) {
  ------------------
  |  Branch (1696:11): [True: 0, False: 0]
  ------------------
 1697|      0|        schunk_free_vlmetalayers(frame->schunk);
 1698|      0|        rc = frame_get_vlmetalayers(frame, frame->schunk);
 1699|      0|      }
 1700|      0|      if (rc >= 0 || attempt + 1 == max_attempts) {
  ------------------
  |  Branch (1700:11): [True: 0, False: 0]
  |  Branch (1700:22): [True: 0, False: 0]
  ------------------
 1701|      0|        break;
 1702|      0|      }
 1703|       |#if defined(_WIN32)
 1704|       |      Sleep(1);
 1705|       |#else
 1706|      0|      usleep(1000);
 1707|      0|#endif
 1708|      0|    }
 1709|      0|    frame->refreshing = false;
 1710|      0|    if (rc < 0) {
  ------------------
  |  Branch (1710:9): [True: 0, False: 0]
  ------------------
 1711|      0|      if (frame->locking) {
  ------------------
  |  Branch (1711:11): [True: 0, False: 0]
  ------------------
 1712|      0|        BLOSC_TRACE_ERROR("Cannot reload the metalayers from the refreshed frame "
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1713|      0|                          "(locked handle: this is not a transient race).");
 1714|      0|        return rc;
 1715|      0|      }
 1716|      0|      BLOSC_TRACE_ERROR("Cannot reload the metalayers from the refreshed frame "
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1717|      0|                        "after retries; rolling back to the previous cached view.");
 1718|      0|      frame->len = old_len;
 1719|      0|      frame->trailer_len = old_trailer_len;
 1720|      0|      frame->force_refresh = true;
 1721|      0|      return 0;
 1722|      0|    }
 1723|      0|  }
 1724|      0|  frame->schunk->change_tick++;
 1725|       |
 1726|       |  // Cached offsets index invalidated only now, after a fully successful
 1727|       |  // refresh: recomputed lazily from the fresh trailer on demand.
 1728|      0|  if (frame->coffsets != NULL) {
  ------------------
  |  Branch (1728:7): [True: 0, False: 0]
  ------------------
 1729|      0|    if (frame->coffsets_needs_free) {
  ------------------
  |  Branch (1729:9): [True: 0, False: 0]
  ------------------
 1730|      0|      free(frame->coffsets);
 1731|      0|    }
 1732|      0|    frame->coffsets = NULL;
 1733|      0|  }
 1734|       |
 1735|      0|  return 1;
 1736|      0|}
frame.c:get_coffsets_nbytes:
 1783|  1.83k|                               int32_t *coffsets_nbytes, const blosc2_io *io) {
 1784|  1.83k|  int32_t chunk_cbytes;
 1785|  1.83k|  int rc;
 1786|  1.83k|  int64_t off_pos = header_len;
 1787|  1.83k|  if (!frame->sframe) {
  ------------------
  |  Branch (1787:7): [True: 1.83k, False: 0]
  ------------------
 1788|  1.83k|    if (cbytes < INT64_MAX - header_len) {
  ------------------
  |  Branch (1788:9): [True: 1.83k, False: 2]
  ------------------
 1789|  1.83k|      off_pos += cbytes;
 1790|  1.83k|    }
 1791|  1.83k|  }
 1792|       |
 1793|  1.83k|  if (off_pos < 0 || off_pos > INT64_MAX - BLOSC_EXTENDED_HEADER_LENGTH ||
  ------------------
  |  Branch (1793:7): [True: 13, False: 1.82k]
  |  Branch (1793:22): [True: 1, False: 1.82k]
  ------------------
 1794|  1.82k|      off_pos + BLOSC_EXTENDED_HEADER_LENGTH > frame->len) {
  ------------------
  |  Branch (1794:7): [True: 5, False: 1.81k]
  ------------------
 1795|     19|    BLOSC_TRACE_ERROR("Cannot read the offsets outside of frame boundary.");
  ------------------
  |  |   93|     19|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|     19|    do {                                            \
  |  |  |  |   98|     19|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|     19|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 19, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|     19|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1796|     19|    return BLOSC2_ERROR_INVALID_HEADER;
 1797|     19|  }
 1798|       |
 1799|  1.81k|  if (frame->cframe != NULL) {
  ------------------
  |  Branch (1799:7): [True: 1.81k, False: 0]
  ------------------
 1800|  1.81k|    uint8_t *off_start = frame->cframe + off_pos;
 1801|  1.81k|    rc = blosc2_cbuffer_sizes(off_start, coffsets_nbytes, &chunk_cbytes, NULL);
 1802|  1.81k|    if (rc < 0) {
  ------------------
  |  Branch (1802:9): [True: 27, False: 1.79k]
  ------------------
 1803|     27|      return rc;
 1804|     27|    }
 1805|  1.79k|    if (chunk_cbytes < 0 || off_pos + chunk_cbytes > frame->len) {
  ------------------
  |  Branch (1805:9): [True: 0, False: 1.79k]
  |  Branch (1805:29): [True: 6, False: 1.78k]
  ------------------
 1806|      6|      BLOSC_TRACE_ERROR("Cannot read the cbytes outside of frame boundary.");
  ------------------
  |  |   93|      6|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      6|    do {                                            \
  |  |  |  |   98|      6|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      6|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 6, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      6|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1807|      6|      return BLOSC2_ERROR_INVALID_HEADER;
 1808|      6|    }
 1809|  1.78k|    return 0;
 1810|  1.79k|  }
 1811|       |
 1812|      0|  int64_t trailer_offset = get_trailer_offset(frame, header_len, true);
 1813|      0|  if (trailer_offset < BLOSC_EXTENDED_HEADER_LENGTH || trailer_offset + FRAME_TRAILER_MINLEN > frame->len) {
  ------------------
  |  |   58|      0|#define FRAME_TRAILER_MINLEN (25)  // minimum length for the trailer (msgpack overhead)
  ------------------
  |  Branch (1813:7): [True: 0, False: 0]
  |  Branch (1813:56): [True: 0, False: 0]
  ------------------
 1814|      0|    BLOSC_TRACE_ERROR("Cannot read the trailer out of the frame.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1815|      0|    return BLOSC2_ERROR_INVALID_HEADER;
 1816|      0|  }
 1817|       |
 1818|      0|  blosc2_io_cb *io_cb = blosc2_get_io_cb(io->id);
 1819|      0|  if (io_cb == NULL) {
  ------------------
  |  Branch (1819:7): [True: 0, False: 0]
  ------------------
 1820|      0|    BLOSC_TRACE_ERROR("Error getting the input/output API");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1821|      0|    return BLOSC2_ERROR_PLUGIN_IO;
 1822|      0|  }
 1823|       |
 1824|      0|  uint8_t header[BLOSC_EXTENDED_HEADER_LENGTH];
 1825|      0|  uint8_t *header_ptr = header;
 1826|      0|  void *fp = NULL;
 1827|      0|  int64_t io_pos = 0;
 1828|      0|  if (frame->sframe) {
  ------------------
  |  Branch (1828:7): [True: 0, False: 0]
  ------------------
 1829|      0|    fp = sframe_open_index(frame->urlpath, "rb", io);
 1830|      0|    if (fp == NULL) {
  ------------------
  |  Branch (1830:9): [True: 0, False: 0]
  ------------------
 1831|      0|      BLOSC_TRACE_ERROR("Error opening file in: %s", frame->urlpath);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1832|      0|      return BLOSC2_ERROR_FILE_OPEN;
 1833|      0|    }
 1834|      0|    io_pos = off_pos;
 1835|      0|  }
 1836|      0|  else {
 1837|      0|    fp = frame_reader_acquire(frame, io);
 1838|      0|    if (fp == NULL) {
  ------------------
  |  Branch (1838:9): [True: 0, False: 0]
  ------------------
 1839|      0|      BLOSC_TRACE_ERROR("Error opening file in: %s", frame->urlpath);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1840|      0|      return BLOSC2_ERROR_FILE_OPEN;
 1841|      0|    }
 1842|      0|    io_pos = frame->file_offset + off_pos;
 1843|      0|  }
 1844|      0|  int64_t rbytes = io_cb->read((void**)&header_ptr, 1, BLOSC_EXTENDED_HEADER_LENGTH, io_pos, fp);
 1845|      0|  frame_reader_release(frame, io_cb, fp);
 1846|      0|  if (rbytes != BLOSC_EXTENDED_HEADER_LENGTH) {
  ------------------
  |  Branch (1846:7): [True: 0, False: 0]
  ------------------
 1847|      0|    BLOSC_TRACE_ERROR("Cannot read the offsets header out of the frame.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1848|      0|    return BLOSC2_ERROR_FILE_READ;
 1849|      0|  }
 1850|       |
 1851|      0|  rc = blosc2_cbuffer_sizes(header_ptr, coffsets_nbytes, &chunk_cbytes, NULL);
 1852|      0|  if (rc < 0) {
  ------------------
  |  Branch (1852:7): [True: 0, False: 0]
  ------------------
 1853|      0|    return rc;
 1854|      0|  }
 1855|       |
 1856|      0|  if (chunk_cbytes < 0 || off_pos + chunk_cbytes > trailer_offset) {
  ------------------
  |  Branch (1856:7): [True: 0, False: 0]
  |  Branch (1856:27): [True: 0, False: 0]
  ------------------
 1857|      0|    BLOSC_TRACE_ERROR("Cannot read the offsets outside of frame boundary.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1858|      0|    return BLOSC2_ERROR_INVALID_HEADER;
 1859|      0|  }
 1860|       |
 1861|      0|  return 0;
 1862|      0|}
frame.c:get_meta_from_header:
 2963|    176|                                int32_t header_len) {
 2964|    176|  BLOSC_UNUSED_PARAM(frame);
  ------------------
  |  |   28|    176|#define BLOSC_UNUSED_PARAM(x) ((void)(x))
  ------------------
 2965|    176|  int64_t header_pos = FRAME_IDX_SIZE;
  ------------------
  |  |   51|    176|#define FRAME_IDX_SIZE (FRAME_METALAYERS + 1 + 1)  // 89
  |  |  ------------------
  |  |  |  |   50|    176|#define FRAME_METALAYERS (FRAME_HEADER_MINLEN)  // 87
  |  |  |  |  ------------------
  |  |  |  |  |  |   49|    176|#define FRAME_HEADER_MINLEN (FRAME_FILTER_PIPELINE + 1 + 16)  // 87 <- minimum length
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   44|    176|#define FRAME_FILTER_PIPELINE (FRAME_HAS_VLMETALAYERS + 1 + 1) // 70
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   43|    176|#define FRAME_HAS_VLMETALAYERS (FRAME_NTHREADS_D + 2)  // 68
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   42|    176|#define FRAME_NTHREADS_D (FRAME_NTHREADS_C + 2 + 1)  // 66
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   41|    176|#define FRAME_NTHREADS_C (FRAME_CHUNKSIZE + 4 + 1)  // 63
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   40|    176|#define FRAME_CHUNKSIZE (FRAME_BLOCKSIZE + 4 + 1)  // 58
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   39|    176|#define FRAME_BLOCKSIZE (FRAME_TYPESIZE + 4 + 1)  // 53
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   38|    176|#define FRAME_TYPESIZE (FRAME_CBYTES + 8 + 1) // 48
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|    176|#define FRAME_CBYTES (FRAME_NBYTES + 8 + 1)  // 39
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   36|    176|#define FRAME_NBYTES (FRAME_FLAGS + 4 + 1)  // 30
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   32|    176|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   31|    176|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   30|    176|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   29|    176|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2966|       |
 2967|       |  // Get the size for the index of metalayers
 2968|    176|  uint16_t idx_size;
 2969|    176|  header_pos += sizeof(idx_size);
 2970|    176|  if (header_len < header_pos) {
  ------------------
  |  Branch (2970:7): [True: 0, False: 176]
  ------------------
 2971|      0|    return BLOSC2_ERROR_READ_BUFFER;
 2972|      0|  }
 2973|    176|  from_big(&idx_size, header + FRAME_IDX_SIZE, sizeof(idx_size));
  ------------------
  |  |   38|    176|#define from_big(dest, src, itemsize)     endian_handler(false, dest, src, itemsize)
  ------------------
 2974|       |
 2975|       |  // Get the actual index of metalayers
 2976|    176|  uint8_t* metalayers_idx = header + FRAME_IDX_SIZE + 2;
  ------------------
  |  |   51|    176|#define FRAME_IDX_SIZE (FRAME_METALAYERS + 1 + 1)  // 89
  |  |  ------------------
  |  |  |  |   50|    176|#define FRAME_METALAYERS (FRAME_HEADER_MINLEN)  // 87
  |  |  |  |  ------------------
  |  |  |  |  |  |   49|    176|#define FRAME_HEADER_MINLEN (FRAME_FILTER_PIPELINE + 1 + 16)  // 87 <- minimum length
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   44|    176|#define FRAME_FILTER_PIPELINE (FRAME_HAS_VLMETALAYERS + 1 + 1) // 70
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   43|    176|#define FRAME_HAS_VLMETALAYERS (FRAME_NTHREADS_D + 2)  // 68
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   42|    176|#define FRAME_NTHREADS_D (FRAME_NTHREADS_C + 2 + 1)  // 66
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   41|    176|#define FRAME_NTHREADS_C (FRAME_CHUNKSIZE + 4 + 1)  // 63
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   40|    176|#define FRAME_CHUNKSIZE (FRAME_BLOCKSIZE + 4 + 1)  // 58
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   39|    176|#define FRAME_BLOCKSIZE (FRAME_TYPESIZE + 4 + 1)  // 53
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   38|    176|#define FRAME_TYPESIZE (FRAME_CBYTES + 8 + 1) // 48
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|    176|#define FRAME_CBYTES (FRAME_NBYTES + 8 + 1)  // 39
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   36|    176|#define FRAME_NBYTES (FRAME_FLAGS + 4 + 1)  // 30
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   32|    176|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   31|    176|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   30|    176|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   29|    176|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2977|    176|  header_pos += 1;
 2978|    176|  if (header_len < header_pos) {
  ------------------
  |  Branch (2978:7): [True: 0, False: 176]
  ------------------
 2979|      0|    return BLOSC2_ERROR_READ_BUFFER;
 2980|      0|  }
 2981|    176|  if (metalayers_idx[0] != 0xde) {   // sanity check
  ------------------
  |  Branch (2981:7): [True: 4, False: 172]
  ------------------
 2982|      4|    return BLOSC2_ERROR_DATA;
 2983|      4|  }
 2984|    172|  uint8_t* idxp = metalayers_idx + 1;
 2985|    172|  uint16_t nmetalayers;
 2986|    172|  header_pos += sizeof(nmetalayers);
 2987|    172|  if (header_len < header_pos) {
  ------------------
  |  Branch (2987:7): [True: 1, False: 171]
  ------------------
 2988|      1|    return BLOSC2_ERROR_READ_BUFFER;
 2989|      1|  }
 2990|    171|  from_big(&nmetalayers, idxp, sizeof(uint16_t));
  ------------------
  |  |   38|    171|#define from_big(dest, src, itemsize)     endian_handler(false, dest, src, itemsize)
  ------------------
 2991|    171|  idxp += 2;
 2992|    171|  if (nmetalayers > BLOSC2_MAX_METALAYERS) {
  ------------------
  |  | 1895|    171|#define BLOSC2_MAX_METALAYERS 16
  ------------------
  |  Branch (2992:7): [True: 2, False: 169]
  ------------------
 2993|      2|    return BLOSC2_ERROR_DATA;
 2994|      2|  }
 2995|    169|  schunk->nmetalayers = nmetalayers;
 2996|       |
 2997|       |  // Populate the metalayers and its serialized values
 2998|    239|  for (int nmetalayer = 0; nmetalayer < nmetalayers; nmetalayer++) {
  ------------------
  |  Branch (2998:28): [True: 127, False: 112]
  ------------------
 2999|    127|    header_pos += 1;
 3000|    127|    if (header_len < header_pos) {
  ------------------
  |  Branch (3000:9): [True: 1, False: 126]
  ------------------
 3001|      1|      return BLOSC2_ERROR_READ_BUFFER;
 3002|      1|    }
 3003|    126|    if ((*idxp & 0xe0u) != 0xa0u) {   // sanity check
  ------------------
  |  Branch (3003:9): [True: 4, False: 122]
  ------------------
 3004|      4|      return BLOSC2_ERROR_DATA;
 3005|      4|    }
 3006|    122|    blosc2_metalayer* metalayer = calloc(1, sizeof(blosc2_metalayer));
 3007|    122|    if (metalayer == NULL) {
  ------------------
  |  Branch (3007:9): [True: 0, False: 122]
  ------------------
 3008|      0|      return BLOSC2_ERROR_MEMORY_ALLOC;
 3009|      0|    }
 3010|    122|    schunk->metalayers[nmetalayer] = metalayer;
 3011|       |
 3012|       |    // Populate the metalayer string
 3013|    122|    uint8_t nslen = *idxp & (uint8_t)0x1F;
 3014|    122|    idxp += 1;
 3015|    122|    header_pos += nslen;
 3016|    122|    if (header_len < header_pos) {
  ------------------
  |  Branch (3016:9): [True: 1, False: 121]
  ------------------
 3017|      1|      return BLOSC2_ERROR_READ_BUFFER;
 3018|      1|    }
 3019|    121|    char* ns = malloc((size_t)nslen + 1);
 3020|    121|    if (ns == NULL) {
  ------------------
  |  Branch (3020:9): [True: 0, False: 121]
  ------------------
 3021|      0|      return BLOSC2_ERROR_MEMORY_ALLOC;
 3022|      0|    }
 3023|    121|    memcpy(ns, idxp, nslen);
 3024|    121|    ns[nslen] = '\0';
 3025|    121|    idxp += nslen;
 3026|    121|    metalayer->name = ns;
 3027|       |
 3028|       |    // Populate the serialized value for this metalayer
 3029|       |    // Get the offset
 3030|    121|    header_pos += 1;
 3031|    121|    if (header_len < header_pos) {
  ------------------
  |  Branch (3031:9): [True: 1, False: 120]
  ------------------
 3032|      1|      return BLOSC2_ERROR_READ_BUFFER;
 3033|      1|    }
 3034|    120|    if ((*idxp & 0xffu) != 0xd2u) {   // sanity check
  ------------------
  |  Branch (3034:9): [True: 0, False: 120]
  ------------------
 3035|      0|      return BLOSC2_ERROR_DATA;
 3036|      0|    }
 3037|    120|    idxp += 1;
 3038|    120|    int32_t offset;
 3039|    120|    header_pos += sizeof(offset);
 3040|    120|    if (header_len < header_pos) {
  ------------------
  |  Branch (3040:9): [True: 1, False: 119]
  ------------------
 3041|      1|      return BLOSC2_ERROR_READ_BUFFER;
 3042|      1|    }
 3043|    119|    from_big(&offset, idxp, sizeof(offset));
  ------------------
  |  |   38|    119|#define from_big(dest, src, itemsize)     endian_handler(false, dest, src, itemsize)
  ------------------
 3044|    119|    idxp += 4;
 3045|    119|    if (offset < 0 || offset >= header_len) {
  ------------------
  |  Branch (3045:9): [True: 7, False: 112]
  |  Branch (3045:23): [True: 15, False: 97]
  ------------------
 3046|       |      // Offset is less than zero or exceeds header length
 3047|     22|      return BLOSC2_ERROR_DATA;
 3048|     22|    }
 3049|       |    // Go to offset and see if we have the correct marker
 3050|     97|    uint8_t* content_marker = header + offset;
 3051|     97|    if ((int64_t)header_len < (int64_t)offset + 1 + 4) {
  ------------------
  |  Branch (3051:9): [True: 0, False: 97]
  ------------------
 3052|      0|      return BLOSC2_ERROR_READ_BUFFER;
 3053|      0|    }
 3054|     97|    if (*content_marker != 0xc6) {
  ------------------
  |  Branch (3054:9): [True: 2, False: 95]
  ------------------
 3055|      2|      return BLOSC2_ERROR_DATA;
 3056|      2|    }
 3057|       |
 3058|       |    // Read the size of the content
 3059|     95|    int32_t content_len;
 3060|     95|    from_big(&content_len, content_marker + 1, sizeof(content_len));
  ------------------
  |  |   38|     95|#define from_big(dest, src, itemsize)     endian_handler(false, dest, src, itemsize)
  ------------------
 3061|     95|    if (content_len < 0) {
  ------------------
  |  Branch (3061:9): [True: 1, False: 94]
  ------------------
 3062|      1|      return BLOSC2_ERROR_DATA;
 3063|      1|    }
 3064|     94|    metalayer->content_len = content_len;
 3065|       |
 3066|       |    // Finally, read the content. Use 64-bit arithmetic so a malicious
 3067|       |    // (offset, content_len) pair near INT32_MAX cannot wrap and bypass the
 3068|       |    // bounds check, which would let memcpy below read past the header buffer.
 3069|     94|    if ((int64_t)header_len < (int64_t)offset + 1 + 4 + (int64_t)content_len) {
  ------------------
  |  Branch (3069:9): [True: 24, False: 70]
  ------------------
 3070|     24|      return BLOSC2_ERROR_READ_BUFFER;
 3071|     24|    }
 3072|     70|    char* content = malloc((size_t)content_len);
 3073|       |    // malloc(0) is allowed to return NULL, and blosc2_meta_add accepts
 3074|       |    // content_len == 0, so only treat NULL as an allocation failure when
 3075|       |    // a non-zero allocation was requested.
 3076|     70|    if (content_len > 0 && content == NULL) {
  ------------------
  |  Branch (3076:9): [True: 69, False: 1]
  |  Branch (3076:28): [True: 0, False: 69]
  ------------------
 3077|      0|      return BLOSC2_ERROR_MEMORY_ALLOC;
 3078|      0|    }
 3079|     70|    if (content_len > 0) {
  ------------------
  |  Branch (3079:9): [True: 69, False: 1]
  ------------------
 3080|     69|      memcpy(content, content_marker + 1 + 4, (size_t)content_len);
 3081|     69|    }
 3082|     70|    metalayer->content = (uint8_t*)content;
 3083|     70|  }
 3084|       |
 3085|    112|  return 1;
 3086|    169|}
frame.c:get_vlmeta_from_trailer:
 3166|     69|                                   int32_t trailer_len) {
 3167|       |
 3168|     69|  BLOSC_UNUSED_PARAM(frame);
  ------------------
  |  |   28|     69|#define BLOSC_UNUSED_PARAM(x) ((void)(x))
  ------------------
 3169|     69|  int64_t trailer_pos = FRAME_TRAILER_VLMETALAYERS + 2;
  ------------------
  |  |   60|     69|#define FRAME_TRAILER_VLMETALAYERS (2)
  ------------------
 3170|     69|  uint8_t* idxp = trailer + trailer_pos;
 3171|       |
 3172|       |  // Get the size for the index of metalayers
 3173|     69|  trailer_pos += 2;
 3174|     69|  if (trailer_len < trailer_pos) {
  ------------------
  |  Branch (3174:7): [True: 0, False: 69]
  ------------------
 3175|      0|    return BLOSC2_ERROR_READ_BUFFER;
 3176|      0|  }
 3177|     69|  uint16_t idx_size;
 3178|     69|  from_big(&idx_size, idxp, sizeof(idx_size));
  ------------------
  |  |   38|     69|#define from_big(dest, src, itemsize)     endian_handler(false, dest, src, itemsize)
  ------------------
 3179|     69|  idxp += 2;
 3180|       |
 3181|     69|  trailer_pos += 1;
 3182|       |  // Get the actual index of metalayers
 3183|     69|  if (trailer_len < trailer_pos) {
  ------------------
  |  Branch (3183:7): [True: 0, False: 69]
  ------------------
 3184|      0|    return BLOSC2_ERROR_READ_BUFFER;
 3185|      0|  }
 3186|     69|  if (idxp[0] != 0xde) {   // sanity check
  ------------------
  |  Branch (3186:7): [True: 0, False: 69]
  ------------------
 3187|      0|    return BLOSC2_ERROR_DATA;
 3188|      0|  }
 3189|     69|  idxp += 1;
 3190|       |
 3191|       |  // The on-wire encoding is unsigned (uint16 follows the msgpack `0xde`
 3192|       |  // map16 marker), but `schunk->nvlmetalayers` is int16_t. Decoding into a
 3193|       |  // signed local would let raw bytes like 0xff 0xff slip past the
 3194|       |  // `> BLOSC2_MAX_VLMETALAYERS` ceiling as a negative count, after which
 3195|       |  // a later `blosc2_vlmeta_add` would write through `vlmetalayers[-1]`
 3196|       |  // and corrupt adjacent schunk fields. Decode unsigned, then narrow.
 3197|     69|  uint16_t nmetalayers;
 3198|     69|  trailer_pos += sizeof(nmetalayers);
 3199|     69|  if (trailer_len < trailer_pos) {
  ------------------
  |  Branch (3199:7): [True: 0, False: 69]
  ------------------
 3200|      0|    return BLOSC2_ERROR_READ_BUFFER;
 3201|      0|  }
 3202|     69|  from_big(&nmetalayers, idxp, sizeof(uint16_t));
  ------------------
  |  |   38|     69|#define from_big(dest, src, itemsize)     endian_handler(false, dest, src, itemsize)
  ------------------
 3203|     69|  idxp += 2;
 3204|     69|  if (nmetalayers > BLOSC2_MAX_VLMETALAYERS) {
  ------------------
  |  | 1901|     69|#define BLOSC2_MAX_VLMETALAYERS (8 * 1024)
  ------------------
  |  Branch (3204:7): [True: 0, False: 69]
  ------------------
 3205|      0|    return BLOSC2_ERROR_DATA;
 3206|      0|  }
 3207|     69|  schunk->nvlmetalayers = (int16_t)nmetalayers;
 3208|       |
 3209|       |  // Populate the metalayers and its serialized values
 3210|     69|  for (int nmetalayer = 0; nmetalayer < nmetalayers; nmetalayer++) {
  ------------------
  |  Branch (3210:28): [True: 0, False: 69]
  ------------------
 3211|      0|    trailer_pos += 1;
 3212|      0|    if (trailer_len < trailer_pos) {
  ------------------
  |  Branch (3212:9): [True: 0, False: 0]
  ------------------
 3213|      0|      return BLOSC2_ERROR_READ_BUFFER;
 3214|      0|    }
 3215|      0|    if ((*idxp & 0xe0u) != 0xa0u) {   // sanity check
  ------------------
  |  Branch (3215:9): [True: 0, False: 0]
  ------------------
 3216|      0|      return BLOSC2_ERROR_DATA;
 3217|      0|    }
 3218|      0|    blosc2_metalayer* metalayer = calloc(1, sizeof(blosc2_metalayer));
 3219|      0|    if (metalayer == NULL) {
  ------------------
  |  Branch (3219:9): [True: 0, False: 0]
  ------------------
 3220|      0|      return BLOSC2_ERROR_MEMORY_ALLOC;
 3221|      0|    }
 3222|      0|    schunk->vlmetalayers[nmetalayer] = metalayer;
 3223|       |
 3224|       |    // Populate the metalayer string
 3225|      0|    uint8_t nslen = *idxp & (uint8_t)0x1F;
 3226|      0|    idxp += 1;
 3227|      0|    trailer_pos += nslen;
 3228|      0|    if (trailer_len < trailer_pos) {
  ------------------
  |  Branch (3228:9): [True: 0, False: 0]
  ------------------
 3229|      0|      return BLOSC2_ERROR_READ_BUFFER;
 3230|      0|    }
 3231|      0|    char* ns = malloc((size_t)nslen + 1);
 3232|      0|    if (ns == NULL) {
  ------------------
  |  Branch (3232:9): [True: 0, False: 0]
  ------------------
 3233|      0|      return BLOSC2_ERROR_MEMORY_ALLOC;
 3234|      0|    }
 3235|      0|    memcpy(ns, idxp, nslen);
 3236|      0|    ns[nslen] = '\0';
 3237|      0|    idxp += nslen;
 3238|      0|    metalayer->name = ns;
 3239|       |
 3240|       |    // Populate the serialized value for this metalayer
 3241|       |    // Get the offset
 3242|      0|    trailer_pos += 1;
 3243|      0|    if (trailer_len < trailer_pos) {
  ------------------
  |  Branch (3243:9): [True: 0, False: 0]
  ------------------
 3244|      0|      return BLOSC2_ERROR_READ_BUFFER;
 3245|      0|    }
 3246|      0|    if ((*idxp & 0xffu) != 0xd2u) {   // sanity check
  ------------------
  |  Branch (3246:9): [True: 0, False: 0]
  ------------------
 3247|      0|      return BLOSC2_ERROR_DATA;
 3248|      0|    }
 3249|      0|    idxp += 1;
 3250|      0|    int32_t offset;
 3251|      0|    trailer_pos += sizeof(offset);
 3252|      0|    if (trailer_len < trailer_pos) {
  ------------------
  |  Branch (3252:9): [True: 0, False: 0]
  ------------------
 3253|      0|      return BLOSC2_ERROR_READ_BUFFER;
 3254|      0|    }
 3255|      0|    from_big(&offset, idxp, sizeof(offset));
  ------------------
  |  |   38|      0|#define from_big(dest, src, itemsize)     endian_handler(false, dest, src, itemsize)
  ------------------
 3256|      0|    idxp += 4;
 3257|      0|    if (offset < 0 || offset >= trailer_len) {
  ------------------
  |  Branch (3257:9): [True: 0, False: 0]
  |  Branch (3257:23): [True: 0, False: 0]
  ------------------
 3258|       |      // Offset is less than zero or exceeds trailer length
 3259|      0|      return BLOSC2_ERROR_DATA;
 3260|      0|    }
 3261|       |    // Go to offset and see if we have the correct marker
 3262|      0|    uint8_t* content_marker = trailer + offset;
 3263|      0|    if ((int64_t)trailer_len < (int64_t)offset + 1 + 4) {
  ------------------
  |  Branch (3263:9): [True: 0, False: 0]
  ------------------
 3264|      0|      return BLOSC2_ERROR_READ_BUFFER;
 3265|      0|    }
 3266|      0|    if (*content_marker != 0xc6) {
  ------------------
  |  Branch (3266:9): [True: 0, False: 0]
  ------------------
 3267|      0|      return BLOSC2_ERROR_DATA;
 3268|      0|    }
 3269|       |
 3270|       |    // Read the size of the content
 3271|      0|    int32_t content_len;
 3272|      0|    from_big(&content_len, content_marker + 1, sizeof(content_len));
  ------------------
  |  |   38|      0|#define from_big(dest, src, itemsize)     endian_handler(false, dest, src, itemsize)
  ------------------
 3273|      0|    if (content_len < 0) {
  ------------------
  |  Branch (3273:9): [True: 0, False: 0]
  ------------------
 3274|      0|      return BLOSC2_ERROR_DATA;
 3275|      0|    }
 3276|      0|    metalayer->content_len = content_len;
 3277|       |
 3278|       |    // Finally, read the content. Use 64-bit arithmetic so a malicious
 3279|       |    // (offset, content_len) pair near INT32_MAX cannot wrap and bypass the
 3280|       |    // bounds check, which would let memcpy below read past the trailer buffer.
 3281|      0|    if ((int64_t)trailer_len < (int64_t)offset + 1 + 4 + (int64_t)content_len) {
  ------------------
  |  Branch (3281:9): [True: 0, False: 0]
  ------------------
 3282|      0|      return BLOSC2_ERROR_READ_BUFFER;
 3283|      0|    }
 3284|      0|    char* content = malloc((size_t)content_len);
 3285|       |    // Same zero-length carve-out as in get_meta_from_header: malloc(0) may
 3286|       |    // return NULL on some platforms, and the public API allows
 3287|       |    // content_len == 0, so don't reject a valid empty vlmetalayer.
 3288|      0|    if (content_len > 0 && content == NULL) {
  ------------------
  |  Branch (3288:9): [True: 0, False: 0]
  |  Branch (3288:28): [True: 0, False: 0]
  ------------------
 3289|      0|      return BLOSC2_ERROR_MEMORY_ALLOC;
 3290|      0|    }
 3291|      0|    if (content_len > 0) {
  ------------------
  |  Branch (3291:9): [True: 0, False: 0]
  ------------------
 3292|      0|      memcpy(content, content_marker + 1 + 4, (size_t)content_len);
 3293|      0|    }
 3294|      0|    metalayer->content = (uint8_t*)content;
 3295|      0|  }
 3296|     69|  return 1;
 3297|     69|}
frame.c:validate_offsets_chunk:
 3455|  1.74k|                                  int64_t nchunks) {
 3456|  1.74k|  int32_t coffsets_cbytes = 0;
 3457|  1.74k|  uint8_t* coffsets = get_coffsets(frame, header_len, cbytes, nchunks, &coffsets_cbytes);
 3458|  1.74k|  if (coffsets == NULL) {
  ------------------
  |  Branch (3458:7): [True: 40, False: 1.70k]
  ------------------
 3459|     40|    BLOSC_TRACE_ERROR("Cannot get compressed offsets from frame.");
  ------------------
  |  |   93|     40|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|     40|    do {                                            \
  |  |  |  |   98|     40|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|     40|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 40, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|     40|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3460|     40|    return BLOSC2_ERROR_DATA;
 3461|     40|  }
 3462|       |
 3463|  1.70k|  int32_t offsets_nbytes;
 3464|  1.70k|  if (!blosc2_nchunks_to_offsets_nbytes(nchunks, &offsets_nbytes)) {
  ------------------
  |  Branch (3464:7): [True: 0, False: 1.70k]
  ------------------
 3465|      0|    BLOSC_TRACE_ERROR("Too many chunks for offsets representation.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3466|      0|    return BLOSC2_ERROR_FAILURE;
 3467|      0|  }
 3468|       |
 3469|  1.70k|  int64_t* offsets = (int64_t*)malloc((size_t)offsets_nbytes);
 3470|  1.70k|  if (offsets == NULL) {
  ------------------
  |  Branch (3470:7): [True: 0, False: 1.70k]
  ------------------
 3471|      0|    BLOSC_TRACE_ERROR("Cannot allocate memory for offsets validation.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3472|      0|    return BLOSC2_ERROR_MEMORY_ALLOC;
 3473|      0|  }
 3474|       |
 3475|  1.70k|  blosc2_dparams off_dparams = BLOSC2_DPARAMS_DEFAULTS;
 3476|  1.70k|  blosc2_context* dctx = blosc2_create_dctx(off_dparams);
 3477|  1.70k|  if (dctx == NULL) {
  ------------------
  |  Branch (3477:7): [True: 0, False: 1.70k]
  ------------------
 3478|      0|    free(offsets);
 3479|      0|    BLOSC_TRACE_ERROR("Error while creating the decompression context.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3480|      0|    return BLOSC2_ERROR_FAILURE;
 3481|      0|  }
 3482|       |
 3483|  1.70k|  int32_t off_nbytes = blosc2_decompress_ctx(dctx, coffsets, coffsets_cbytes,
 3484|  1.70k|                                             offsets, offsets_nbytes);
 3485|  1.70k|  blosc2_free_ctx(dctx);
 3486|  1.70k|  if (off_nbytes != offsets_nbytes) {
  ------------------
  |  Branch (3486:7): [True: 1.03k, False: 670]
  ------------------
 3487|  1.03k|    free(offsets);
 3488|  1.03k|    BLOSC_TRACE_ERROR("Cannot decompress offsets chunk.");
  ------------------
  |  |   93|  1.03k|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|  1.03k|    do {                                            \
  |  |  |  |   98|  1.03k|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|  1.03k|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 1.03k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|  1.03k|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3489|  1.03k|    return BLOSC2_ERROR_DATA;
 3490|  1.03k|  }
 3491|       |
 3492|  3.26G|  for (int64_t i = 0; i < nchunks; ++i) {
  ------------------
  |  Branch (3492:23): [True: 3.26G, False: 195]
  ------------------
 3493|  3.26G|    int64_t offset = offsets[i];
 3494|  3.26G|    if (offset < 0) {
  ------------------
  |  Branch (3494:9): [True: 3.26G, False: 1.05k]
  ------------------
 3495|  3.26G|      continue;
 3496|  3.26G|    }
 3497|  1.05k|    if (offset > INT64_MAX - header_len || offset > cbytes - BLOSC_EXTENDED_HEADER_LENGTH) {
  ------------------
  |  Branch (3497:9): [True: 1, False: 1.05k]
  |  Branch (3497:44): [True: 474, False: 578]
  ------------------
 3498|    475|      free(offsets);
 3499|    475|      BLOSC_TRACE_ERROR("Offset for chunk %" PRId64 " is out of bounds.", i);
  ------------------
  |  |   93|    475|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|    475|    do {                                            \
  |  |  |  |   98|    475|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|    475|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 475, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|    475|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3500|    475|      return BLOSC2_ERROR_INVALID_HEADER;
 3501|    475|    }
 3502|       |    /* Offsets do not need to be monotonic.  Frame mutations like insert can append
 3503|       |     * chunk payloads at the end of the cframe while updating the logical chunk order
 3504|       |     * only in the offsets table, so a valid frame may legitimately contain
 3505|       |     * non-monotonic non-negative offsets.
 3506|       |     */
 3507|  1.05k|  }
 3508|       |
 3509|    195|  free(offsets);
 3510|    195|  return 0;
 3511|    670|}
frame.c:frame_read_index_span:
 3911|    138|                                 int64_t *cbytes, int32_t *chunksize) {
 3912|    138|  *off = NULL;
 3913|    138|  int64_t frame_len;
 3914|    138|  int64_t frame_nbytes;
 3915|    138|  int32_t blocksize;
 3916|    138|  int64_t frame_nchunks;
 3917|    138|  int rc = get_header_info(frame, header_len, &frame_len, &frame_nbytes, cbytes, &blocksize, chunksize,
 3918|    138|                           &frame_nchunks, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
 3919|    138|                           frame->schunk->storage->io);
 3920|    138|  if (rc < 0) {
  ------------------
  |  Branch (3920:7): [True: 0, False: 138]
  ------------------
 3921|      0|    return rc;
 3922|      0|  }
 3923|       |  // A different handle may have changed the index, including a same-length
 3924|       |  // reorder flagged by frame_lock().  Refresh before reusing cached offsets.
 3925|    138|  rc = frame_refresh_if_stale(frame, frame_len);
 3926|    138|  if (rc < 0) {
  ------------------
  |  Branch (3926:7): [True: 0, False: 138]
  ------------------
 3927|      0|    return rc;
 3928|      0|  }
 3929|    138|  if (rc > 0) {
  ------------------
  |  Branch (3929:7): [True: 0, False: 138]
  ------------------
 3930|      0|    frame->schunk->nbytes = frame_nbytes;
 3931|      0|    frame->schunk->cbytes = *cbytes;
 3932|      0|    frame->schunk->nchunks = frame_nchunks;
 3933|      0|  }
 3934|    138|  int64_t hi = -1;
 3935|    138|  *lo = INT64_MAX;
 3936|  1.35k|  for (int64_t k = 0; k < n; ++k) {
  ------------------
  |  Branch (3936:23): [True: 1.22k, False: 138]
  ------------------
 3937|  1.22k|    if (nchunks[k] < 0 || nchunks[k] >= frame_nchunks) {
  ------------------
  |  Branch (3937:9): [True: 0, False: 1.22k]
  |  Branch (3937:27): [True: 0, False: 1.22k]
  ------------------
 3938|      0|      BLOSC_TRACE_ERROR("nchunk ('%" PRId64 "') exceeds the number of chunks ('%" PRId64 "').",
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3939|      0|                        nchunks[k], frame_nchunks);
 3940|      0|      return BLOSC2_ERROR_INVALID_PARAM;
 3941|      0|    }
 3942|  1.22k|    *lo = nchunks[k] < *lo ? nchunks[k] : *lo;
  ------------------
  |  Branch (3942:11): [True: 138, False: 1.08k]
  ------------------
 3943|  1.22k|    hi = nchunks[k] > hi ? nchunks[k] : hi;
  ------------------
  |  Branch (3943:10): [True: 1.22k, False: 0]
  ------------------
 3944|  1.22k|  }
 3945|    138|  if (n <= 0) {
  ------------------
  |  Branch (3945:7): [True: 0, False: 138]
  ------------------
 3946|      0|    return BLOSC2_ERROR_SUCCESS;
 3947|      0|  }
 3948|    138|  int32_t off_cbytes;
 3949|    138|  uint8_t *coffsets = get_coffsets(frame, *header_len, *cbytes, frame_nchunks, &off_cbytes);
 3950|    138|  if (coffsets == NULL) {
  ------------------
  |  Branch (3950:7): [True: 0, False: 138]
  ------------------
 3951|      0|    return BLOSC2_ERROR_DATA;
 3952|      0|  }
 3953|    138|  *span_end = hi + 1 + lookahead < frame_nchunks ? hi + 1 + lookahead : frame_nchunks;
  ------------------
  |  Branch (3953:15): [True: 0, False: 138]
  ------------------
 3954|    138|  *off = malloc((size_t) (*span_end - *lo) * sizeof(int64_t));
 3955|    138|  if (*off == NULL) {
  ------------------
  |  Branch (3955:7): [True: 0, False: 138]
  ------------------
 3956|      0|    return BLOSC2_ERROR_MEMORY_ALLOC;
 3957|      0|  }
 3958|    138|  rc = blosc2_getitem(coffsets, off_cbytes, (int32_t) *lo, (int32_t) (*span_end - *lo), *off,
 3959|    138|                      (int32_t) ((*span_end - *lo) * sizeof(int64_t)));
 3960|    138|  if (rc < 0) {
  ------------------
  |  Branch (3960:7): [True: 0, False: 138]
  ------------------
 3961|      0|    free(*off);
 3962|      0|    *off = NULL;
 3963|      0|    return rc;
 3964|      0|  }
 3965|    138|  return BLOSC2_ERROR_SUCCESS;
 3966|    138|}
frame.c:special_chunk_into:
 4042|    693|                              uint8_t* dest, int32_t cbytes) {
 4043|    693|  int rc = 0;
 4044|       |
 4045|       |  // Detect the kind of special value
 4046|    693|  uint64_t zeros_mask = (uint64_t) BLOSC2_SPECIAL_ZERO << (8 * 7);  // chunk of zeros
 4047|    693|  uint64_t nans_mask = (uint64_t) BLOSC2_SPECIAL_NAN << (8 * 7);  // chunk of NaNs
 4048|    693|  uint64_t uninit_mask = (uint64_t) BLOSC2_SPECIAL_UNINIT << (8 * 7);  // chunk of uninit values
 4049|       |
 4050|    693|  blosc2_cparams cparams = BLOSC2_CPARAMS_DEFAULTS;
 4051|    693|  cparams.typesize = typesize;
 4052|    693|  cparams.blocksize = blocksize;
 4053|    693|  if (special_value & zeros_mask) {
  ------------------
  |  Branch (4053:7): [True: 693, False: 0]
  ------------------
 4054|    693|    rc = blosc2_chunk_zeros(cparams, nbytes, dest, cbytes);
 4055|    693|    if (rc < 0) {
  ------------------
  |  Branch (4055:9): [True: 0, False: 693]
  ------------------
 4056|      0|      BLOSC_TRACE_ERROR("Error creating a zero chunk");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4057|      0|    }
 4058|    693|  }
 4059|      0|  else if (special_value & uninit_mask) {
  ------------------
  |  Branch (4059:12): [True: 0, False: 0]
  ------------------
 4060|      0|    rc = blosc2_chunk_uninit(cparams, nbytes, dest, cbytes);
 4061|      0|    if (rc < 0) {
  ------------------
  |  Branch (4061:9): [True: 0, False: 0]
  ------------------
 4062|      0|      BLOSC_TRACE_ERROR("Error creating a non initialized chunk");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4063|      0|    }
 4064|      0|  }
 4065|      0|  else if (special_value & nans_mask) {
  ------------------
  |  Branch (4065:12): [True: 0, False: 0]
  ------------------
 4066|      0|    rc = blosc2_chunk_nans(cparams, nbytes, dest, cbytes);
 4067|      0|    if (rc < 0) {
  ------------------
  |  Branch (4067:9): [True: 0, False: 0]
  ------------------
 4068|      0|      BLOSC_TRACE_ERROR("Error creating a nan chunk");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4069|      0|    }
 4070|      0|  }
 4071|      0|  else {
 4072|       |    BLOSC_TRACE_ERROR("Special value not recognized: %" PRId64 "", special_value);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4073|      0|    rc = BLOSC2_ERROR_DATA;
 4074|      0|  }
 4075|    693|  return rc;
 4076|    693|}
frame.c:get_chunk:
 4110|  1.15k|                     size_t *capacity) {
 4111|  1.15k|  if (capacity != NULL) {
  ------------------
  |  Branch (4111:7): [True: 1.15k, False: 0]
  ------------------
 4112|  1.15k|    *capacity = 0;
 4113|  1.15k|  }
 4114|  1.15k|  int32_t header_len;
 4115|  1.15k|  int64_t frame_len;
 4116|  1.15k|  int64_t nbytes;
 4117|  1.15k|  int64_t cbytes;
 4118|  1.15k|  int32_t blocksize;
 4119|  1.15k|  int32_t chunksize;
 4120|  1.15k|  int64_t nchunks;
 4121|  1.15k|  int32_t typesize;
 4122|  1.15k|  int64_t offset;
 4123|  1.15k|  int32_t chunk_cbytes;
 4124|  1.15k|  int rc;
 4125|       |
 4126|  1.15k|  *chunk = NULL;
 4127|  1.15k|  *needs_free = false;
 4128|  1.15k|  rc = get_header_info(frame, &header_len, &frame_len, &nbytes, &cbytes,
 4129|  1.15k|                       &blocksize, &chunksize, &nchunks,
 4130|  1.15k|                       &typesize, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
 4131|  1.15k|                       frame->schunk->storage->io);
 4132|  1.15k|  if (rc < 0) {
  ------------------
  |  Branch (4132:7): [True: 0, False: 1.15k]
  ------------------
 4133|      0|    BLOSC_TRACE_ERROR("Unable to get meta info from frame.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4134|      0|    return rc;
 4135|      0|  }
 4136|  1.15k|  rc = frame_refresh_if_stale(frame, frame_len);
 4137|  1.15k|  if (rc < 0) {
  ------------------
  |  Branch (4137:7): [True: 0, False: 1.15k]
  ------------------
 4138|      0|    BLOSC_TRACE_ERROR("Unable to refresh the frame state from disk.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4139|      0|    return rc;
 4140|      0|  }
 4141|  1.15k|  if (rc > 0) {
  ------------------
  |  Branch (4141:7): [True: 0, False: 1.15k]
  ------------------
 4142|       |    // Keep the schunk-level counters in sync with the refreshed on-disk state.
 4143|       |    // Mutating ops (update/delete) read a chunk before adjusting the counters,
 4144|       |    // so this also gives them a fresh base to apply their deltas on.
 4145|      0|    frame->schunk->nbytes = nbytes;
 4146|      0|    frame->schunk->cbytes = cbytes;
 4147|      0|    frame->schunk->nchunks = nchunks;
 4148|      0|  }
 4149|       |
 4150|  1.15k|  if ((nchunks > 0) && (nchunk >= nchunks)) {
  ------------------
  |  Branch (4150:7): [True: 1.15k, False: 0]
  |  Branch (4150:24): [True: 0, False: 1.15k]
  ------------------
 4151|      0|    BLOSC_TRACE_ERROR("nchunk ('%" PRId64 "') exceeds the number of chunks "
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4152|      0|                    "('%" PRId64 "') in frame.", nchunk, nchunks);
 4153|      0|    return BLOSC2_ERROR_INVALID_PARAM;
 4154|      0|  }
 4155|       |
 4156|       |  // Get the offset to nchunk
 4157|  1.15k|  rc = get_coffset(frame, header_len, cbytes, nchunk, nchunks, &offset);
 4158|  1.15k|  if (rc < 0) {
  ------------------
  |  Branch (4158:7): [True: 0, False: 1.15k]
  ------------------
 4159|      0|    BLOSC_TRACE_ERROR("Unable to get offset to chunk %" PRId64 ".", nchunk);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4160|      0|    return rc;
 4161|      0|  }
 4162|       |
 4163|  1.15k|  if (offset < 0) {
  ------------------
  |  Branch (4163:7): [True: 0, False: 1.15k]
  ------------------
 4164|       |    // Special value
 4165|      0|    if (chunksize <= 0) {
  ------------------
  |  Branch (4165:9): [True: 0, False: 0]
  ------------------
 4166|      0|      BLOSC_TRACE_ERROR("Cannot synthesize special chunk with chunksize <= 0.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4167|      0|      return BLOSC2_ERROR_INVALID_HEADER;
 4168|      0|    }
 4169|      0|    chunk_cbytes = BLOSC_EXTENDED_HEADER_LENGTH;
 4170|      0|    int32_t chunksize_ = chunksize;
 4171|      0|    if ((nchunk == nchunks - 1) && (nbytes % chunksize)) {
  ------------------
  |  Branch (4171:9): [True: 0, False: 0]
  |  Branch (4171:36): [True: 0, False: 0]
  ------------------
 4172|       |      // Last chunk is incomplete.  Compute its actual size.
 4173|      0|      chunksize_ = (int32_t) (nbytes % chunksize);
 4174|      0|    }
 4175|      0|    rc = frame_special_chunk(offset, chunksize_, typesize, blocksize, chunk, chunk_cbytes, needs_free);
 4176|      0|    if (rc < 0) {
  ------------------
  |  Branch (4176:9): [True: 0, False: 0]
  ------------------
 4177|      0|      return rc;
 4178|      0|    }
 4179|      0|    goto end;
 4180|      0|  }
 4181|       |
 4182|  1.15k|  if (frame->sframe) {
  ------------------
  |  Branch (4182:7): [True: 0, False: 1.15k]
  ------------------
 4183|       |    // Sparse on-disk
 4184|      0|    nchunk = offset;
 4185|      0|    return sframe_get_chunk(frame, nchunk, chunk, needs_free);
 4186|      0|  }
 4187|       |
 4188|  1.15k|  blosc2_io_cb *io_cb = blosc2_get_io_cb(frame->schunk->storage->io->id);
 4189|  1.15k|  if (io_cb == NULL) {
  ------------------
  |  Branch (4189:7): [True: 0, False: 1.15k]
  ------------------
 4190|      0|    BLOSC_TRACE_ERROR("Error getting the input/output API");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4191|      0|    return BLOSC2_ERROR_PLUGIN_IO;
 4192|      0|  }
 4193|       |
 4194|  1.15k|  if (frame->cframe == NULL) {
  ------------------
  |  Branch (4194:7): [True: 0, False: 1.15k]
  ------------------
 4195|      0|    uint8_t* header_ptr;
 4196|      0|    uint8_t header[BLOSC_EXTENDED_HEADER_LENGTH];
 4197|      0|    void* fp = frame_reader_acquire(frame, frame->schunk->storage->io);
 4198|      0|    if (fp == NULL) {
  ------------------
  |  Branch (4198:9): [True: 0, False: 0]
  ------------------
 4199|      0|      BLOSC_TRACE_ERROR("Error opening file in: %s", frame->urlpath);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4200|      0|      return BLOSC2_ERROR_FILE_OPEN;
 4201|      0|    }
 4202|      0|    if (io_cb->is_allocation_necessary)
  ------------------
  |  Branch (4202:9): [True: 0, False: 0]
  ------------------
 4203|      0|      header_ptr = header;
 4204|      0|    int64_t io_pos = frame->file_offset + header_len + offset;
 4205|      0|    int64_t rbytes = io_cb->read((void**)&header_ptr, 1, sizeof(header), io_pos, fp);
 4206|      0|    if (rbytes != BLOSC_EXTENDED_HEADER_LENGTH) {
  ------------------
  |  Branch (4206:9): [True: 0, False: 0]
  ------------------
 4207|      0|      BLOSC_TRACE_ERROR("Cannot read the cbytes for chunk in the frame.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4208|      0|      frame_reader_release(frame, io_cb, fp);
 4209|      0|      return BLOSC2_ERROR_FILE_READ;
 4210|      0|    }
 4211|      0|    rc = blosc2_cbuffer_sizes(header_ptr, NULL, &chunk_cbytes, NULL);
 4212|      0|    if (rc < 0) {
  ------------------
  |  Branch (4212:9): [True: 0, False: 0]
  ------------------
 4213|      0|      BLOSC_TRACE_ERROR("Cannot read the cbytes for chunk in the frame.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4214|      0|      frame_reader_release(frame, io_cb, fp);
 4215|      0|      return rc;
 4216|      0|    }
 4217|      0|    if (chunk_cbytes < BLOSC_EXTENDED_HEADER_LENGTH ||
  ------------------
  |  Branch (4217:9): [True: 0, False: 0]
  ------------------
 4218|      0|        offset > INT64_MAX - chunk_cbytes ||
  ------------------
  |  Branch (4218:9): [True: 0, False: 0]
  ------------------
 4219|      0|        offset + chunk_cbytes > cbytes) {
  ------------------
  |  Branch (4219:9): [True: 0, False: 0]
  ------------------
 4220|      0|      BLOSC_TRACE_ERROR("Invalid chunk size in frame for chunk %" PRId64 ".", nchunk);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4221|      0|      frame_reader_release(frame, io_cb, fp);
 4222|      0|      return BLOSC2_ERROR_INVALID_HEADER;
 4223|      0|    }
 4224|      0|    if (io_cb->is_allocation_necessary) {
  ------------------
  |  Branch (4224:9): [True: 0, False: 0]
  ------------------
 4225|      0|      *chunk = capacity != NULL ? blosc2_tmp_malloc(chunk_cbytes, capacity) : malloc(chunk_cbytes);
  ------------------
  |  Branch (4225:16): [True: 0, False: 0]
  ------------------
 4226|      0|      if (*chunk == NULL) {
  ------------------
  |  Branch (4226:11): [True: 0, False: 0]
  ------------------
 4227|      0|        BLOSC_TRACE_ERROR("Cannot allocate memory for chunk.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4228|      0|        frame_reader_release(frame, io_cb, fp);
 4229|      0|        return BLOSC2_ERROR_MEMORY_ALLOC;
 4230|      0|      }
 4231|      0|      *needs_free = true;
 4232|      0|    }
 4233|      0|    else {
 4234|      0|      *needs_free = false;
 4235|      0|    }
 4236|       |
 4237|      0|    io_pos = frame->file_offset + header_len + offset;
 4238|      0|    rbytes = io_cb->read((void**)chunk, 1, chunk_cbytes, io_pos, fp);
 4239|      0|    frame_reader_release(frame, io_cb, fp);
 4240|      0|    if (rbytes != chunk_cbytes) {
  ------------------
  |  Branch (4240:9): [True: 0, False: 0]
  ------------------
 4241|      0|      BLOSC_TRACE_ERROR("Cannot read the chunk out of the frame.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4242|      0|      if (*needs_free) {
  ------------------
  |  Branch (4242:11): [True: 0, False: 0]
  ------------------
 4243|      0|        free(*chunk);
 4244|      0|        *chunk = NULL;
 4245|      0|        *needs_free = false;
 4246|      0|      }
 4247|      0|      return BLOSC2_ERROR_FILE_READ;
 4248|      0|    }
 4249|       |
 4250|  1.15k|  } else {
 4251|       |    // The chunk is in memory and just one pointer away
 4252|  1.15k|    *chunk = frame->cframe + header_len + offset;
 4253|  1.15k|    int32_t chunk_blocksize = 0;
 4254|  1.15k|    rc = blosc2_cbuffer_sizes(*chunk, NULL, &chunk_cbytes, &chunk_blocksize);
 4255|  1.15k|    if (rc < 0) {
  ------------------
  |  Branch (4255:9): [True: 0, False: 1.15k]
  ------------------
 4256|      0|      return rc;
 4257|      0|    }
 4258|  1.15k|    if (chunk_blocksize <= 0) {
  ------------------
  |  Branch (4258:9): [True: 0, False: 1.15k]
  ------------------
 4259|      0|      BLOSC_TRACE_ERROR("Invalid blocksize %d in chunk header.", chunk_blocksize);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4260|      0|      return BLOSC2_ERROR_INVALID_HEADER;
 4261|      0|    }
 4262|  1.15k|    if (chunk_cbytes < BLOSC_EXTENDED_HEADER_LENGTH ||
  ------------------
  |  Branch (4262:9): [True: 0, False: 1.15k]
  ------------------
 4263|  1.15k|        offset > INT64_MAX - chunk_cbytes ||
  ------------------
  |  Branch (4263:9): [True: 0, False: 1.15k]
  ------------------
 4264|  1.15k|        offset + chunk_cbytes > cbytes) {
  ------------------
  |  Branch (4264:9): [True: 0, False: 1.15k]
  ------------------
 4265|      0|      BLOSC_TRACE_ERROR("Invalid chunk size in frame for chunk %" PRId64 ".", nchunk);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4266|      0|      return BLOSC2_ERROR_INVALID_HEADER;
 4267|      0|    }
 4268|  1.15k|  }
 4269|       |
 4270|  1.15k|  end:
 4271|  1.15k|  return (int32_t)chunk_cbytes;
 4272|  1.15k|}
frame.c:get_frame_fields:
 4689|  1.20k|static int get_frame_fields(blosc2_frame_s* frame, frame_fields* f) {
 4690|  1.20k|  int64_t frame_len;
 4691|  1.20k|  int rc = get_header_info(frame, &f->header_len, &frame_len, &f->nbytes, &f->cbytes, &f->blocksize,
 4692|  1.20k|                           &f->chunksize, &f->nchunks, &f->typesize, NULL, NULL, NULL, NULL, NULL, NULL,
 4693|  1.20k|                           NULL, frame->schunk->storage->io);
 4694|  1.20k|  if (rc < 0) {
  ------------------
  |  Branch (4694:7): [True: 0, False: 1.20k]
  ------------------
 4695|      0|    BLOSC_TRACE_ERROR("Unable to get meta info from frame.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4696|      0|    return rc;
 4697|      0|  }
 4698|  1.20k|  rc = frame_refresh_if_stale(frame, frame_len);
 4699|  1.20k|  if (rc < 0) {
  ------------------
  |  Branch (4699:7): [True: 0, False: 1.20k]
  ------------------
 4700|      0|    BLOSC_TRACE_ERROR("Unable to refresh the frame state from disk.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4701|      0|    return rc;
 4702|      0|  }
 4703|  1.20k|  if (rc > 0) {
  ------------------
  |  Branch (4703:7): [True: 0, False: 1.20k]
  ------------------
 4704|      0|    frame->schunk->nbytes = f->nbytes;
 4705|      0|    frame->schunk->cbytes = f->cbytes;
 4706|      0|    frame->schunk->nchunks = f->nchunks;
 4707|      0|  }
 4708|  1.20k|  return BLOSC2_ERROR_SUCCESS;
 4709|  1.20k|}
frame.c:read_frame_chunk_header:
 4718|  1.20k|                                   uint8_t* header, int64_t* offset) {
 4719|  1.20k|  if (nchunk < 0 || nchunk >= f->nchunks) {
  ------------------
  |  Branch (4719:7): [True: 0, False: 1.20k]
  |  Branch (4719:21): [True: 0, False: 1.20k]
  ------------------
 4720|      0|    BLOSC_TRACE_ERROR("nchunk ('%" PRId64 "') exceeds the number of chunks "
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4721|      0|                      "('%" PRId64 "') in frame.", nchunk, f->nchunks);
 4722|      0|    return BLOSC2_ERROR_INVALID_PARAM;
 4723|      0|  }
 4724|  1.20k|  int rc = get_coffset(frame, f->header_len, f->cbytes, nchunk, f->nchunks, offset);
 4725|  1.20k|  if (rc < 0) {
  ------------------
  |  Branch (4725:7): [True: 0, False: 1.20k]
  ------------------
 4726|      0|    BLOSC_TRACE_ERROR("Unable to get offset to chunk %" PRId64 ".", nchunk);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4727|      0|    return rc;
 4728|      0|  }
 4729|  1.20k|  if (*offset < 0) {
  ------------------
  |  Branch (4729:7): [True: 691, False: 511]
  ------------------
 4730|    691|    if (f->chunksize <= 0) {
  ------------------
  |  Branch (4730:9): [True: 0, False: 691]
  ------------------
 4731|      0|      BLOSC_TRACE_ERROR("Cannot synthesize special chunk with chunksize <= 0.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4732|      0|      return BLOSC2_ERROR_INVALID_HEADER;
 4733|      0|    }
 4734|    691|    int32_t chunksize = f->chunksize;
 4735|    691|    if ((nchunk == f->nchunks - 1) && (f->nbytes % f->chunksize)) {
  ------------------
  |  Branch (4735:9): [True: 73, False: 618]
  |  Branch (4735:39): [True: 0, False: 73]
  ------------------
 4736|       |      // Last chunk is incomplete.  Compute its actual size.
 4737|      0|      chunksize = (int32_t) (f->nbytes % f->chunksize);
 4738|      0|    }
 4739|    691|    return special_chunk_into(*offset, chunksize, f->typesize, f->blocksize, header,
 4740|    691|                              BLOSC_EXTENDED_HEADER_LENGTH);
 4741|    691|  }
 4742|       |
 4743|    511|  if (frame->cframe != NULL) {
  ------------------
  |  Branch (4743:7): [True: 511, False: 0]
  ------------------
 4744|       |    // get_coffset() checked that the header is inside the frame
 4745|    511|    memcpy(header, frame->cframe + f->header_len + *offset, BLOSC_EXTENDED_HEADER_LENGTH);
 4746|    511|  }
 4747|      0|  else {
 4748|      0|    blosc2_io_cb* io_cb = blosc2_get_io_cb(frame->schunk->storage->io->id);
 4749|      0|    if (io_cb == NULL) {
  ------------------
  |  Branch (4749:9): [True: 0, False: 0]
  ------------------
 4750|      0|      BLOSC_TRACE_ERROR("Error getting the input/output API");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4751|      0|      return BLOSC2_ERROR_PLUGIN_IO;
 4752|      0|    }
 4753|      0|    void* chunk_fp = fp;
 4754|      0|    int64_t io_pos = frame->file_offset + f->header_len + *offset;
 4755|      0|    if (frame->sframe) {
  ------------------
  |  Branch (4755:9): [True: 0, False: 0]
  ------------------
 4756|      0|      chunk_fp = sframe_open_chunk(frame->urlpath, *offset, "rb", frame->schunk->storage->io);
 4757|      0|      io_pos = 0;
 4758|      0|    }
 4759|      0|    else if (fp == NULL) {
  ------------------
  |  Branch (4759:14): [True: 0, False: 0]
  ------------------
 4760|      0|      chunk_fp = frame_reader_acquire(frame, frame->schunk->storage->io);
 4761|      0|    }
 4762|      0|    if (chunk_fp == NULL) {
  ------------------
  |  Branch (4762:9): [True: 0, False: 0]
  ------------------
 4763|      0|      BLOSC_TRACE_ERROR("Error opening file in: %s", frame->urlpath);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4764|      0|      return BLOSC2_ERROR_FILE_OPEN;
 4765|      0|    }
 4766|      0|    uint8_t* header_ptr = header;
 4767|      0|    int64_t rbytes = io_cb->read((void**)&header_ptr, 1, BLOSC_EXTENDED_HEADER_LENGTH, io_pos, chunk_fp);
 4768|      0|    if (rbytes == BLOSC_EXTENDED_HEADER_LENGTH && header_ptr != header) {
  ------------------
  |  Branch (4768:9): [True: 0, False: 0]
  |  Branch (4768:51): [True: 0, False: 0]
  ------------------
 4769|      0|      memcpy(header, header_ptr, BLOSC_EXTENDED_HEADER_LENGTH);
 4770|      0|    }
 4771|      0|    if (frame->sframe) {
  ------------------
  |  Branch (4771:9): [True: 0, False: 0]
  ------------------
 4772|      0|      io_cb->close(chunk_fp);
 4773|      0|    }
 4774|      0|    else if (fp == NULL) {
  ------------------
  |  Branch (4774:14): [True: 0, False: 0]
  ------------------
 4775|      0|      frame_reader_release(frame, io_cb, chunk_fp);
 4776|      0|    }
 4777|      0|    if (rbytes != BLOSC_EXTENDED_HEADER_LENGTH) {
  ------------------
  |  Branch (4777:9): [True: 0, False: 0]
  ------------------
 4778|      0|      BLOSC_TRACE_ERROR("Cannot read the header for chunk in the frame.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4779|      0|      return BLOSC2_ERROR_FILE_READ;
 4780|      0|    }
 4781|      0|  }
 4782|    511|  int32_t chunk_cbytes;
 4783|    511|  rc = blosc2_cbuffer_sizes(header, NULL, &chunk_cbytes, NULL);
 4784|    511|  if (rc < 0) {
  ------------------
  |  Branch (4784:7): [True: 0, False: 511]
  ------------------
 4785|      0|    return rc;
 4786|      0|  }
 4787|    511|  int64_t chunk_end;
 4788|    511|  if (chunk_cbytes < BLOSC_EXTENDED_HEADER_LENGTH ||
  ------------------
  |  Branch (4788:7): [True: 0, False: 511]
  ------------------
 4789|    511|      (!frame->sframe && (!blosc2_checked_add_i64_nonneg(*offset, chunk_cbytes, &chunk_end) ||
  ------------------
  |  Branch (4789:8): [True: 511, False: 0]
  |  Branch (4789:27): [True: 0, False: 511]
  ------------------
 4790|    511|                          chunk_end > f->cbytes))) {
  ------------------
  |  Branch (4790:27): [True: 0, False: 511]
  ------------------
 4791|      0|    BLOSC_TRACE_ERROR("Invalid chunk size in frame for chunk %" PRId64 ".", nchunk);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4792|      0|    return BLOSC2_ERROR_INVALID_HEADER;
 4793|      0|  }
 4794|    511|  return chunk_cbytes;
 4795|    511|}
frame.c:compress_offsets:
 5006|    610|                                uint8_t** off_chunk) {
 5007|    610|  *off_chunk = NULL;
 5008|    610|  blosc2_cparams cparams = BLOSC2_CPARAMS_DEFAULTS;
 5009|    610|  cparams.splitmode = BLOSC_NEVER_SPLIT;
 5010|    610|  cparams.typesize = sizeof(int64_t);
 5011|    610|  cparams.blocksize = 16 * 1024;  // based on experiments with create_frame.c bench
 5012|    610|  cparams.nthreads = 4;  // 4 threads seems a decent default for nowadays CPUs
 5013|    610|  cparams.compcode = BLOSC_BLOSCLZ;
 5014|    610|  blosc2_context* cctx = blosc2_create_cctx(cparams);
 5015|    610|  if (cctx == NULL) {
  ------------------
  |  Branch (5015:7): [True: 0, False: 610]
  ------------------
 5016|      0|    BLOSC_TRACE_ERROR("Error while creating the compression context");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 5017|      0|    return BLOSC2_ERROR_NULL_POINTER;
 5018|      0|  }
 5019|    610|  cctx->typesize = sizeof(int64_t);  // override a possible BLOSC_TYPESIZE env variable (or chaos may appear)
 5020|    610|  uint8_t* chunk = malloc((size_t)dest_nbytes);
 5021|    610|  if (chunk == NULL) {
  ------------------
  |  Branch (5021:7): [True: 0, False: 610]
  ------------------
 5022|      0|    blosc2_free_ctx(cctx);
 5023|      0|    BLOSC_TRACE_ERROR("Cannot allocate memory for the offsets chunk.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 5024|      0|    return BLOSC2_ERROR_MEMORY_ALLOC;
 5025|      0|  }
 5026|    610|  int32_t off_cbytes = blosc2_compress_ctx(cctx, offsets, off_nbytes, chunk, dest_nbytes);
 5027|    610|  blosc2_free_ctx(cctx);
 5028|    610|  if (off_cbytes < 0) {
  ------------------
  |  Branch (5028:7): [True: 0, False: 610]
  ------------------
 5029|      0|    free(chunk);
 5030|      0|    return off_cbytes;
 5031|      0|  }
 5032|    610|  *off_chunk = chunk;
 5033|    610|  return off_cbytes;
 5034|    610|}
frame.c:special_offset:
 5038|     32|static void special_offset(int64_t* offset, int special_value) {
 5039|     32|  uint64_t offset_value = ((uint64_t)1 << 63) + ((uint64_t)special_value << (8 * 7));
 5040|       |  to_little(offset, &offset_value, sizeof(uint64_t));
  ------------------
  |  |   35|     32|#define to_little(dest, src, itemsize)    endian_handler(true, dest, src, itemsize)
  ------------------
 5041|     32|}
frame.c:holes_place:
 6194|    578|                           int64_t* payload_end) {
 6195|    578|  int64_t start = *payload_end;
 6196|    578|  int64_t len = 0;
 6197|    578|  if (old_offset >= 0) {
  ------------------
  |  Branch (6197:7): [True: 0, False: 578]
  ------------------
 6198|      0|    holes_take_run(frame, old_offset, old_len, &start, &len);
 6199|      0|  }
 6200|    578|  if (start + len == *payload_end) {
  ------------------
  |  Branch (6200:7): [True: 578, False: 0]
  ------------------
 6201|    578|    *payload_end = start + new_len;
 6202|    578|    return start;
 6203|    578|  }
 6204|      0|  if (new_len <= len) {
  ------------------
  |  Branch (6204:7): [True: 0, False: 0]
  ------------------
 6205|      0|    holes_add(frame, start + new_len, len - new_len);
 6206|      0|    return start;
 6207|      0|  }
 6208|      0|  holes_add(frame, start, len);
 6209|      0|  int64_t offset = *payload_end;
 6210|      0|  *payload_end += new_len;
 6211|      0|  return offset;
 6212|      0|}

prefetch_set_populate:
   85|  1.96k|void prefetch_set_populate(int mode) {
   86|  1.96k|  g_populate = mode < 0 ? -1 : (mode > 0);
  ------------------
  |  Branch (86:16): [True: 1.96k, False: 0]
  ------------------
   87|  1.96k|}
prefetch_applies:
  133|    138|bool prefetch_applies(const blosc2_frame_s *frame) {
  134|    138|  return prefetch_enabled() && frame != NULL && frame->cframe == NULL && !frame->sframe && frame->urlpath != NULL &&
  ------------------
  |  Branch (134:10): [True: 0, False: 138]
  |  Branch (134:32): [True: 0, False: 0]
  |  Branch (134:49): [True: 0, False: 0]
  |  Branch (134:74): [True: 0, False: 0]
  |  Branch (134:92): [True: 0, False: 0]
  ------------------
  135|      0|         frame->schunk != NULL;
  ------------------
  |  Branch (135:10): [True: 0, False: 0]
  ------------------
  136|    138|}
prefetch_destroy:
  356|  1.96k|void prefetch_destroy(void) {
  357|  1.96k|  pthread_mutex_lock(&destroy_mutex);
  358|  1.96k|  pthread_mutex_lock(&pool.mutex);
  359|  1.96k|  if (pool.threads == NULL) {
  ------------------
  |  Branch (359:7): [True: 1.96k, False: 0]
  ------------------
  360|  1.96k|    pthread_mutex_unlock(&pool.mutex);
  361|  1.96k|    pthread_mutex_unlock(&destroy_mutex);
  362|  1.96k|    return;
  363|  1.96k|  }
  364|      0|  pool.stop = true;
  365|      0|  pthread_cond_broadcast(&pool.work);
  366|      0|  int nthreads = pool.nthreads;
  367|      0|  pthread_t *threads = pool.threads;
  368|      0|  pool.threads = NULL;
  369|      0|  pool.nthreads = 0;
  370|      0|  pthread_mutex_unlock(&pool.mutex);
  371|       |
  372|      0|  for (int i = 0; i < nthreads; ++i) {
  ------------------
  |  Branch (372:19): [True: 0, False: 0]
  ------------------
  373|      0|    pthread_join(threads[i], NULL);
  374|      0|  }
  375|      0|  free(threads);
  376|       |
  377|      0|  pthread_mutex_lock(&pool.mutex);
  378|       |  pool.stop = false;
  379|      0|  pthread_mutex_unlock(&pool.mutex);
  380|      0|  pthread_mutex_unlock(&destroy_mutex);
  381|      0|}
prefetch_batch_wait:
  926|  1.76k|void prefetch_batch_wait(prefetch_batch *batch, int64_t nchunk) {
  927|  1.76k|  if (batch == NULL) {
  ------------------
  |  Branch (927:7): [True: 1.76k, False: 0]
  ------------------
  928|  1.76k|    return;
  929|  1.76k|  }
  930|      0|  pthread_mutex_lock(&pool.mutex);
  931|       |  // The slice reads the chunks in the order given, so this is mostly the next one
  932|      0|  for (int64_t k = 0; k < batch->nchunks; ++k) {
  ------------------
  |  Branch (932:23): [True: 0, False: 0]
  ------------------
  933|      0|    int64_t i = (batch->cursor + k) % batch->nchunks;
  934|      0|    if (batch->chunks[i] == nchunk) {
  ------------------
  |  Branch (934:9): [True: 0, False: 0]
  ------------------
  935|      0|      batch->cursor = i + 1;
  936|      0|      raise_limit(batch, batch->end_piece[i], batch->end_piece[i]);
  937|      0|      wait_pieces(batch, batch->end_piece[i]);
  938|      0|      break;
  939|      0|    }
  940|      0|  }
  941|      0|  pthread_mutex_unlock(&pool.mutex);
  942|      0|}
prefetch_batch_free:
  945|    208|void prefetch_batch_free(prefetch_batch *batch) {
  946|    208|  if (batch == NULL) {
  ------------------
  |  Branch (946:7): [True: 208, False: 0]
  ------------------
  947|    208|    return;
  948|    208|  }
  949|      0|  pthread_mutex_lock(&pool.mutex);
  950|      0|  batch->limit = batch->next;
  951|      0|  wait_pieces(batch, batch->next);
  952|      0|  prefetch_batch **link = &pool.batches;
  953|      0|  while (*link != batch) {
  ------------------
  |  Branch (953:10): [True: 0, False: 0]
  ------------------
  954|      0|    link = &(*link)->next_batch;
  955|      0|  }
  956|      0|  *link = batch->next_batch;
  957|      0|  pool.nbatches--;
  958|      0|  pthread_mutex_unlock(&pool.mutex);
  959|      0|  pthread_cond_destroy(&batch->progress);
  960|      0|  close(batch->fd);
  961|      0|  free(batch);
  962|      0|}
prefetch.c:prefetch_enabled:
  128|    138|static bool prefetch_enabled(void) {
  129|    138|  return g_nthreads > 0 && blosc2_is_initialized();
  ------------------
  |  Branch (129:10): [True: 0, False: 138]
  |  Branch (129:28): [True: 0, False: 0]
  ------------------
  130|    138|}

blosc2_schunk_get_cparams:
   73|  1.99k|int blosc2_schunk_get_cparams(blosc2_schunk *schunk, blosc2_cparams **cparams) {
   74|  1.99k|  *cparams = calloc(1, sizeof(blosc2_cparams));
   75|  1.99k|  (*cparams)->schunk = schunk;
   76|  13.9k|  for (int i = 0; i < BLOSC2_MAX_FILTERS; i++) {
  ------------------
  |  Branch (76:19): [True: 11.9k, False: 1.99k]
  ------------------
   77|  11.9k|    (*cparams)->filters[i] = schunk->filters[i];
   78|  11.9k|    (*cparams)->filters_meta[i] = schunk->filters_meta[i];
   79|  11.9k|  }
   80|  1.99k|  (*cparams)->compcode = schunk->compcode;
   81|  1.99k|  (*cparams)->compcode_meta = schunk->compcode_meta;
   82|  1.99k|  (*cparams)->clevel = schunk->clevel;
   83|  1.99k|  (*cparams)->typesize = schunk->typesize;
   84|  1.99k|  (*cparams)->blocksize = schunk->blocksize;
   85|  1.99k|  (*cparams)->splitmode = schunk->splitmode;
   86|  1.99k|  (*cparams)->use_dict = schunk->use_dict;
   87|  1.99k|  if (schunk->cctx == NULL) {
  ------------------
  |  Branch (87:7): [True: 1.85k, False: 139]
  ------------------
   88|  1.85k|    (*cparams)->nthreads = blosc2_get_nthreads();
   89|  1.85k|  }
   90|    139|  else {
   91|    139|    (*cparams)->nthreads = (int16_t)schunk->cctx->nthreads;
   92|    139|  }
   93|  1.99k|  return 0;
   94|  1.99k|}
blosc2_schunk_get_dparams:
   98|  1.85k|int blosc2_schunk_get_dparams(blosc2_schunk *schunk, blosc2_dparams **dparams) {
   99|  1.85k|  *dparams = calloc(1, sizeof(blosc2_dparams));
  100|  1.85k|  (*dparams)->schunk = schunk;
  101|  1.85k|  if (schunk->dctx == NULL) {
  ------------------
  |  Branch (101:7): [True: 1.85k, False: 0]
  ------------------
  102|  1.85k|    (*dparams)->nthreads = blosc2_get_nthreads();
  103|  1.85k|  }
  104|      0|  else {
  105|      0|    (*dparams)->nthreads = schunk->dctx->nthreads;
  106|      0|  }
  107|  1.85k|  return 0;
  108|  1.85k|}
update_schunk_properties:
  111|     70|int update_schunk_properties(struct blosc2_schunk* schunk) {
  112|     70|  blosc2_cparams* cparams = schunk->storage->cparams;
  113|     70|  blosc2_dparams* dparams = schunk->storage->dparams;
  114|       |
  115|    490|  for (int i = 0; i < BLOSC2_MAX_FILTERS; i++) {
  ------------------
  |  Branch (115:19): [True: 420, False: 70]
  ------------------
  116|    420|    schunk->filters[i] = cparams->filters[i];
  117|    420|    schunk->filters_meta[i] = cparams->filters_meta[i];
  118|    420|  }
  119|     70|  schunk->compcode = cparams->compcode;
  120|     70|  schunk->compcode_meta = cparams->compcode_meta;
  121|     70|  schunk->clevel = cparams->clevel;
  122|     70|  schunk->splitmode = cparams->splitmode;
  123|     70|  schunk->use_dict = (uint8_t)cparams->use_dict;
  124|     70|  schunk->typesize = cparams->typesize;
  125|     70|  schunk->blocksize = cparams->blocksize;
  126|     70|  schunk->chunksize = -1;
  127|     70|  schunk->flags2 = 0;
  128|     70|  schunk->tuner_params = cparams->tuner_params;
  129|     70|  schunk->tuner_id = cparams->tuner_id;
  130|     70|  if (cparams->tuner_id == BLOSC_BTUNE) {
  ------------------
  |  Branch (130:7): [True: 0, False: 70]
  ------------------
  131|      0|    cparams->use_dict = 0;
  132|      0|  }
  133|       |  /* The compression context */
  134|     70|  if (schunk->cctx != NULL) {
  ------------------
  |  Branch (134:7): [True: 0, False: 70]
  ------------------
  135|      0|    blosc2_free_ctx(schunk->cctx);
  136|      0|  }
  137|     70|  cparams->schunk = schunk;
  138|     70|  schunk->cctx = blosc2_create_cctx(*cparams);
  139|     70|  if (schunk->cctx == NULL) {
  ------------------
  |  Branch (139:7): [True: 0, False: 70]
  ------------------
  140|      0|    BLOSC_TRACE_ERROR("Could not create compression ctx");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  141|      0|    return BLOSC2_ERROR_NULL_POINTER;
  142|      0|  }
  143|       |
  144|       |  /* The decompression context */
  145|     70|  if (schunk->dctx != NULL) {
  ------------------
  |  Branch (145:7): [True: 0, False: 70]
  ------------------
  146|      0|    blosc2_free_ctx(schunk->dctx);
  147|      0|  }
  148|     70|  dparams->schunk = schunk;
  149|     70|  schunk->dctx = blosc2_create_dctx(*dparams);
  150|     70|  if (schunk->dctx == NULL) {
  ------------------
  |  Branch (150:7): [True: 0, False: 70]
  ------------------
  151|      0|    BLOSC_TRACE_ERROR("Could not create decompression ctx");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  152|      0|    return BLOSC2_ERROR_NULL_POINTER;
  153|      0|  }
  154|       |
  155|     70|  return BLOSC2_ERROR_SUCCESS;
  156|     70|}
blosc2_schunk_new:
  166|     70|blosc2_schunk* blosc2_schunk_new(blosc2_storage *storage) {
  167|     70|  blosc2_schunk* schunk = calloc(1, sizeof(blosc2_schunk));
  168|     70|  schunk->version = 0;     /* pre-first version */
  169|     70|  schunk->view = false;  /* not a view by default */
  170|       |
  171|       |  // Get the storage with proper defaults
  172|     70|  schunk->storage = get_new_storage(storage, &BLOSC2_CPARAMS_DEFAULTS, &BLOSC2_DPARAMS_DEFAULTS, &BLOSC2_IO_DEFAULTS);
  173|       |  // Update the (local variable) storage
  174|     70|  storage = schunk->storage;
  175|       |
  176|     70|  char* tradeoff = getenv("BTUNE_TRADEOFF");
  177|     70|  if (tradeoff != NULL) {
  ------------------
  |  Branch (177:7): [True: 0, False: 70]
  ------------------
  178|       |    // If BTUNE_TRADEOFF passed, automatically use btune
  179|      0|    storage->cparams->tuner_id = BLOSC_BTUNE;
  180|      0|  }
  181|       |
  182|       |  // ...and update internal properties
  183|     70|  if (update_schunk_properties(schunk) < 0) {
  ------------------
  |  Branch (183:7): [True: 0, False: 70]
  ------------------
  184|      0|    BLOSC_TRACE_ERROR("Error when updating schunk properties");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  185|      0|    blosc2_schunk_free(schunk);
  186|      0|    return NULL;
  187|      0|  }
  188|       |
  189|     70|  if (!storage->contiguous && storage->urlpath != NULL){
  ------------------
  |  Branch (189:7): [True: 0, False: 70]
  |  Branch (189:31): [True: 0, False: 0]
  ------------------
  190|      0|    char* urlpath;
  191|      0|    char last_char = storage->urlpath[strlen(storage->urlpath) - 1];
  192|      0|    urlpath = malloc(strlen(storage->urlpath) + 1);
  193|      0|    strcpy(urlpath, storage->urlpath);
  194|      0|    if (last_char == '\\' || last_char == '/') {
  ------------------
  |  Branch (194:9): [True: 0, False: 0]
  |  Branch (194:30): [True: 0, False: 0]
  ------------------
  195|      0|      urlpath[strlen(storage->urlpath) - 1] = '\0';
  196|      0|    }
  197|       |    // Create directory
  198|      0|    if (mkdir(urlpath, 0777) == -1) {
  ------------------
  |  Branch (198:9): [True: 0, False: 0]
  ------------------
  199|      0|      BLOSC_TRACE_ERROR("Error during the creation of the directory, maybe it already exists.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  200|      0|      free(urlpath);
  201|      0|      blosc2_schunk_free(schunk);
  202|      0|      return NULL;
  203|      0|    }
  204|       |    // We want a sparse (directory) frame as storage
  205|      0|    blosc2_frame_s* frame = frame_new(urlpath);
  206|      0|    free(urlpath);
  207|      0|    if (frame == NULL) {
  ------------------
  |  Branch (207:9): [True: 0, False: 0]
  ------------------
  208|      0|      BLOSC_TRACE_ERROR("Error creating sparse frame.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  209|      0|      blosc2_schunk_free(schunk);
  210|      0|      return NULL;
  211|      0|    }
  212|      0|    frame->sframe = true;
  213|      0|    frame_set_locking(frame, schunk->storage->io);
  214|       |    // Initialize frame (basically, encode the header)
  215|      0|    frame->schunk = schunk;
  216|      0|    int64_t frame_len = frame_from_schunk(schunk, frame);
  217|      0|    if (frame_len < 0) {
  ------------------
  |  Branch (217:9): [True: 0, False: 0]
  ------------------
  218|      0|      BLOSC_TRACE_ERROR("Error during the conversion of schunk to frame.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  219|      0|      frame_free(frame);
  220|      0|      blosc2_schunk_free(schunk);
  221|      0|      return NULL;
  222|      0|    }
  223|      0|    schunk->frame = (blosc2_frame*)frame;
  224|      0|  }
  225|     70|  if (storage->contiguous){
  ------------------
  |  Branch (225:7): [True: 70, False: 0]
  ------------------
  226|       |    // We want a contiguous frame as storage
  227|     70|    if (storage->urlpath != NULL) {
  ------------------
  |  Branch (227:9): [True: 0, False: 70]
  ------------------
  228|      0|      if (file_exists(storage->urlpath)) {
  ------------------
  |  Branch (228:11): [True: 0, False: 0]
  ------------------
  229|      0|        BLOSC_TRACE_ERROR("You are trying to overwrite an existing frame.  Remove it first!");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  230|      0|        blosc2_schunk_free(schunk);
  231|      0|        return NULL;
  232|      0|      }
  233|      0|    }
  234|     70|    blosc2_frame_s* frame = frame_new(storage->urlpath);
  235|     70|    if (frame == NULL) {
  ------------------
  |  Branch (235:9): [True: 0, False: 70]
  ------------------
  236|      0|      BLOSC_TRACE_ERROR("Error creating contiguous frame.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  237|      0|      blosc2_schunk_free(schunk);
  238|      0|      return NULL;
  239|      0|    }
  240|     70|    frame->sframe = false;
  241|     70|    frame_set_locking(frame, schunk->storage->io);
  242|       |    // Initialize frame (basically, encode the header)
  243|     70|    frame->schunk = schunk;
  244|     70|    int64_t frame_len = frame_from_schunk(schunk, frame);
  245|     70|    if (frame_len < 0) {
  ------------------
  |  Branch (245:9): [True: 0, False: 70]
  ------------------
  246|      0|      BLOSC_TRACE_ERROR("Error during the conversion of schunk to frame.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  247|      0|      frame_free(frame);
  248|      0|      blosc2_schunk_free(schunk);
  249|      0|      return NULL;
  250|      0|    }
  251|     70|    schunk->frame = (blosc2_frame*)frame;
  252|     70|  }
  253|       |
  254|     70|  return schunk;
  255|     70|}
blosc2_schunk_to_buffer:
  567|     69|int64_t blosc2_schunk_to_buffer(blosc2_schunk* schunk, uint8_t** dest, bool* needs_free) {
  568|     69|  blosc2_frame_s* frame;
  569|     69|  int64_t cframe_len;
  570|       |
  571|       |  // Initialize defaults in case of errors
  572|     69|  *dest = NULL;
  573|     69|  *needs_free = false;
  574|       |
  575|     69|  if ((schunk->storage->contiguous == true) && (schunk->storage->urlpath == NULL)) {
  ------------------
  |  Branch (575:7): [True: 69, False: 0]
  |  Branch (575:48): [True: 69, False: 0]
  ------------------
  576|     69|    frame =  (blosc2_frame_s*)(schunk->frame);
  577|     69|    *dest = frame->cframe;
  578|     69|    cframe_len = frame->len;
  579|     69|    *needs_free = false;
  580|     69|  }
  581|      0|  else {
  582|       |    // Copy to a contiguous storage
  583|      0|    blosc2_storage frame_storage = {.contiguous=true};
  584|      0|    blosc2_schunk* schunk_copy = schunk_copy_as_stored(schunk, &frame_storage);
  585|      0|    if (schunk_copy == NULL) {
  ------------------
  |  Branch (585:9): [True: 0, False: 0]
  ------------------
  586|      0|      BLOSC_TRACE_ERROR("Error during the conversion of schunk to buffer.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  587|      0|      return BLOSC2_ERROR_SCHUNK_COPY;
  588|      0|    }
  589|      0|    frame = (blosc2_frame_s*)(schunk_copy->frame);
  590|      0|    *dest = frame->cframe;
  591|      0|    cframe_len = frame->len;
  592|      0|    *needs_free = true;
  593|      0|    frame->avoid_cframe_free = true;
  594|      0|    blosc2_schunk_free(schunk_copy);
  595|      0|  }
  596|       |
  597|     69|  return cframe_len;
  598|       |
  599|     69|}
schunk_free_metalayers:
  790|  2.02k|void schunk_free_metalayers(blosc2_schunk *schunk) {
  791|  2.35k|  for (int i = 0; i < schunk->nmetalayers; i++) {
  ------------------
  |  Branch (791:19): [True: 327, False: 2.02k]
  ------------------
  792|    327|    if (schunk->metalayers[i] != NULL) {
  ------------------
  |  Branch (792:9): [True: 192, False: 135]
  ------------------
  793|    192|      free(schunk->metalayers[i]->name);
  794|    192|      free(schunk->metalayers[i]->content);
  795|    192|      free(schunk->metalayers[i]);
  796|       |      schunk->metalayers[i] = NULL;
  797|    192|    }
  798|    327|  }
  799|  2.02k|  schunk->nmetalayers = 0;
  800|  2.02k|}
schunk_free_vlmetalayers:
  803|  2.02k|void schunk_free_vlmetalayers(blosc2_schunk *schunk) {
  804|  2.02k|  for (int i = 0; i < schunk->nvlmetalayers; i++) {
  ------------------
  |  Branch (804:19): [True: 0, False: 2.02k]
  ------------------
  805|      0|    if (schunk->vlmetalayers[i] != NULL) {
  ------------------
  |  Branch (805:9): [True: 0, False: 0]
  ------------------
  806|      0|      free(schunk->vlmetalayers[i]->name);
  807|      0|      free(schunk->vlmetalayers[i]->content);
  808|      0|      free(schunk->vlmetalayers[i]);
  809|       |      schunk->vlmetalayers[i] = NULL;
  810|      0|    }
  811|      0|  }
  812|  2.02k|  schunk->nvlmetalayers = 0;
  813|  2.02k|}
blosc2_schunk_free:
  816|  2.02k|int blosc2_schunk_free(blosc2_schunk *schunk) {
  817|  2.02k|  int err = 0;
  818|       |
  819|       |  // If it is a view, the data belongs to original array and should not be freed
  820|  2.02k|  if (schunk->data != NULL && !schunk->view) {
  ------------------
  |  Branch (820:7): [True: 0, False: 2.02k]
  |  Branch (820:31): [True: 0, False: 0]
  ------------------
  821|      0|    for (int i = 0; i < schunk->nchunks; i++) {
  ------------------
  |  Branch (821:21): [True: 0, False: 0]
  ------------------
  822|      0|      free(schunk->data[i]);
  823|      0|    }
  824|      0|    free(schunk->data);
  825|      0|  }
  826|  2.02k|  if (schunk->cctx != NULL)
  ------------------
  |  Branch (826:7): [True: 1.92k, False: 100]
  ------------------
  827|  1.92k|    blosc2_free_ctx(schunk->cctx);
  828|  2.02k|  if (schunk->dctx != NULL)
  ------------------
  |  Branch (828:7): [True: 1.92k, False: 100]
  ------------------
  829|  1.92k|    blosc2_free_ctx(schunk->dctx);
  830|  2.02k|  if (schunk->blockshape != NULL)
  ------------------
  |  Branch (830:7): [True: 0, False: 2.02k]
  ------------------
  831|      0|    free(schunk->blockshape);
  832|       |
  833|  2.02k|  schunk_free_metalayers(schunk);
  834|       |
  835|  2.02k|  if (schunk->storage != NULL) {
  ------------------
  |  Branch (835:7): [True: 1.92k, False: 100]
  ------------------
  836|  1.92k|    blosc2_io_cb *io_cb = blosc2_get_io_cb(schunk->storage->io->id);
  837|  1.92k|    if (io_cb != NULL) {
  ------------------
  |  Branch (837:9): [True: 1.92k, False: 0]
  ------------------
  838|  1.92k|      int rc = io_cb->destroy(schunk->storage->io->params);
  839|  1.92k|      if (rc < 0) {
  ------------------
  |  Branch (839:11): [True: 0, False: 1.92k]
  ------------------
  840|      0|        BLOSC_TRACE_ERROR("Could not free the I/O resources.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  841|      0|        err = 1;
  842|      0|      }
  843|  1.92k|    }
  844|       |
  845|  1.92k|    if (schunk->storage->urlpath != NULL) {
  ------------------
  |  Branch (845:9): [True: 0, False: 1.92k]
  ------------------
  846|      0|      free(schunk->storage->urlpath);
  847|      0|    }
  848|  1.92k|    free(schunk->storage->cparams);
  849|  1.92k|    free(schunk->storage->dparams);
  850|  1.92k|    free(schunk->storage->io);
  851|  1.92k|    free(schunk->storage);
  852|  1.92k|  }
  853|       |
  854|       |  // If it is a view, the frame belongs to original array and should not be freed
  855|  2.02k|  if (schunk->frame != NULL && !schunk->view) {
  ------------------
  |  Branch (855:7): [True: 2.02k, False: 0]
  |  Branch (855:32): [True: 2.02k, False: 0]
  ------------------
  856|  2.02k|    int rc = frame_free((blosc2_frame_s *) schunk->frame);
  857|  2.02k|    if (rc < 0 && err == 0) {
  ------------------
  |  Branch (857:9): [True: 0, False: 2.02k]
  |  Branch (857:19): [True: 0, False: 0]
  ------------------
  858|      0|      err = rc;
  859|      0|    }
  860|  2.02k|  }
  861|       |
  862|  2.02k|  schunk_free_vlmetalayers(schunk);
  863|       |
  864|  2.02k|  free(schunk);
  865|       |
  866|  2.02k|  return err;
  867|  2.02k|}
blosc2_schunk_from_buffer:
  880|  1.96k|blosc2_schunk* blosc2_schunk_from_buffer(uint8_t *cframe, int64_t len, bool copy) {
  881|       |  // Check that the buffer actually comes from a cframe
  882|  1.96k|  if (cframe == NULL || len < FRAME_HEADER_MINLEN) {
  ------------------
  |  |   49|  1.96k|#define FRAME_HEADER_MINLEN (FRAME_FILTER_PIPELINE + 1 + 16)  // 87 <- minimum length
  |  |  ------------------
  |  |  |  |   44|  1.96k|#define FRAME_FILTER_PIPELINE (FRAME_HAS_VLMETALAYERS + 1 + 1) // 70
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|  1.96k|#define FRAME_HAS_VLMETALAYERS (FRAME_NTHREADS_D + 2)  // 68
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|  1.96k|#define FRAME_NTHREADS_D (FRAME_NTHREADS_C + 2 + 1)  // 66
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   41|  1.96k|#define FRAME_NTHREADS_C (FRAME_CHUNKSIZE + 4 + 1)  // 63
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   40|  1.96k|#define FRAME_CHUNKSIZE (FRAME_BLOCKSIZE + 4 + 1)  // 58
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   39|  1.96k|#define FRAME_BLOCKSIZE (FRAME_TYPESIZE + 4 + 1)  // 53
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   38|  1.96k|#define FRAME_TYPESIZE (FRAME_CBYTES + 8 + 1) // 48
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|  1.96k|#define FRAME_CBYTES (FRAME_NBYTES + 8 + 1)  // 39
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   36|  1.96k|#define FRAME_NBYTES (FRAME_FLAGS + 4 + 1)  // 30
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   32|  1.96k|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   31|  1.96k|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   30|  1.96k|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   29|  1.96k|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (882:7): [True: 0, False: 1.96k]
  |  Branch (882:25): [True: 0, False: 1.96k]
  ------------------
  883|      0|    return NULL;
  884|      0|  }
  885|  1.96k|  char *magic_number = (char *)cframe + FRAME_HEADER_MAGIC;
  ------------------
  |  |   29|  1.96k|#define FRAME_HEADER_MAGIC 2
  ------------------
  886|  1.96k|  if (memcmp(magic_number, "b2frame", sizeof("b2frame")) != 0) {
  ------------------
  |  Branch (886:7): [True: 6, False: 1.95k]
  ------------------
  887|      6|    return NULL;
  888|      6|  }
  889|  1.95k|  blosc2_frame_s* frame = frame_from_cframe(cframe, len, false);
  890|  1.95k|  if (frame == NULL) {
  ------------------
  |  Branch (890:7): [True: 5, False: 1.95k]
  ------------------
  891|      5|    return NULL;
  892|      5|  }
  893|  1.95k|  blosc2_schunk* schunk = frame_to_schunk(frame, copy, &BLOSC2_IO_DEFAULTS);
  894|  1.95k|  if (schunk && copy) {
  ------------------
  |  Branch (894:7): [True: 69, False: 1.88k]
  |  Branch (894:17): [True: 0, False: 69]
  ------------------
  895|       |    // Super-chunk has its own copy of frame
  896|      0|    frame_free(frame);
  897|      0|  }
  898|  1.95k|  return schunk;
  899|  1.95k|}
blosc2_schunk_fill_special:
  954|     70|                               int32_t chunksize) {
  955|     70|  if (nitems == 0) {
  ------------------
  |  Branch (955:7): [True: 0, False: 70]
  ------------------
  956|      0|    return 0;
  957|      0|  }
  958|       |
  959|     70|  int32_t typesize = schunk->typesize;
  960|     70|  if (nitems < 0 || chunksize <= 0 || typesize <= 0) {
  ------------------
  |  Branch (960:7): [True: 0, False: 70]
  |  Branch (960:21): [True: 0, False: 70]
  |  Branch (960:39): [True: 0, False: 70]
  ------------------
  961|      0|    BLOSC_TRACE_ERROR("Invalid special fill parameters.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  962|      0|    return BLOSC2_ERROR_INVALID_PARAM;
  963|      0|  }
  964|       |
  965|     70|  if ((schunk->nbytes > 0) || (schunk->cbytes > 0)) {
  ------------------
  |  Branch (965:7): [True: 0, False: 70]
  |  Branch (965:31): [True: 0, False: 70]
  ------------------
  966|      0|    BLOSC_TRACE_ERROR("Filling with special values only works on empty super-chunks");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  967|      0|    return BLOSC2_ERROR_FRAME_SPECIAL;
  968|      0|  }
  969|       |
  970|       |  // Compute the number of chunks and the length of the offsets chunk
  971|     70|  int32_t chunkitems = chunksize / typesize;
  972|     70|  if (chunkitems <= 0) {
  ------------------
  |  Branch (972:7): [True: 0, False: 70]
  ------------------
  973|      0|    BLOSC_TRACE_ERROR("chunksize must be >= typesize for special fill.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  974|      0|    return BLOSC2_ERROR_INVALID_PARAM;
  975|      0|  }
  976|     70|  int64_t nchunks = nitems / chunkitems;
  977|     70|  if (nchunks > INT_MAX) {
  ------------------
  |  Branch (977:7): [True: 0, False: 70]
  ------------------
  978|      0|    BLOSC_TRACE_ERROR("nitems is too large.  Try increasing the chunksize.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  979|      0|    return BLOSC2_ERROR_SCHUNK_SPECIAL;
  980|      0|  }
  981|     70|  if (!blosc2_checked_mul_i64_nonneg(nitems, typesize, NULL)) {
  ------------------
  |  Branch (981:7): [True: 0, False: 70]
  ------------------
  982|      0|    BLOSC_TRACE_ERROR("nitems is too large for nbytes accounting.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  983|      0|    return BLOSC2_ERROR_SCHUNK_SPECIAL;
  984|      0|  }
  985|     70|  int32_t leftover_items = (int32_t)(nitems % chunkitems);
  986|       |
  987|     70|  if (schunk->frame == NULL) {
  ------------------
  |  Branch (987:7): [True: 0, False: 70]
  ------------------
  988|       |    // Build the special chunks
  989|      0|    int32_t leftover_size = leftover_items * typesize;
  990|      0|    void* chunk = malloc(BLOSC_EXTENDED_HEADER_LENGTH);
  991|      0|    void* chunk2 = malloc(BLOSC_EXTENDED_HEADER_LENGTH);
  992|      0|    blosc2_cparams* cparams;
  993|      0|    blosc2_schunk_get_cparams(schunk, &cparams);
  994|      0|    int csize, csize2;
  995|      0|    switch (special_value) {
  996|      0|      case BLOSC2_SPECIAL_ZERO:
  ------------------
  |  Branch (996:7): [True: 0, False: 0]
  ------------------
  997|      0|        csize = blosc2_chunk_zeros(*cparams, chunksize, chunk, BLOSC_EXTENDED_HEADER_LENGTH);
  998|      0|        csize2 = blosc2_chunk_zeros(*cparams, leftover_size, chunk2, BLOSC_EXTENDED_HEADER_LENGTH);
  999|      0|        break;
 1000|      0|      case BLOSC2_SPECIAL_UNINIT:
  ------------------
  |  Branch (1000:7): [True: 0, False: 0]
  ------------------
 1001|      0|        csize = blosc2_chunk_uninit(*cparams, chunksize, chunk, BLOSC_EXTENDED_HEADER_LENGTH);
 1002|      0|        csize2 = blosc2_chunk_uninit(*cparams, leftover_size, chunk2, BLOSC_EXTENDED_HEADER_LENGTH);
 1003|      0|        break;
 1004|      0|      case BLOSC2_SPECIAL_NAN:
  ------------------
  |  Branch (1004:7): [True: 0, False: 0]
  ------------------
 1005|      0|        csize = blosc2_chunk_nans(*cparams, chunksize, chunk, BLOSC_EXTENDED_HEADER_LENGTH);
 1006|      0|        csize2 = blosc2_chunk_nans(*cparams, leftover_size, chunk2, BLOSC_EXTENDED_HEADER_LENGTH);
 1007|      0|        break;
 1008|      0|      default:
  ------------------
  |  Branch (1008:7): [True: 0, False: 0]
  ------------------
 1009|      0|        BLOSC_TRACE_ERROR("Only zeros, NaNs or non-initialized values are supported.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1010|      0|        return BLOSC2_ERROR_SCHUNK_SPECIAL;
 1011|      0|    }
 1012|      0|    free(cparams);
 1013|      0|    if (csize < 0 || csize2 < 0) {
  ------------------
  |  Branch (1013:9): [True: 0, False: 0]
  |  Branch (1013:22): [True: 0, False: 0]
  ------------------
 1014|      0|      BLOSC_TRACE_ERROR("Error creating special chunks.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1015|      0|      return BLOSC2_ERROR_SCHUNK_SPECIAL;
 1016|      0|    }
 1017|       |
 1018|      0|    for (int nchunk = 0; nchunk < nchunks; nchunk++) {
  ------------------
  |  Branch (1018:26): [True: 0, False: 0]
  ------------------
 1019|      0|      int64_t nchunk_ = blosc2_schunk_append_chunk(schunk, chunk, true);
 1020|      0|      if (nchunk_ != nchunk + 1) {
  ------------------
  |  Branch (1020:11): [True: 0, False: 0]
  ------------------
 1021|      0|        BLOSC_TRACE_ERROR("Error appending special chunks.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1022|      0|        return BLOSC2_ERROR_SCHUNK_SPECIAL;
 1023|      0|      }
 1024|      0|    }
 1025|       |
 1026|      0|    if (leftover_items) {
  ------------------
  |  Branch (1026:9): [True: 0, False: 0]
  ------------------
 1027|      0|      int64_t nchunk_ = blosc2_schunk_append_chunk(schunk, chunk2, true);
 1028|      0|      if (nchunk_ != nchunks + 1) {
  ------------------
  |  Branch (1028:11): [True: 0, False: 0]
  ------------------
 1029|      0|        BLOSC_TRACE_ERROR("Error appending last special chunk.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1030|      0|        return BLOSC2_ERROR_SCHUNK_SPECIAL;
 1031|      0|      }
 1032|      0|    }
 1033|      0|    free(chunk);
 1034|      0|    free(chunk2);
 1035|      0|  }
 1036|     70|  else {
 1037|       |    /* Fill an empty frame with special values (fast path). */
 1038|     70|    blosc2_frame_s *frame = (blosc2_frame_s *) schunk->frame;
 1039|     70|    int64_t total_chunks = nchunks + (leftover_items ? 1 : 0);
  ------------------
  |  Branch (1039:39): [True: 0, False: 70]
  ------------------
 1040|     70|    if (!blosc2_nchunks_to_offsets_nbytes(total_chunks, NULL)) {
  ------------------
  |  Branch (1040:9): [True: 0, False: 70]
  ------------------
 1041|      0|      BLOSC_TRACE_ERROR("Too many chunks for frame offsets representation.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1042|      0|      return BLOSC2_ERROR_FRAME_SPECIAL;
 1043|      0|    }
 1044|       |
 1045|     70|    int64_t old_nchunks = schunk->nchunks;
 1046|     70|    int64_t old_nbytes = schunk->nbytes;
 1047|     70|    int32_t old_chunksize = schunk->chunksize;
 1048|       |
 1049|       |    /* Update counters (necessary for the frame_fill_special() logic) */
 1050|     70|    if (leftover_items) {
  ------------------
  |  Branch (1050:9): [True: 0, False: 70]
  ------------------
 1051|      0|      nchunks += 1;
 1052|      0|    }
 1053|     70|    schunk->chunksize = chunksize;
 1054|     70|    schunk->nchunks = nchunks;
 1055|     70|    schunk->nbytes = nitems * typesize;
 1056|     70|    int rc = frame_lock(frame, true);
 1057|     70|    if (rc < 0) {
  ------------------
  |  Branch (1057:9): [True: 0, False: 70]
  ------------------
 1058|      0|      schunk->chunksize = old_chunksize;
 1059|      0|      schunk->nchunks = old_nchunks;
 1060|      0|      schunk->nbytes = old_nbytes;
 1061|      0|      return rc;
 1062|      0|    }
 1063|     70|    int64_t frame_len = frame_fill_special(frame, nitems, special_value, chunksize, schunk);
 1064|     70|    frame_unlock(frame);
 1065|     70|    if (frame_len < 0) {
  ------------------
  |  Branch (1065:9): [True: 0, False: 70]
  ------------------
 1066|      0|      schunk->chunksize = old_chunksize;
 1067|      0|      schunk->nchunks = old_nchunks;
 1068|      0|      schunk->nbytes = old_nbytes;
 1069|      0|      BLOSC_TRACE_ERROR("Error creating special frame.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1070|      0|      return frame_len;
 1071|      0|    }
 1072|     70|  }
 1073|       |
 1074|     70|  return schunk->nchunks;
 1075|     70|}
schunk_update_chunk_lent:
 1575|    610|int64_t schunk_update_chunk_lent(blosc2_schunk *schunk, int64_t nchunk, uint8_t *chunk) {
 1576|    610|  return schunk_update_chunk_locked(schunk, nchunk, chunk, CHUNK_LENT);
 1577|    610|}
schunk_scratch_malloc:
 1650|    784|uint8_t *schunk_scratch_malloc(const blosc2_schunk *schunk, int32_t nbytes, size_t *capacity) {
 1651|    784|  if (schunk->frame != NULL) {
  ------------------
  |  Branch (1651:7): [True: 784, False: 0]
  ------------------
 1652|    784|    return blosc2_tmp_malloc((size_t) nbytes, capacity);
 1653|    784|  }
 1654|      0|  *capacity = 0;
 1655|      0|  return malloc((size_t) nbytes);
 1656|    784|}
blosc2_schunk_decompress_chunk:
 1747|  1.15k|                                   void *dest, int32_t nbytes) {
 1748|  1.15k|  int rc = validate_nchunk(schunk, nchunk, false, "blosc2_schunk_decompress_chunk");
 1749|  1.15k|  if (rc < 0) {
  ------------------
  |  Branch (1749:7): [True: 0, False: 1.15k]
  ------------------
 1750|      0|    return rc;
 1751|      0|  }
 1752|       |
 1753|  1.15k|  int32_t chunk_nbytes;
 1754|  1.15k|  int32_t chunk_cbytes;
 1755|  1.15k|  int chunksize;
 1756|  1.15k|  blosc2_frame_s* frame = (blosc2_frame_s*)schunk->frame;
 1757|       |
 1758|  1.15k|  schunk->current_nchunk = nchunk;
 1759|  1.15k|  if (frame == NULL) {
  ------------------
  |  Branch (1759:7): [True: 0, False: 1.15k]
  ------------------
 1760|      0|    uint8_t* src = schunk->data[nchunk];
 1761|      0|    if (src == 0) {
  ------------------
  |  Branch (1761:9): [True: 0, False: 0]
  ------------------
 1762|      0|      return 0;
 1763|      0|    }
 1764|       |
 1765|      0|    rc = blosc2_cbuffer_sizes(src, &chunk_nbytes, &chunk_cbytes, NULL);
 1766|      0|    if (rc < 0) {
  ------------------
  |  Branch (1766:9): [True: 0, False: 0]
  ------------------
 1767|      0|      return rc;
 1768|      0|    }
 1769|       |
 1770|      0|    if (nbytes < chunk_nbytes) {
  ------------------
  |  Branch (1770:9): [True: 0, False: 0]
  ------------------
 1771|      0|      BLOSC_TRACE_ERROR("Buffer size is too small for the decompressed buffer "
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1772|      0|                        "('%d' bytes, but '%d' are needed).", nbytes, chunk_nbytes);
 1773|      0|      return BLOSC2_ERROR_INVALID_PARAM;
 1774|      0|    }
 1775|       |
 1776|      0|    chunksize = blosc2_decompress_ctx(schunk->dctx, src, chunk_cbytes, dest, nbytes);
 1777|      0|    if (chunksize < 0 || chunksize != chunk_nbytes) {
  ------------------
  |  Branch (1777:9): [True: 0, False: 0]
  |  Branch (1777:26): [True: 0, False: 0]
  ------------------
 1778|      0|      BLOSC_TRACE_ERROR("Error in decompressing chunk.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1779|      0|      if (chunksize < 0)
  ------------------
  |  Branch (1779:11): [True: 0, False: 0]
  ------------------
 1780|      0|        return chunksize;
 1781|      0|      return BLOSC2_ERROR_FAILURE;
 1782|      0|    }
 1783|  1.15k|  } else {
 1784|  1.15k|    rc = frame_lock(frame, false);
 1785|  1.15k|    if (rc < 0) {
  ------------------
  |  Branch (1785:9): [True: 0, False: 1.15k]
  ------------------
 1786|      0|      return rc;
 1787|      0|    }
 1788|  1.15k|    chunksize = frame_decompress_chunk(schunk->dctx, frame, nchunk, dest, nbytes);
 1789|  1.15k|    frame_unlock(frame);
 1790|  1.15k|    if (chunksize < 0) {
  ------------------
  |  Branch (1790:9): [True: 0, False: 1.15k]
  ------------------
 1791|      0|      return chunksize;
 1792|      0|    }
 1793|  1.15k|  }
 1794|  1.15k|  return chunksize;
 1795|  1.15k|}
blosc2_schunk_get_lazychunk:
 1884|      2|int blosc2_schunk_get_lazychunk(blosc2_schunk *schunk, int64_t nchunk, uint8_t **chunk, bool *needs_free) {
 1885|      2|  int rc = validate_nchunk(schunk, nchunk, false, "blosc2_schunk_get_lazychunk");
 1886|      2|  if (rc < 0) {
  ------------------
  |  Branch (1886:7): [True: 0, False: 2]
  ------------------
 1887|      0|    return rc;
 1888|      0|  }
 1889|       |
 1890|      2|  if (ctx_uses_parallel_backend(schunk->dctx)) {
  ------------------
  |  Branch (1890:7): [True: 0, False: 2]
  ------------------
 1891|      0|    blosc2_pthread_mutex_lock(&schunk->dctx->nchunk_mutex);
  ------------------
  |  |   92|      0|#define blosc2_pthread_mutex_lock(a) pthread_mutex_lock((a))
  ------------------
 1892|      0|    schunk->current_nchunk = nchunk;
 1893|      0|    blosc2_pthread_mutex_unlock(&schunk->dctx->nchunk_mutex);
  ------------------
  |  |   93|      0|#define blosc2_pthread_mutex_unlock(a) pthread_mutex_unlock((a))
  ------------------
 1894|      0|  }
 1895|      2|  else {
 1896|      2|    schunk->current_nchunk = nchunk;
 1897|      2|  }
 1898|      2|  blosc2_frame_s* frame = (blosc2_frame_s*)schunk->frame;
 1899|      2|  if (schunk->frame != NULL) {
  ------------------
  |  Branch (1899:7): [True: 2, False: 0]
  ------------------
 1900|      2|    rc = frame_lock(frame, false);
 1901|      2|    if (rc < 0) {
  ------------------
  |  Branch (1901:9): [True: 0, False: 2]
  ------------------
 1902|      0|      return rc;
 1903|      0|    }
 1904|      2|    rc = frame_get_lazychunk(frame, nchunk, chunk, needs_free);
 1905|      2|    frame_unlock(frame);
 1906|      2|    return rc;
 1907|      2|  }
 1908|       |
 1909|      0|  *chunk = schunk->data[nchunk];
 1910|      0|  if (*chunk == 0) {
  ------------------
  |  Branch (1910:7): [True: 0, False: 0]
  ------------------
 1911|      0|    *needs_free = 0;
 1912|      0|    return 0;
 1913|      0|  }
 1914|       |
 1915|      0|  *needs_free = false;
 1916|      0|  int32_t chunk_cbytes;
 1917|      0|  rc = blosc2_cbuffer_sizes(*chunk, NULL, &chunk_cbytes, NULL);
 1918|      0|  if (rc < 0) {
  ------------------
  |  Branch (1918:7): [True: 0, False: 0]
  ------------------
 1919|      0|    return rc;
 1920|      0|  }
 1921|      0|  return (int)chunk_cbytes;
 1922|      0|}
schunk_decompress_masked:
 2007|  1.12k|                             void *user_data, void *dest, int32_t destsize) {
 2008|  1.12k|  blosc2_context *dctx = schunk->dctx;
 2009|  1.12k|  int rc = blosc2_set_maskout(dctx, (bool *) maskout, nblocks);
 2010|  1.12k|  if (rc < 0) {
  ------------------
  |  Branch (2010:7): [True: 0, False: 1.12k]
  ------------------
 2011|      0|    return rc;
 2012|      0|  }
 2013|  1.12k|  blosc2_postfilter_fn saved_postfilter = dctx->postfilter;
 2014|  1.12k|  blosc2_postfilter_params *saved_postparams = dctx->postparams;
 2015|  1.12k|  blosc2_postfilter_params params;
 2016|  1.12k|  if (postfilter != NULL) {
  ------------------
  |  Branch (2016:7): [True: 1.01k, False: 112]
  ------------------
 2017|  1.01k|    memset(&params, 0, sizeof(params));
 2018|  1.01k|    params.user_data = user_data;
 2019|  1.01k|    dctx->postfilter = postfilter;
 2020|  1.01k|    dctx->postparams = &params;
 2021|  1.01k|  }
 2022|  1.12k|  if (chunk != NULL) {
  ------------------
  |  Branch (2022:7): [True: 0, False: 1.12k]
  ------------------
 2023|      0|    rc = blosc2_decompress_ctx(dctx, chunk, cbytes, dest, destsize);
 2024|      0|  }
 2025|  1.12k|  else {
 2026|  1.12k|    rc = blosc2_schunk_decompress_chunk(schunk, nchunk, dest, destsize);
 2027|  1.12k|  }
 2028|  1.12k|  dctx->postfilter = saved_postfilter;
 2029|  1.12k|  dctx->postparams = saved_postparams;
 2030|       |  // A decompression that failed early, or a missing chunk, leaves the mask set
 2031|  1.12k|  ctx_clear_maskout(dctx);
 2032|  1.12k|  return rc;
 2033|  1.12k|}
metalayer_flush:
 2815|     70|int metalayer_flush(blosc2_schunk* schunk) {
 2816|     70|  int rc = BLOSC2_ERROR_SUCCESS;
 2817|     70|  blosc2_frame_s* frame = (blosc2_frame_s*)schunk->frame;
 2818|     70|  if (frame == NULL) {
  ------------------
  |  Branch (2818:7): [True: 0, False: 70]
  ------------------
 2819|      0|    return rc;
 2820|      0|  }
 2821|     70|  rc = frame_lock(frame, true);
 2822|     70|  if (rc < 0) {
  ------------------
  |  Branch (2822:7): [True: 0, False: 70]
  ------------------
 2823|      0|    return rc;
 2824|      0|  }
 2825|     70|  rc = frame_update_header(frame, schunk, true);
 2826|     70|  if (rc < 0) {
  ------------------
  |  Branch (2826:7): [True: 0, False: 70]
  ------------------
 2827|      0|    BLOSC_TRACE_ERROR("Unable to update metalayers into frame.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2828|      0|    frame_unlock(frame);
 2829|      0|    return rc;
 2830|      0|  }
 2831|     70|  rc = frame_update_trailer(frame, schunk);
 2832|     70|  if (rc < 0) {
  ------------------
  |  Branch (2832:7): [True: 0, False: 70]
  ------------------
 2833|      0|    BLOSC_TRACE_ERROR("Unable to update trailer into frame.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2834|      0|    frame_unlock(frame);
 2835|      0|    return rc;
 2836|      0|  }
 2837|     70|  frame_unlock(frame);
 2838|     70|  return rc;
 2839|     70|}
blosc2_meta_add:
 2846|     70|int blosc2_meta_add(blosc2_schunk *schunk, const char *name, uint8_t *content, int32_t content_len) {
 2847|     70|  if (schunk == NULL || name == NULL) {
  ------------------
  |  Branch (2847:7): [True: 0, False: 70]
  |  Branch (2847:25): [True: 0, False: 70]
  ------------------
 2848|      0|    BLOSC_TRACE_ERROR("Invalid parameters.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2849|      0|    return BLOSC2_ERROR_INVALID_PARAM;
 2850|      0|  }
 2851|     70|  int nmetalayer = blosc2_meta_exists(schunk, name);
 2852|     70|  if (nmetalayer >= 0) {
  ------------------
  |  Branch (2852:7): [True: 0, False: 70]
  ------------------
 2853|      0|    BLOSC_TRACE_ERROR("Metalayer \"%s\" already exists.", name);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2854|      0|    return BLOSC2_ERROR_INVALID_PARAM;
 2855|      0|  }
 2856|     70|  if (content_len < 0) {
  ------------------
  |  Branch (2856:7): [True: 0, False: 70]
  ------------------
 2857|      0|    BLOSC_TRACE_ERROR("Metalayer content length must not be negative.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2858|      0|    return BLOSC2_ERROR_INVALID_PARAM;
 2859|      0|  }
 2860|     70|  if (content_len > 0 && content == NULL) {
  ------------------
  |  Branch (2860:7): [True: 70, False: 0]
  |  Branch (2860:26): [True: 0, False: 70]
  ------------------
 2861|      0|    BLOSC_TRACE_ERROR("Metalayer content pointer must not be NULL when content length is positive.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2862|      0|    return BLOSC2_ERROR_INVALID_PARAM;
 2863|      0|  }
 2864|       |
 2865|       |  // Add the metalayer
 2866|     70|  blosc2_metalayer *metalayer = malloc(sizeof(blosc2_metalayer));
 2867|     70|  BLOSC_ERROR_NULL(metalayer, BLOSC2_ERROR_MEMORY_ALLOC);
  ------------------
  |  |  104|     70|    do {                                            \
  |  |  105|     70|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 70]
  |  |  ------------------
  |  |  106|      0|            BLOSC_TRACE_ERROR("Pointer is null");   \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  107|      0|            return (rc);                            \
  |  |  108|      0|        }                                           \
  |  |  109|     70|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 70]
  |  |  ------------------
  ------------------
 2868|       |
 2869|     70|  char* name_ = malloc(strlen(name) + 1);
 2870|     70|  if (name_ == NULL) {
  ------------------
  |  Branch (2870:7): [True: 0, False: 70]
  ------------------
 2871|      0|    free(metalayer);
 2872|      0|    BLOSC_TRACE_ERROR("Unable to allocate metalayer name buffer.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2873|      0|    return BLOSC2_ERROR_MEMORY_ALLOC;
 2874|      0|  }
 2875|     70|  strcpy(name_, name);
 2876|     70|  metalayer->name = name_;
 2877|       |
 2878|     70|  uint8_t* content_buf = malloc((size_t)content_len);
 2879|     70|  if (content_buf == NULL && content_len > 0) {
  ------------------
  |  Branch (2879:7): [True: 0, False: 70]
  |  Branch (2879:30): [True: 0, False: 0]
  ------------------
 2880|      0|    free(name_);
 2881|      0|    free(metalayer);
 2882|      0|    BLOSC_TRACE_ERROR("Unable to allocate metalayer content buffer.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2883|      0|    return BLOSC2_ERROR_MEMORY_ALLOC;
 2884|      0|  }
 2885|     70|  if (content_len > 0) {
  ------------------
  |  Branch (2885:7): [True: 70, False: 0]
  ------------------
 2886|     70|    memcpy(content_buf, content, content_len);
 2887|     70|  }
 2888|     70|  metalayer->content = content_buf;
 2889|     70|  metalayer->content_len = content_len;
 2890|     70|  schunk->metalayers[schunk->nmetalayers] = metalayer;
 2891|     70|  schunk->nmetalayers += 1;
 2892|       |
 2893|     70|  int rc = metalayer_flush(schunk);
 2894|     70|  if (rc < 0) {
  ------------------
  |  Branch (2894:7): [True: 0, False: 70]
  ------------------
 2895|      0|    return rc;
 2896|      0|  }
 2897|     70|  schunk->change_tick++;
 2898|       |
 2899|     70|  return schunk->nmetalayers - 1;
 2900|     70|}
schunk.c:schunk_get_chunk_flags2:
 1109|    592|static int schunk_get_chunk_flags2(blosc2_schunk *schunk, int64_t nchunk, uint8_t *chunk_flags2) {
 1110|    592|  uint8_t header[BLOSC_EXTENDED_HEADER_LENGTH];
 1111|    592|  const uint8_t *chunk;
 1112|    592|  int rc = schunk_get_chunk_header(schunk, nchunk, header, &chunk);
 1113|    592|  if (rc < 0) {
  ------------------
  |  Branch (1113:7): [True: 0, False: 592]
  ------------------
 1114|      0|    return rc;
 1115|      0|  }
 1116|    592|  if (chunk == NULL) {
  ------------------
  |  Branch (1116:7): [True: 0, False: 592]
  ------------------
 1117|      0|    return BLOSC2_ERROR_DATA;
 1118|      0|  }
 1119|    592|  *chunk_flags2 = get_chunk_flags2(chunk, rc);
 1120|    592|  return 0;
 1121|    592|}
schunk.c:schunk_get_chunk_header:
 1082|  1.20k|                                   const uint8_t **chunk) {
 1083|  1.20k|  if (schunk->frame != NULL) {
  ------------------
  |  Branch (1083:7): [True: 1.20k, False: 0]
  ------------------
 1084|  1.20k|    *chunk = header;
 1085|  1.20k|    return frame_get_chunk_header((blosc2_frame_s *)schunk->frame, nchunk, header);
 1086|  1.20k|  }
 1087|      0|  *chunk = schunk->data[nchunk];
 1088|      0|  if (*chunk == NULL) {
  ------------------
  |  Branch (1088:7): [True: 0, False: 0]
  ------------------
 1089|      0|    return 0;
 1090|      0|  }
 1091|      0|  int32_t chunk_cbytes;
 1092|      0|  int rc = blosc2_cbuffer_sizes(*chunk, NULL, &chunk_cbytes, NULL);
 1093|      0|  return rc < 0 ? rc : chunk_cbytes;
  ------------------
  |  Branch (1093:10): [True: 0, False: 0]
  ------------------
 1094|      0|}
schunk.c:chunk_needs_private_copy:
 1159|    610|static bool chunk_needs_private_copy(const blosc2_frame_s *frame, chunk_handover how) {
 1160|    610|  return how == CHUNK_COPIED || (how == CHUNK_LENT && frame == NULL);
  ------------------
  |  Branch (1160:10): [True: 0, False: 610]
  |  Branch (1160:34): [True: 610, False: 0]
  |  Branch (1160:55): [True: 0, False: 610]
  ------------------
 1161|    610|}
schunk.c:frame_write_done:
 1167|    610|static void frame_write_done(uint8_t *chunk, chunk_handover how, bool private_copy, bool written) {
 1168|    610|  if (private_copy || (written && how == CHUNK_GIVEN)) {
  ------------------
  |  Branch (1168:7): [True: 0, False: 610]
  |  Branch (1168:24): [True: 610, False: 0]
  |  Branch (1168:35): [True: 0, False: 610]
  ------------------
 1169|      0|    free(chunk);
 1170|      0|  }
 1171|    610|}
schunk.c:schunk_update_chunk_locked:
 1558|    610|                                          chunk_handover how) {
 1559|    610|  blosc2_frame_s* frame = (blosc2_frame_s*)schunk->frame;
 1560|    610|  int rc = frame_lock(frame, true);
 1561|    610|  if (rc < 0) {
  ------------------
  |  Branch (1561:7): [True: 0, False: 610]
  ------------------
 1562|      0|    return rc;
 1563|      0|  }
 1564|    610|  int64_t nchunks = schunk_update_chunk_unlocked(schunk, nchunk, chunk, how);
 1565|    610|  frame_unlock(frame);
 1566|    610|  return nchunks;
 1567|    610|}
schunk.c:schunk_update_chunk_unlocked:
 1437|    610|                                            chunk_handover how) {
 1438|    610|  int rc = validate_nchunk(schunk, nchunk, false, "blosc2_schunk_update_chunk");
 1439|    610|  if (rc < 0) {
  ------------------
  |  Branch (1439:7): [True: 0, False: 610]
  ------------------
 1440|      0|    return rc;
 1441|      0|  }
 1442|       |
 1443|    610|  uint8_t old_flags2 = schunk->flags2;
 1444|    610|  int32_t old_chunksize = schunk->chunksize;
 1445|    610|  int64_t old_current_nchunk = schunk->current_nchunk;
 1446|    610|  int64_t old_nbytes = schunk->nbytes;
 1447|    610|  int64_t old_cbytes = schunk->cbytes;
 1448|       |
 1449|    610|  int32_t chunk_nbytes;
 1450|    610|  int32_t chunk_cbytes;
 1451|       |
 1452|    610|  rc = blosc2_cbuffer_sizes(chunk, &chunk_nbytes, &chunk_cbytes, NULL);
 1453|    610|  if (rc < 0) {
  ------------------
  |  Branch (1453:7): [True: 0, False: 610]
  ------------------
 1454|      0|    return rc;
 1455|      0|  }
 1456|    610|  uint8_t flags2 = get_chunk_flags2(chunk, chunk_cbytes);
 1457|    610|  bool chunk_vlblocks = (flags2 & BLOSC2_VL_BLOCKS) != 0;
 1458|    610|  if (schunk->nchunks > 1 || (schunk->nchunks == 1 && nchunk != 0)) {
  ------------------
  |  Branch (1458:7): [True: 592, False: 18]
  |  Branch (1458:31): [True: 18, False: 0]
  |  Branch (1458:55): [True: 0, False: 18]
  ------------------
 1459|    592|    int64_t ref_nchunk = (nchunk == 0) ? 1 : 0;
  ------------------
  |  Branch (1459:26): [True: 51, False: 541]
  ------------------
 1460|    592|    uint8_t ref_flags2;
 1461|    592|    rc = schunk_get_chunk_flags2(schunk, ref_nchunk, &ref_flags2);
 1462|    592|    if (rc < 0) {
  ------------------
  |  Branch (1462:9): [True: 0, False: 592]
  ------------------
 1463|      0|      return rc;
 1464|      0|    }
 1465|    592|    if (((ref_flags2 & BLOSC2_VL_BLOCKS) != 0) != chunk_vlblocks) {
  ------------------
  |  Branch (1465:9): [True: 0, False: 592]
  ------------------
 1466|      0|      BLOSC_TRACE_ERROR("schunks cannot mix regular chunks and VL-block chunks.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1467|      0|      return BLOSC2_ERROR_CHUNK_UPDATE;
 1468|      0|    }
 1469|    592|  }
 1470|     18|  else {
 1471|     18|    schunk->flags2 = flags2;
 1472|     18|  }
 1473|       |
 1474|    610|  int32_t chunksize = schunk->chunksize;
 1475|    610|  bool variable_chunksize = (chunksize == 0);
 1476|    610|  if (chunksize == -1) {
  ------------------
  |  Branch (1476:7): [True: 0, False: 610]
  ------------------
 1477|      0|    schunk->chunksize = chunk_nbytes;  // The super-chunk is initialized now
 1478|      0|    chunksize = schunk->chunksize;
 1479|      0|  }
 1480|       |
 1481|    610|  if (!variable_chunksize && (chunk_nbytes > chunksize ||
  ------------------
  |  Branch (1481:7): [True: 610, False: 0]
  |  Branch (1481:31): [True: 0, False: 610]
  ------------------
 1482|    610|      (nchunk != schunk->nchunks - 1 && chunk_nbytes != chunksize))) {
  ------------------
  |  Branch (1482:8): [True: 541, False: 69]
  |  Branch (1482:41): [True: 0, False: 541]
  ------------------
 1483|      0|    variable_chunksize = true;
 1484|      0|    schunk->chunksize = 0;
 1485|      0|  }
 1486|    610|  if (!variable_chunksize && chunksize > 0 && chunk_nbytes > chunksize) {
  ------------------
  |  Branch (1486:7): [True: 610, False: 0]
  |  Branch (1486:30): [True: 610, False: 0]
  |  Branch (1486:47): [True: 0, False: 610]
  ------------------
 1487|      0|    BLOSC_TRACE_ERROR("Updating chunks having different lengths in the same schunk "
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1488|      0|                      "is not supported yet: %d > %d.", chunk_nbytes, chunksize);
 1489|      0|    return BLOSC2_ERROR_CHUNK_UPDATE;
 1490|      0|  }
 1491|       |
 1492|       |  // Only the sizes of the old chunk are needed, so do not read all of it from disk
 1493|    610|  int32_t chunk_nbytes_old;
 1494|    610|  int32_t chunk_cbytes_old;
 1495|    610|  rc = schunk_get_counted_sizes(schunk, nchunk, &chunk_nbytes_old, &chunk_cbytes_old);
 1496|    610|  if (rc < 0) {
  ------------------
  |  Branch (1496:7): [True: 0, False: 610]
  ------------------
 1497|      0|    BLOSC_TRACE_ERROR("%" PRId64 " chunk can not be obtained from schunk.", nchunk);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1498|      0|    return rc;
 1499|      0|  }
 1500|    610|  schunk->current_nchunk = nchunk;
 1501|       |
 1502|    610|  blosc2_frame_s* frame = (blosc2_frame_s*)(schunk->frame);
 1503|    610|  bool private_copy = chunk_needs_private_copy(frame, how);
 1504|    610|  if (private_copy) {
  ------------------
  |  Branch (1504:7): [True: 0, False: 610]
  ------------------
 1505|       |    // Make a copy of the chunk
 1506|      0|    uint8_t *chunk_copy = malloc(chunk_cbytes);
 1507|      0|    memcpy(chunk_copy, chunk, chunk_cbytes);
 1508|      0|    chunk = chunk_copy;
 1509|      0|  }
 1510|       |
 1511|    610|  if (schunk->frame == NULL) {
  ------------------
  |  Branch (1511:7): [True: 0, False: 610]
  ------------------
 1512|       |    /* Update counters */
 1513|      0|    schunk->nbytes += chunk_nbytes;
 1514|      0|    schunk->nbytes -= chunk_nbytes_old;
 1515|      0|    schunk->cbytes += chunk_cbytes;
 1516|      0|    schunk->cbytes -= chunk_cbytes_old;
 1517|    610|  } else {
 1518|       |    // A frame codes special chunks in their offsets
 1519|    610|    schunk->nbytes += chunk_nbytes;
 1520|    610|    schunk->nbytes -= chunk_nbytes_old;
 1521|    610|    if (!chunk_special_in_offset(chunk, chunk_cbytes)) {
  ------------------
  |  Branch (1521:9): [True: 578, False: 32]
  ------------------
 1522|    578|      schunk->cbytes += chunk_cbytes;
 1523|    578|    }
 1524|    610|    schunk->cbytes -= chunk_cbytes_old;
 1525|    610|  }
 1526|       |
 1527|       |  // Update super-chunk or frame
 1528|    610|  if (schunk->frame == NULL) {
  ------------------
  |  Branch (1528:7): [True: 0, False: 610]
  ------------------
 1529|      0|    if (how == CHUNK_GIVEN && (chunk_cbytes < chunk_nbytes)) {
  ------------------
  |  Branch (1529:9): [True: 0, False: 0]
  |  Branch (1529:31): [True: 0, False: 0]
  ------------------
 1530|       |      // We still want to do a shrink of the chunk
 1531|      0|      chunk = realloc(chunk, chunk_cbytes);
 1532|      0|    }
 1533|       |
 1534|       |    // Free old chunk and add reference to new chunk
 1535|      0|    if (schunk->data[nchunk] != 0) {
  ------------------
  |  Branch (1535:9): [True: 0, False: 0]
  ------------------
 1536|      0|      free(schunk->data[nchunk]);
 1537|      0|    }
 1538|      0|    schunk->data[nchunk] = chunk;
 1539|      0|  }
 1540|    610|  else {
 1541|    610|    bool written = frame_update_chunk(frame, nchunk, chunk, schunk, chunk_cbytes_old) != NULL;
 1542|    610|    frame_write_done(chunk, how, private_copy, written);
 1543|    610|    if (!written) {
  ------------------
  |  Branch (1543:9): [True: 0, False: 610]
  ------------------
 1544|      0|      BLOSC_TRACE_ERROR("Problems updating a chunk in a frame.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1545|      0|      schunk->flags2 = old_flags2;
 1546|      0|      schunk->chunksize = old_chunksize;
 1547|      0|      schunk->current_nchunk = old_current_nchunk;
 1548|      0|      schunk->nbytes = old_nbytes;
 1549|      0|      schunk->cbytes = old_cbytes;
 1550|      0|      return BLOSC2_ERROR_CHUNK_UPDATE;
 1551|      0|    }
 1552|    610|  }
 1553|       |
 1554|    610|  return schunk->nchunks;
 1555|    610|}
schunk.c:schunk_get_counted_sizes:
 1126|    610|                                    int32_t *chunk_cbytes) {
 1127|    610|  *chunk_nbytes = 0;
 1128|    610|  *chunk_cbytes = 0;
 1129|    610|  uint8_t header[BLOSC_EXTENDED_HEADER_LENGTH];
 1130|    610|  const uint8_t *chunk;
 1131|    610|  int rc = schunk_get_chunk_header(schunk, nchunk, header, &chunk);
 1132|    610|  if (rc < 0 || chunk == NULL) {
  ------------------
  |  Branch (1132:7): [True: 0, False: 610]
  |  Branch (1132:17): [True: 0, False: 610]
  ------------------
 1133|      0|    return rc;
 1134|      0|  }
 1135|    610|  rc = blosc2_cbuffer_sizes(chunk, chunk_nbytes, chunk_cbytes, NULL);
 1136|    610|  if (rc < 0) {
  ------------------
  |  Branch (1136:7): [True: 0, False: 610]
  ------------------
 1137|      0|    return rc;
 1138|      0|  }
 1139|    610|  if (*chunk_cbytes == BLOSC2_MAX_OVERHEAD) {
  ------------------
  |  Branch (1139:7): [True: 610, False: 0]
  ------------------
 1140|    610|    *chunk_cbytes = 0;
 1141|    610|  }
 1142|    610|  return BLOSC2_ERROR_SUCCESS;
 1143|    610|}
schunk.c:validate_nchunk:
   47|  1.76k|static int validate_nchunk(blosc2_schunk *schunk, int64_t nchunk, bool allow_end, const char *func_name) {
   48|  1.76k|  if (nchunk < 0) {
  ------------------
  |  Branch (48:7): [True: 0, False: 1.76k]
  ------------------
   49|      0|    BLOSC_TRACE_ERROR("nchunk ('%" PRId64 "') is negative in %s.", nchunk, func_name);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
   50|      0|    return BLOSC2_ERROR_INVALID_PARAM;
   51|      0|  }
   52|       |
   53|  1.76k|  if (allow_end) {
  ------------------
  |  Branch (53:7): [True: 0, False: 1.76k]
  ------------------
   54|      0|    if (nchunk > schunk->nchunks) {
  ------------------
  |  Branch (54:9): [True: 0, False: 0]
  ------------------
   55|      0|      BLOSC_TRACE_ERROR("nchunk ('%" PRId64 "') is out of range [0, %" PRId64 "] in %s.",
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
   56|      0|                        nchunk, schunk->nchunks, func_name);
   57|      0|      return BLOSC2_ERROR_INVALID_PARAM;
   58|      0|    }
   59|      0|  }
   60|  1.76k|  else {
   61|  1.76k|    if (nchunk >= schunk->nchunks) {
  ------------------
  |  Branch (61:9): [True: 0, False: 1.76k]
  ------------------
   62|      0|      BLOSC_TRACE_ERROR("nchunk ('%" PRId64 "') exceeds the number of chunks "
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
   63|      0|                        "('%" PRId64 "') in %s.", nchunk, schunk->nchunks, func_name);
   64|      0|      return BLOSC2_ERROR_INVALID_PARAM;
   65|      0|    }
   66|  1.76k|  }
   67|       |
   68|  1.76k|  return BLOSC2_ERROR_SUCCESS;
   69|  1.76k|}

shuffle_avx2:
  718|  1.95k|             const uint8_t *_src, uint8_t *_dest) {
  719|  1.95k|  const int32_t vectorized_chunk_size = bytesoftype * (int32_t)sizeof(__m256i);
  720|       |
  721|       |  /* If the block size is too small to be vectorized,
  722|       |     use the generic implementation. */
  723|  1.95k|  if (blocksize < vectorized_chunk_size) {
  ------------------
  |  Branch (723:7): [True: 1.94k, False: 10]
  ------------------
  724|  1.94k|    shuffle_generic(bytesoftype, blocksize, _src, _dest);
  725|  1.94k|    return;
  726|  1.94k|  }
  727|       |
  728|       |  /* If the blocksize is not a multiple of both the typesize and
  729|       |     the vector size, round the blocksize down to the next value
  730|       |     which is a multiple of both. The vectorized shuffle can be
  731|       |     used for that portion of the data, and the naive implementation
  732|       |     can be used for the remaining portion. */
  733|     10|  const int32_t vectorizable_bytes = blocksize - (blocksize % vectorized_chunk_size);
  734|       |
  735|     10|  const int32_t vectorizable_elements = vectorizable_bytes / bytesoftype;
  736|     10|  const int32_t total_elements = blocksize / bytesoftype;
  737|       |
  738|       |  /* Optimized shuffle implementations */
  739|     10|  switch (bytesoftype) {
  740|      0|    case 2:
  ------------------
  |  Branch (740:5): [True: 0, False: 10]
  ------------------
  741|      0|      shuffle2_avx2(_dest, _src, vectorizable_elements, total_elements);
  742|      0|      break;
  743|     10|    case 4:
  ------------------
  |  Branch (743:5): [True: 10, False: 0]
  ------------------
  744|     10|      shuffle4_avx2(_dest, _src, vectorizable_elements, total_elements);
  745|     10|      break;
  746|      0|    case 8:
  ------------------
  |  Branch (746:5): [True: 0, False: 10]
  ------------------
  747|      0|      shuffle8_avx2(_dest, _src, vectorizable_elements, total_elements);
  748|      0|      break;
  749|      0|    case 16:
  ------------------
  |  Branch (749:5): [True: 0, False: 10]
  ------------------
  750|      0|      shuffle16_avx2(_dest, _src, vectorizable_elements, total_elements);
  751|      0|      break;
  752|      0|    default:
  ------------------
  |  Branch (752:5): [True: 0, False: 10]
  ------------------
  753|       |      /* For types larger than 16 bytes, use the AVX2 tiled shuffle. */
  754|      0|      if (bytesoftype > (int32_t)sizeof(__m128i)) {
  ------------------
  |  Branch (754:11): [True: 0, False: 0]
  ------------------
  755|      0|        shuffle16_tiled_avx2(_dest, _src, vectorizable_elements, total_elements, bytesoftype);
  756|      0|      }
  757|      0|      else {
  758|       |        /* Non-optimized shuffle */
  759|      0|        shuffle_generic(bytesoftype, blocksize, _src, _dest);
  760|       |        /* The non-optimized function covers the whole buffer,
  761|       |           so we're done processing here. */
  762|      0|        return;
  763|      0|      }
  764|     10|  }
  765|       |
  766|       |  /* If the buffer had any bytes at the end which couldn't be handled
  767|       |     by the vectorized implementations, use the non-optimized version
  768|       |     to finish them up. */
  769|     10|  if (vectorizable_bytes < blocksize) {
  ------------------
  |  Branch (769:7): [True: 0, False: 10]
  ------------------
  770|      0|    shuffle_generic_inline(bytesoftype, vectorizable_bytes, blocksize, _src, _dest);
  771|      0|  }
  772|     10|}
unshuffle_avx2:
  777|  8.42k|               const uint8_t *_src, uint8_t *_dest) {
  778|  8.42k|  const int32_t vectorized_chunk_size = bytesoftype * (int32_t)sizeof(__m256i);
  779|       |
  780|       |  /* If the block size is too small to be vectorized,
  781|       |     use the generic implementation. */
  782|  8.42k|  if (blocksize < vectorized_chunk_size) {
  ------------------
  |  Branch (782:7): [True: 8.10k, False: 323]
  ------------------
  783|  8.10k|    unshuffle_generic(bytesoftype, blocksize, _src, _dest);
  784|  8.10k|    return;
  785|  8.10k|  }
  786|       |
  787|       |  /* If the blocksize is not a multiple of both the typesize and
  788|       |     the vector size, round the blocksize down to the next value
  789|       |     which is a multiple of both. The vectorized unshuffle can be
  790|       |     used for that portion of the data, and the naive implementation
  791|       |     can be used for the remaining portion. */
  792|    323|  const int32_t vectorizable_bytes = blocksize - (blocksize % vectorized_chunk_size);
  793|       |
  794|    323|  const int32_t vectorizable_elements = vectorizable_bytes / bytesoftype;
  795|    323|  const int32_t total_elements = blocksize / bytesoftype;
  796|       |
  797|       |  /* Optimized unshuffle implementations */
  798|    323|  switch (bytesoftype) {
  799|     47|    case 2:
  ------------------
  |  Branch (799:5): [True: 47, False: 276]
  ------------------
  800|     47|      unshuffle2_avx2(_dest, _src, vectorizable_elements, total_elements);
  801|     47|      break;
  802|     73|    case 4:
  ------------------
  |  Branch (802:5): [True: 73, False: 250]
  ------------------
  803|     73|      unshuffle4_avx2(_dest, _src, vectorizable_elements, total_elements);
  804|     73|      break;
  805|     62|    case 8:
  ------------------
  |  Branch (805:5): [True: 62, False: 261]
  ------------------
  806|     62|      unshuffle8_avx2(_dest, _src, vectorizable_elements, total_elements);
  807|     62|      break;
  808|      4|    case 12:
  ------------------
  |  Branch (808:5): [True: 4, False: 319]
  ------------------
  809|      4|      unshuffle12_avx2(_dest, _src, vectorizable_elements, total_elements);
  810|      4|      break;
  811|     17|    case 16:
  ------------------
  |  Branch (811:5): [True: 17, False: 306]
  ------------------
  812|     17|      unshuffle16_avx2(_dest, _src, vectorizable_elements, total_elements);
  813|     17|      break;
  814|    120|    default:
  ------------------
  |  Branch (814:5): [True: 120, False: 203]
  ------------------
  815|       |      /* For types larger than 16 bytes, use the AVX2 tiled unshuffle. */
  816|    120|      if (bytesoftype > (int32_t)sizeof(__m128i)) {
  ------------------
  |  Branch (816:11): [True: 80, False: 40]
  ------------------
  817|     80|        unshuffle16_tiled_avx2(_dest, _src, vectorizable_elements, total_elements, bytesoftype);
  818|     80|      }
  819|     40|      else {
  820|       |        /* Non-optimized unshuffle */
  821|     40|        unshuffle_generic(bytesoftype, blocksize, _src, _dest);
  822|       |        /* The non-optimized function covers the whole buffer,
  823|       |           so we're done processing here. */
  824|     40|        return;
  825|     40|      }
  826|    323|  }
  827|       |
  828|       |  /* If the buffer had any bytes at the end which couldn't be handled
  829|       |     by the vectorized implementations, use the non-optimized version
  830|       |     to finish them up. */
  831|    283|  if (vectorizable_bytes < blocksize) {
  ------------------
  |  Branch (831:7): [True: 193, False: 90]
  ------------------
  832|    193|    unshuffle_generic_inline(bytesoftype, vectorizable_bytes, blocksize, _src, _dest);
  833|    193|  }
  834|    283|}
shuffle-avx2.c:shuffle4_avx2:
   98|     10|              const int32_t vectorizable_elements, const int32_t total_elements) {
   99|     10|  static const int32_t bytesoftype = 4;
  100|     10|  int32_t i;
  101|     10|  int j;
  102|     10|  __m256i ymm0[4], ymm1[4];
  103|       |
  104|       |  /* Create the shuffle mask.
  105|       |     NOTE: The XMM/YMM 'set' intrinsics require the arguments to be ordered from
  106|       |     most to least significant (i.e., their order is reversed when compared to
  107|       |     loading the mask from an array). */
  108|     10|  const __m256i shmask = _mm256_set_epi8(
  109|     10|      0x0f, 0x0b, 0x07, 0x03, 0x0e, 0x0a, 0x06, 0x02,
  110|     10|      0x0d, 0x09, 0x05, 0x01, 0x0c, 0x08, 0x04, 0x00,
  111|     10|      0x0f, 0x0b, 0x07, 0x03, 0x0e, 0x0a, 0x06, 0x02,
  112|     10|      0x0d, 0x09, 0x05, 0x01, 0x0c, 0x08, 0x04, 0x00);
  113|     10|  const __m256i mask = _mm256_set_epi32(
  114|     10|      0x07, 0x03, 0x06, 0x02, 0x05, 0x01, 0x04, 0x00);
  115|       |
  116|     78|  for (i = 0; i < vectorizable_elements; i += sizeof(__m256i)) {
  ------------------
  |  Branch (116:15): [True: 68, False: 10]
  ------------------
  117|       |    /* Fetch 32 elements (128 bytes) then transpose bytes and words within 128-bit lanes. */
  118|    340|    for (j = 0; j < 4; j++) {
  ------------------
  |  Branch (118:17): [True: 272, False: 68]
  ------------------
  119|    272|      ymm0[j] = _mm256_shuffle_epi8(
  120|    272|          _mm256_loadu_si256((__m256i*)(src + (i * bytesoftype) + (j * sizeof(__m256i)))),
  121|    272|          shmask);
  122|    272|    }
  123|       |    /* Transpose double words */
  124|    204|    for (j = 0; j < 2; j++) {
  ------------------
  |  Branch (124:17): [True: 136, False: 68]
  ------------------
  125|    136|      ymm1[j * 2] = _mm256_unpacklo_epi32(ymm0[j * 2], ymm0[j * 2 + 1]);
  126|    136|      ymm1[j * 2 + 1] = _mm256_unpackhi_epi32(ymm0[j * 2], ymm0[j * 2 + 1]);
  127|    136|    }
  128|       |    /* Transpose quad words */
  129|    204|    for (j = 0; j < 2; j++) {
  ------------------
  |  Branch (129:17): [True: 136, False: 68]
  ------------------
  130|    136|      ymm0[j * 2] = _mm256_unpacklo_epi64(ymm1[j], ymm1[j + 2]);
  131|    136|      ymm0[j * 2 + 1] = _mm256_unpackhi_epi64(ymm1[j], ymm1[j + 2]);
  132|    136|    }
  133|    340|    for (j = 0; j < 4; j++) {
  ------------------
  |  Branch (133:17): [True: 272, False: 68]
  ------------------
  134|    272|      ymm0[j] = _mm256_permutevar8x32_epi32(ymm0[j], mask);
  135|    272|    }
  136|       |    /* Store the result vectors */
  137|     68|    uint8_t* const dest_for_ith_element = dest + i;
  138|    340|    for (j = 0; j < 4; j++) {
  ------------------
  |  Branch (138:17): [True: 272, False: 68]
  ------------------
  139|    272|      _mm256_storeu_si256((__m256i*)(dest_for_ith_element + (j * total_elements)), ymm0[j]);
  140|    272|    }
  141|     68|  }
  142|     10|}
shuffle-avx2.c:unshuffle2_avx2:
  331|     47|                const int32_t vectorizable_elements, const int32_t total_elements) {
  332|     47|  static const int32_t bytesoftype = 2;
  333|     47|  int32_t i;
  334|     47|  int j;
  335|     47|  __m256i ymm0[2], ymm1[2];
  336|       |
  337|  18.6M|  for (i = 0; i < vectorizable_elements; i += sizeof(__m256i)) {
  ------------------
  |  Branch (337:15): [True: 18.6M, False: 47]
  ------------------
  338|       |    /* Load 32 elements (64 bytes) into 2 YMM registers. */
  339|  18.6M|    const uint8_t* const src_for_ith_element = src + i;
  340|  56.0M|    for (j = 0; j < 2; j++) {
  ------------------
  |  Branch (340:17): [True: 37.3M, False: 18.6M]
  ------------------
  341|  37.3M|      ymm0[j] = _mm256_loadu_si256((__m256i*)(src_for_ith_element + (j * total_elements)));
  342|  37.3M|    }
  343|       |    /* Shuffle bytes */
  344|  56.0M|    for (j = 0; j < 2; j++) {
  ------------------
  |  Branch (344:17): [True: 37.3M, False: 18.6M]
  ------------------
  345|  37.3M|      ymm0[j] = _mm256_permute4x64_epi64(ymm0[j], 0xd8);
  346|  37.3M|    }
  347|       |    /* Compute the low 64 bytes */
  348|  18.6M|    ymm1[0] = _mm256_unpacklo_epi8(ymm0[0], ymm0[1]);
  349|       |    /* Compute the hi 64 bytes */
  350|  18.6M|    ymm1[1] = _mm256_unpackhi_epi8(ymm0[0], ymm0[1]);
  351|       |    /* Store the result vectors in proper order */
  352|  18.6M|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (0 * sizeof(__m256i))), ymm1[0]);
  353|  18.6M|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (1 * sizeof(__m256i))), ymm1[1]);
  354|  18.6M|  }
  355|     47|}
shuffle-avx2.c:unshuffle4_avx2:
  360|     73|                const int32_t vectorizable_elements, const int32_t total_elements) {
  361|     73|  static const int32_t bytesoftype = 4;
  362|     73|  int32_t i;
  363|     73|  int j;
  364|     73|  __m256i ymm0[4], ymm1[4];
  365|       |
  366|  27.6M|  for (i = 0; i < vectorizable_elements; i += sizeof(__m256i)) {
  ------------------
  |  Branch (366:15): [True: 27.6M, False: 73]
  ------------------
  367|       |    /* Load 32 elements (128 bytes) into 4 YMM registers. */
  368|  27.6M|    const uint8_t* const src_for_ith_element = src + i;
  369|   138M|    for (j = 0; j < 4; j++) {
  ------------------
  |  Branch (369:17): [True: 110M, False: 27.6M]
  ------------------
  370|   110M|      ymm0[j] = _mm256_loadu_si256((__m256i*)(src_for_ith_element + (j * total_elements)));
  371|   110M|    }
  372|       |    /* Shuffle bytes */
  373|  82.9M|    for (j = 0; j < 2; j++) {
  ------------------
  |  Branch (373:17): [True: 55.2M, False: 27.6M]
  ------------------
  374|       |      /* Compute the low 64 bytes */
  375|  55.2M|      ymm1[j] = _mm256_unpacklo_epi8(ymm0[j * 2], ymm0[j * 2 + 1]);
  376|       |      /* Compute the hi 64 bytes */
  377|  55.2M|      ymm1[2 + j] = _mm256_unpackhi_epi8(ymm0[j * 2], ymm0[j * 2 + 1]);
  378|  55.2M|    }
  379|       |    /* Shuffle 2-byte words */
  380|  82.9M|    for (j = 0; j < 2; j++) {
  ------------------
  |  Branch (380:17): [True: 55.2M, False: 27.6M]
  ------------------
  381|       |      /* Compute the low 64 bytes */
  382|  55.2M|      ymm0[j] = _mm256_unpacklo_epi16(ymm1[j * 2], ymm1[j * 2 + 1]);
  383|       |      /* Compute the hi 64 bytes */
  384|  55.2M|      ymm0[2 + j] = _mm256_unpackhi_epi16(ymm1[j * 2], ymm1[j * 2 + 1]);
  385|  55.2M|    }
  386|  27.6M|    ymm1[0] = _mm256_permute2x128_si256(ymm0[0], ymm0[2], 0x20);
  387|  27.6M|    ymm1[1] = _mm256_permute2x128_si256(ymm0[1], ymm0[3], 0x20);
  388|  27.6M|    ymm1[2] = _mm256_permute2x128_si256(ymm0[0], ymm0[2], 0x31);
  389|  27.6M|    ymm1[3] = _mm256_permute2x128_si256(ymm0[1], ymm0[3], 0x31);
  390|       |
  391|       |    /* Store the result vectors in proper order */
  392|   138M|    for (j = 0; j < 4; j++) {
  ------------------
  |  Branch (392:17): [True: 110M, False: 27.6M]
  ------------------
  393|   110M|      _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (j * sizeof(__m256i))), ymm1[j]);
  394|   110M|    }
  395|  27.6M|  }
  396|     73|}
shuffle-avx2.c:unshuffle8_avx2:
  401|     62|                const int32_t vectorizable_elements, const int32_t total_elements) {
  402|     62|  static const int32_t bytesoftype = 8;
  403|     62|  int32_t i;
  404|     62|  int j;
  405|     62|  __m256i ymm0[8], ymm1[8];
  406|       |
  407|  5.22M|  for (i = 0; i < vectorizable_elements; i += sizeof(__m256i)) {
  ------------------
  |  Branch (407:15): [True: 5.22M, False: 62]
  ------------------
  408|       |    /* Fetch 32 elements (256 bytes) into 8 YMM registers. */
  409|  5.22M|    const uint8_t* const src_for_ith_element = src + i;
  410|  47.0M|    for (j = 0; j < 8; j++) {
  ------------------
  |  Branch (410:17): [True: 41.7M, False: 5.22M]
  ------------------
  411|  41.7M|      ymm0[j] = _mm256_loadu_si256((__m256i*)(src_for_ith_element + (j * total_elements)));
  412|  41.7M|    }
  413|       |    /* Shuffle bytes */
  414|  26.1M|    for (j = 0; j < 4; j++) {
  ------------------
  |  Branch (414:17): [True: 20.8M, False: 5.22M]
  ------------------
  415|       |      /* Compute the low 32 bytes */
  416|  20.8M|      ymm1[j] = _mm256_unpacklo_epi8(ymm0[j * 2], ymm0[j * 2 + 1]);
  417|       |      /* Compute the hi 32 bytes */
  418|  20.8M|      ymm1[4 + j] = _mm256_unpackhi_epi8(ymm0[j * 2], ymm0[j * 2 + 1]);
  419|  20.8M|    }
  420|       |    /* Shuffle words */
  421|  26.1M|    for (j = 0; j < 4; j++) {
  ------------------
  |  Branch (421:17): [True: 20.8M, False: 5.22M]
  ------------------
  422|       |      /* Compute the low 32 bytes */
  423|  20.8M|      ymm0[j] = _mm256_unpacklo_epi16(ymm1[j * 2], ymm1[j * 2 + 1]);
  424|       |      /* Compute the hi 32 bytes */
  425|  20.8M|      ymm0[4 + j] = _mm256_unpackhi_epi16(ymm1[j * 2], ymm1[j * 2 + 1]);
  426|  20.8M|    }
  427|  47.0M|    for (j = 0; j < 8; j++) {
  ------------------
  |  Branch (427:17): [True: 41.7M, False: 5.22M]
  ------------------
  428|  41.7M|      ymm0[j] = _mm256_permute4x64_epi64(ymm0[j], 0xd8);
  429|  41.7M|    }
  430|       |
  431|       |    /* Shuffle 4-byte dwords */
  432|  26.1M|    for (j = 0; j < 4; j++) {
  ------------------
  |  Branch (432:17): [True: 20.8M, False: 5.22M]
  ------------------
  433|       |      /* Compute the low 32 bytes */
  434|  20.8M|      ymm1[j] = _mm256_unpacklo_epi32(ymm0[j * 2], ymm0[j * 2 + 1]);
  435|       |      /* Compute the hi 32 bytes */
  436|  20.8M|      ymm1[4 + j] = _mm256_unpackhi_epi32(ymm0[j * 2], ymm0[j * 2 + 1]);
  437|  20.8M|    }
  438|       |
  439|       |    /* Store the result vectors in proper order */
  440|  5.22M|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (0 * sizeof(__m256i))), ymm1[0]);
  441|  5.22M|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (1 * sizeof(__m256i))), ymm1[2]);
  442|  5.22M|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (2 * sizeof(__m256i))), ymm1[1]);
  443|  5.22M|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (3 * sizeof(__m256i))), ymm1[3]);
  444|  5.22M|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (4 * sizeof(__m256i))), ymm1[4]);
  445|  5.22M|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (5 * sizeof(__m256i))), ymm1[6]);
  446|  5.22M|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (6 * sizeof(__m256i))), ymm1[5]);
  447|  5.22M|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (7 * sizeof(__m256i))), ymm1[7]);
  448|  5.22M|  }
  449|     62|}
shuffle-avx2.c:unshuffle12_avx2:
  526|      4|    const int32_t vectorizable_elements, const int32_t total_elements) {
  527|      4|  static const int32_t bytesoftype = 12;
  528|      4|  int32_t i;
  529|      4|  int j;
  530|      4|  __m256i ymm0[16], ymm1[16];
  531|       |
  532|      4|  __m256i permute = _mm256_set_epi32(0,0,6,5,4,2,1,0);
  533|      4|  __m256i store_mask = _mm256_set_epi32(0x0, 0x0, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF);
  534|      4|  int32_t jump = 2*bytesoftype;
  535|     12|  for (i = 0; i < vectorizable_elements; i += sizeof(__m256i)) {
  ------------------
  |  Branch (535:15): [True: 8, False: 4]
  ------------------
  536|       |    /* Fetch 24 elements (384 bytes) into 12 YMM registers. */
  537|      8|    const uint8_t* const src_for_ith_element = src + i;
  538|    104|    for (j = 0; j < bytesoftype; j++) {
  ------------------
  |  Branch (538:17): [True: 96, False: 8]
  ------------------
  539|     96|      ymm0[j] = _mm256_loadu_si256((__m256i*)(src_for_ith_element + (j * total_elements)));
  540|     96|    }
  541|       |    /* Initialize the last 4 registers (128 bytes) to null */
  542|     40|    for (j = bytesoftype; j < 16; j++) {
  ------------------
  |  Branch (542:27): [True: 32, False: 8]
  ------------------
  543|     32|      ymm0[j] = _mm256_setzero_si256();
  544|     32|    }
  545|       |
  546|       |    /* Shuffle bytes */
  547|     72|    for (j = 0; j < 8; j++) {
  ------------------
  |  Branch (547:17): [True: 64, False: 8]
  ------------------
  548|       |      /* Compute the low 32 bytes */
  549|     64|      ymm1[j] = _mm256_unpacklo_epi8(ymm0[j * 2], ymm0[j * 2 + 1]);
  550|       |      /* Compute the hi 32 bytes */
  551|     64|      ymm1[8 + j] = _mm256_unpackhi_epi8(ymm0[j * 2], ymm0[j * 2 + 1]);
  552|     64|    }
  553|       |    /* Shuffle 2-byte words */
  554|     72|    for (j = 0; j < 8; j++) {
  ------------------
  |  Branch (554:17): [True: 64, False: 8]
  ------------------
  555|       |      /* Compute the low 32 bytes */
  556|     64|      ymm0[j] = _mm256_unpacklo_epi16(ymm1[j * 2], ymm1[j * 2 + 1]);
  557|       |      /* Compute the hi 32 bytes */
  558|     64|      ymm0[8 + j] = _mm256_unpackhi_epi16(ymm1[j * 2], ymm1[j * 2 + 1]);
  559|     64|    }
  560|       |    /* Shuffle 4-byte dwords */
  561|     72|    for (j = 0; j < 8; j++) {
  ------------------
  |  Branch (561:17): [True: 64, False: 8]
  ------------------
  562|       |      /* Compute the low 32 bytes */
  563|     64|      ymm1[j] = _mm256_unpacklo_epi32(ymm0[j * 2], ymm0[j * 2 + 1]);
  564|       |      /* Compute the hi 32 bytes */
  565|     64|      ymm1[8 + j] = _mm256_unpackhi_epi32(ymm0[j * 2], ymm0[j * 2 + 1]);
  566|     64|    }
  567|       |
  568|       |    /* Shuffle 8-byte qwords */
  569|     72|    for (j = 0; j < 8; j++) {
  ------------------
  |  Branch (569:17): [True: 64, False: 8]
  ------------------
  570|       |      /* Compute the low 32 bytes */
  571|     64|      ymm0[j] = _mm256_unpacklo_epi64(ymm1[j * 2], ymm1[j * 2 + 1]);
  572|       |      /* Compute the hi 32 bytes */
  573|     64|      ymm0[8 + j] = _mm256_unpackhi_epi64(ymm1[j * 2], ymm1[j * 2 + 1]);
  574|     64|    }
  575|       |
  576|       |
  577|     72|    for (j = 0; j < 8; j++) {
  ------------------
  |  Branch (577:17): [True: 64, False: 8]
  ------------------
  578|     64|      ymm1[j] = _mm256_permute2x128_si256(ymm0[j], ymm0[j + 8], 0x20);
  579|     64|      ymm1[j + 8] = _mm256_permute2x128_si256(ymm0[j], ymm0[j + 8], 0x31);
  580|     64|      ymm1[j] = _mm256_permutevar8x32_epi32(ymm1[j], permute);
  581|     64|      ymm1[j+8] = _mm256_permutevar8x32_epi32(ymm1[j+8], permute);
  582|       |
  583|       |
  584|     64|    }
  585|      8|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (0 * jump)), ymm1[0]);
  586|      8|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (1 * jump)), ymm1[4]);
  587|      8|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (2 * jump)), ymm1[2]);
  588|      8|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (3 * jump)), ymm1[6]);
  589|      8|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (4 * jump)), ymm1[1]);
  590|      8|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (5 * jump)), ymm1[5]);
  591|      8|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (6 * jump)), ymm1[3]);
  592|      8|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (7 * jump)), ymm1[7]);
  593|      8|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (8 * jump)), ymm1[8]);
  594|      8|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (9 * jump)), ymm1[12]);
  595|      8|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (10 * jump)), ymm1[10]);
  596|      8|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (11 * jump)), ymm1[14]);
  597|      8|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (12 * jump)), ymm1[9]);
  598|      8|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (13 * jump)), ymm1[13]);
  599|      8|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (14 * jump)), ymm1[11]);
  600|      8|    _mm256_maskstore_epi32((int *)(dest + (i * bytesoftype) + (15 * jump)), store_mask, ymm1[15]);
  601|      8|  }
  602|      4|}
shuffle-avx2.c:unshuffle16_avx2:
  454|     17|                 const int32_t vectorizable_elements, const int32_t total_elements) {
  455|     17|  static const int32_t bytesoftype = 16;
  456|     17|  int32_t i;
  457|     17|  int j;
  458|     17|  __m256i ymm0[16], ymm1[16];
  459|       |
  460|   255k|  for (i = 0; i < vectorizable_elements; i += sizeof(__m256i)) {
  ------------------
  |  Branch (460:15): [True: 255k, False: 17]
  ------------------
  461|       |    /* Fetch 32 elements (512 bytes) into 16 YMM registers. */
  462|   255k|    const uint8_t* const src_for_ith_element = src + i;
  463|  4.34M|    for (j = 0; j < 16; j++) {
  ------------------
  |  Branch (463:17): [True: 4.08M, False: 255k]
  ------------------
  464|  4.08M|      ymm0[j] = _mm256_loadu_si256((__m256i*)(src_for_ith_element + (j * total_elements)));
  465|  4.08M|    }
  466|       |
  467|       |    /* Shuffle bytes */
  468|  2.29M|    for (j = 0; j < 8; j++) {
  ------------------
  |  Branch (468:17): [True: 2.04M, False: 255k]
  ------------------
  469|       |      /* Compute the low 32 bytes */
  470|  2.04M|      ymm1[j] = _mm256_unpacklo_epi8(ymm0[j * 2], ymm0[j * 2 + 1]);
  471|       |      /* Compute the hi 32 bytes */
  472|  2.04M|      ymm1[8 + j] = _mm256_unpackhi_epi8(ymm0[j * 2], ymm0[j * 2 + 1]);
  473|  2.04M|    }
  474|       |    /* Shuffle 2-byte words */
  475|  2.29M|    for (j = 0; j < 8; j++) {
  ------------------
  |  Branch (475:17): [True: 2.04M, False: 255k]
  ------------------
  476|       |      /* Compute the low 32 bytes */
  477|  2.04M|      ymm0[j] = _mm256_unpacklo_epi16(ymm1[j * 2], ymm1[j * 2 + 1]);
  478|       |      /* Compute the hi 32 bytes */
  479|  2.04M|      ymm0[8 + j] = _mm256_unpackhi_epi16(ymm1[j * 2], ymm1[j * 2 + 1]);
  480|  2.04M|    }
  481|       |    /* Shuffle 4-byte dwords */
  482|  2.29M|    for (j = 0; j < 8; j++) {
  ------------------
  |  Branch (482:17): [True: 2.04M, False: 255k]
  ------------------
  483|       |      /* Compute the low 32 bytes */
  484|  2.04M|      ymm1[j] = _mm256_unpacklo_epi32(ymm0[j * 2], ymm0[j * 2 + 1]);
  485|       |      /* Compute the hi 32 bytes */
  486|  2.04M|      ymm1[8 + j] = _mm256_unpackhi_epi32(ymm0[j * 2], ymm0[j * 2 + 1]);
  487|  2.04M|    }
  488|       |
  489|       |    /* Shuffle 8-byte qwords */
  490|  2.29M|    for (j = 0; j < 8; j++) {
  ------------------
  |  Branch (490:17): [True: 2.04M, False: 255k]
  ------------------
  491|       |      /* Compute the low 32 bytes */
  492|  2.04M|      ymm0[j] = _mm256_unpacklo_epi64(ymm1[j * 2], ymm1[j * 2 + 1]);
  493|       |      /* Compute the hi 32 bytes */
  494|  2.04M|      ymm0[8 + j] = _mm256_unpackhi_epi64(ymm1[j * 2], ymm1[j * 2 + 1]);
  495|  2.04M|    }
  496|       |
  497|  2.29M|    for (j = 0; j < 8; j++) {
  ------------------
  |  Branch (497:17): [True: 2.04M, False: 255k]
  ------------------
  498|  2.04M|      ymm1[j] = _mm256_permute2x128_si256(ymm0[j], ymm0[j + 8], 0x20);
  499|  2.04M|      ymm1[j + 8] = _mm256_permute2x128_si256(ymm0[j], ymm0[j + 8], 0x31);
  500|  2.04M|    }
  501|       |
  502|       |    /* Store the result vectors in proper order */
  503|   255k|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (0 * sizeof(__m256i))), ymm1[0]);
  504|   255k|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (1 * sizeof(__m256i))), ymm1[4]);
  505|   255k|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (2 * sizeof(__m256i))), ymm1[2]);
  506|   255k|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (3 * sizeof(__m256i))), ymm1[6]);
  507|   255k|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (4 * sizeof(__m256i))), ymm1[1]);
  508|   255k|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (5 * sizeof(__m256i))), ymm1[5]);
  509|   255k|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (6 * sizeof(__m256i))), ymm1[3]);
  510|   255k|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (7 * sizeof(__m256i))), ymm1[7]);
  511|   255k|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (8 * sizeof(__m256i))), ymm1[8]);
  512|   255k|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (9 * sizeof(__m256i))), ymm1[12]);
  513|   255k|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (10 * sizeof(__m256i))), ymm1[10]);
  514|   255k|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (11 * sizeof(__m256i))), ymm1[14]);
  515|   255k|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (12 * sizeof(__m256i))), ymm1[9]);
  516|   255k|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (13 * sizeof(__m256i))), ymm1[13]);
  517|   255k|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (14 * sizeof(__m256i))), ymm1[11]);
  518|   255k|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (15 * sizeof(__m256i))), ymm1[15]);
  519|   255k|  }
  520|     17|}
shuffle-avx2.c:unshuffle16_tiled_avx2:
  606|     80|                       const int32_t vectorizable_elements, const int32_t total_elements, const int32_t bytesoftype) {
  607|     80|  int32_t i;
  608|     80|  int j;
  609|     80|  __m256i ymm0[16], ymm1[16];
  610|       |
  611|     80|  const lldiv_t vecs_per_el = lldiv(bytesoftype, sizeof(__m128i));
  612|     80|  const int32_t vecs_rem = (int32_t)vecs_per_el.rem;
  613|       |
  614|       |  /* The unshuffle loops are inverted (compared to shuffle_tiled16_avx2)
  615|       |     to optimize cache utilization. */
  616|     80|  int32_t offset_into_type;
  617|    701|  for (offset_into_type = 0; offset_into_type < bytesoftype;
  ------------------
  |  Branch (617:30): [True: 621, False: 80]
  ------------------
  618|    621|       offset_into_type += (offset_into_type == 0 && vecs_rem > 0 ? vecs_rem : (int32_t)sizeof(__m128i))) {
  ------------------
  |  Branch (618:29): [True: 80, False: 541]
  |  Branch (618:54): [True: 65, False: 15]
  ------------------
  619|  2.99M|    for (i = 0; i < vectorizable_elements; i += sizeof(__m256i)) {
  ------------------
  |  Branch (619:17): [True: 2.99M, False: 621]
  ------------------
  620|       |      /* Load the first 16 bytes of 32 adjacent elements (512 bytes) into 16 YMM registers */
  621|  2.99M|      const uint8_t* const src_for_ith_element = src + i;
  622|  50.9M|      for (j = 0; j < 16; j++) {
  ------------------
  |  Branch (622:19): [True: 47.9M, False: 2.99M]
  ------------------
  623|  47.9M|        ymm0[j] = _mm256_loadu_si256((__m256i*)(src_for_ith_element + (total_elements * (offset_into_type + j))));
  624|  47.9M|      }
  625|       |
  626|       |      /* Shuffle bytes */
  627|  26.9M|      for (j = 0; j < 8; j++) {
  ------------------
  |  Branch (627:19): [True: 23.9M, False: 2.99M]
  ------------------
  628|       |        /* Compute the low 32 bytes */
  629|  23.9M|        ymm1[j] = _mm256_unpacklo_epi8(ymm0[j * 2], ymm0[j * 2 + 1]);
  630|       |        /* Compute the hi 32 bytes */
  631|  23.9M|        ymm1[8 + j] = _mm256_unpackhi_epi8(ymm0[j * 2], ymm0[j * 2 + 1]);
  632|  23.9M|      }
  633|       |      /* Shuffle 2-byte words */
  634|  26.9M|      for (j = 0; j < 8; j++) {
  ------------------
  |  Branch (634:19): [True: 23.9M, False: 2.99M]
  ------------------
  635|       |        /* Compute the low 32 bytes */
  636|  23.9M|        ymm0[j] = _mm256_unpacklo_epi16(ymm1[j * 2], ymm1[j * 2 + 1]);
  637|       |        /* Compute the hi 32 bytes */
  638|  23.9M|        ymm0[8 + j] = _mm256_unpackhi_epi16(ymm1[j * 2], ymm1[j * 2 + 1]);
  639|  23.9M|      }
  640|       |      /* Shuffle 4-byte dwords */
  641|  26.9M|      for (j = 0; j < 8; j++) {
  ------------------
  |  Branch (641:19): [True: 23.9M, False: 2.99M]
  ------------------
  642|       |        /* Compute the low 32 bytes */
  643|  23.9M|        ymm1[j] = _mm256_unpacklo_epi32(ymm0[j * 2], ymm0[j * 2 + 1]);
  644|       |        /* Compute the hi 32 bytes */
  645|  23.9M|        ymm1[8 + j] = _mm256_unpackhi_epi32(ymm0[j * 2], ymm0[j * 2 + 1]);
  646|  23.9M|      }
  647|       |
  648|       |      /* Shuffle 8-byte qwords */
  649|  26.9M|      for (j = 0; j < 8; j++) {
  ------------------
  |  Branch (649:19): [True: 23.9M, False: 2.99M]
  ------------------
  650|       |        /* Compute the low 32 bytes */
  651|  23.9M|        ymm0[j] = _mm256_unpacklo_epi64(ymm1[j * 2], ymm1[j * 2 + 1]);
  652|       |        /* Compute the hi 32 bytes */
  653|  23.9M|        ymm0[8 + j] = _mm256_unpackhi_epi64(ymm1[j * 2], ymm1[j * 2 + 1]);
  654|  23.9M|      }
  655|       |
  656|  26.9M|      for (j = 0; j < 8; j++) {
  ------------------
  |  Branch (656:19): [True: 23.9M, False: 2.99M]
  ------------------
  657|  23.9M|        ymm1[j] = _mm256_permute2x128_si256(ymm0[j], ymm0[j + 8], 0x20);
  658|  23.9M|        ymm1[j + 8] = _mm256_permute2x128_si256(ymm0[j], ymm0[j + 8], 0x31);
  659|  23.9M|      }
  660|       |
  661|       |      /* Store the result vectors in proper order */
  662|  2.99M|      const uint8_t* const dest_with_offset = dest + offset_into_type;
  663|  2.99M|      _mm256_storeu2_m128i(
  664|  2.99M|          (__m128i*)(dest_with_offset + (i + 0x01) * bytesoftype),
  665|  2.99M|          (__m128i*)(dest_with_offset + (i + 0x00) * bytesoftype), ymm1[0]);
  666|  2.99M|      _mm256_storeu2_m128i(
  667|  2.99M|          (__m128i*)(dest_with_offset + (i + 0x03) * bytesoftype),
  668|  2.99M|          (__m128i*)(dest_with_offset + (i + 0x02) * bytesoftype), ymm1[4]);
  669|  2.99M|      _mm256_storeu2_m128i(
  670|  2.99M|          (__m128i*)(dest_with_offset + (i + 0x05) * bytesoftype),
  671|  2.99M|          (__m128i*)(dest_with_offset + (i + 0x04) * bytesoftype), ymm1[2]);
  672|  2.99M|      _mm256_storeu2_m128i(
  673|  2.99M|          (__m128i*)(dest_with_offset + (i + 0x07) * bytesoftype),
  674|  2.99M|          (__m128i*)(dest_with_offset + (i + 0x06) * bytesoftype), ymm1[6]);
  675|  2.99M|      _mm256_storeu2_m128i(
  676|  2.99M|          (__m128i*)(dest_with_offset + (i + 0x09) * bytesoftype),
  677|  2.99M|          (__m128i*)(dest_with_offset + (i + 0x08) * bytesoftype), ymm1[1]);
  678|  2.99M|      _mm256_storeu2_m128i(
  679|  2.99M|          (__m128i*)(dest_with_offset + (i + 0x0b) * bytesoftype),
  680|  2.99M|          (__m128i*)(dest_with_offset + (i + 0x0a) * bytesoftype), ymm1[5]);
  681|  2.99M|      _mm256_storeu2_m128i(
  682|  2.99M|          (__m128i*)(dest_with_offset + (i + 0x0d) * bytesoftype),
  683|  2.99M|          (__m128i*)(dest_with_offset + (i + 0x0c) * bytesoftype), ymm1[3]);
  684|  2.99M|      _mm256_storeu2_m128i(
  685|  2.99M|          (__m128i*)(dest_with_offset + (i + 0x0f) * bytesoftype),
  686|  2.99M|          (__m128i*)(dest_with_offset + (i + 0x0e) * bytesoftype), ymm1[7]);
  687|  2.99M|      _mm256_storeu2_m128i(
  688|  2.99M|          (__m128i*)(dest_with_offset + (i + 0x11) * bytesoftype),
  689|  2.99M|          (__m128i*)(dest_with_offset + (i + 0x10) * bytesoftype), ymm1[8]);
  690|  2.99M|      _mm256_storeu2_m128i(
  691|  2.99M|          (__m128i*)(dest_with_offset + (i + 0x13) * bytesoftype),
  692|  2.99M|          (__m128i*)(dest_with_offset + (i + 0x12) * bytesoftype), ymm1[12]);
  693|  2.99M|      _mm256_storeu2_m128i(
  694|  2.99M|          (__m128i*)(dest_with_offset + (i + 0x15) * bytesoftype),
  695|  2.99M|          (__m128i*)(dest_with_offset + (i + 0x14) * bytesoftype), ymm1[10]);
  696|  2.99M|      _mm256_storeu2_m128i(
  697|  2.99M|          (__m128i*)(dest_with_offset + (i + 0x17) * bytesoftype),
  698|  2.99M|          (__m128i*)(dest_with_offset + (i + 0x16) * bytesoftype), ymm1[14]);
  699|  2.99M|      _mm256_storeu2_m128i(
  700|  2.99M|          (__m128i*)(dest_with_offset + (i + 0x19) * bytesoftype),
  701|  2.99M|          (__m128i*)(dest_with_offset + (i + 0x18) * bytesoftype), ymm1[9]);
  702|  2.99M|      _mm256_storeu2_m128i(
  703|  2.99M|          (__m128i*)(dest_with_offset + (i + 0x1b) * bytesoftype),
  704|  2.99M|          (__m128i*)(dest_with_offset + (i + 0x1a) * bytesoftype), ymm1[13]);
  705|  2.99M|      _mm256_storeu2_m128i(
  706|  2.99M|          (__m128i*)(dest_with_offset + (i + 0x1d) * bytesoftype),
  707|  2.99M|          (__m128i*)(dest_with_offset + (i + 0x1c) * bytesoftype), ymm1[11]);
  708|  2.99M|      _mm256_storeu2_m128i(
  709|  2.99M|          (__m128i*)(dest_with_offset + (i + 0x1f) * bytesoftype),
  710|  2.99M|          (__m128i*)(dest_with_offset + (i + 0x1e) * bytesoftype), ymm1[15]);
  711|  2.99M|    }
  712|    621|  }
  713|     80|}

shuffle_bytedelta_avx2_backward:
  537|     80|int shuffle_bytedelta_avx2_backward(const uint8_t *input, uint8_t *output, int32_t length, int typesize) {
  538|     80|  switch (typesize) {
  539|     29|    case 2: return backward2_avx2(input, output, length);
  ------------------
  |  Branch (539:5): [True: 29, False: 51]
  ------------------
  540|     26|    case 4: return backward4_avx2(input, output, length);
  ------------------
  |  Branch (540:5): [True: 26, False: 54]
  ------------------
  541|     25|    case 8: return backward8_avx2(input, output, length);
  ------------------
  |  Branch (541:5): [True: 25, False: 55]
  ------------------
  542|      0|    default: return 0;
  ------------------
  |  Branch (542:5): [True: 0, False: 80]
  ------------------
  543|     80|  }
  544|     80|}
shuffle-bytedelta-avx2.c:backward2_avx2:
  204|     29|static int backward2_avx2(const uint8_t *input, uint8_t *output, int32_t length) {
  205|     29|  int count = length / 2, vector_count = count / 32 * 32;
  206|       |  /* Shuffle mask broadcasting the 8th 16-bit record (bytes 14..15) in each 128-bit lane. */
  207|     29|  const __m256i mask_hi16 = _mm256_setr_epi8(
  208|     29|      14, 15, 14, 15, 14, 15, 14, 15, 14, 15, 14, 15, 14, 15, 14, 15,
  209|     29|      14, 15, 14, 15, 14, 15, 14, 15, 14, 15, 14, 15, 14, 15, 14, 15);
  210|     29|  const __m128i mask_hi16_128 = _mm256_castsi256_si128(mask_hi16);
  211|     29|  __m128i carry128 = _mm_setzero_si128();
  212|  1.24M|  for (int i = 0; i < vector_count; i += 32) {
  ------------------
  |  Branch (212:19): [True: 1.24M, False: 29]
  ------------------
  213|       |    /* Load 32 delta bytes from each of the 2 byte planes. */
  214|  1.24M|    __m256i p0 = _mm256_loadu_si256((const __m256i *)(input + i));
  215|  1.24M|    __m256i p1 = _mm256_loadu_si256((const __m256i *)(input + count + i));
  216|       |
  217|       |    /* Interleave into 2-byte records: lo lanes hold 0..7 and 8..15, hi lanes 16..23 and 24..31. */
  218|  1.24M|    __m256i r0 = _mm256_unpacklo_epi8(p0, p1);
  219|  1.24M|    __m256i r1 = _mm256_unpackhi_epi8(p0, p1);
  220|       |
  221|       |    /* Kogge-Stone prefix sum across the 8 interleaved 2-byte records in each 128-bit lane. */
  222|  1.24M|    r0 = _mm256_add_epi8(r0, _mm256_slli_si256(r0, 2));
  223|  1.24M|    r1 = _mm256_add_epi8(r1, _mm256_slli_si256(r1, 2));
  224|  1.24M|    r0 = _mm256_add_epi8(r0, _mm256_slli_si256(r0, 4));
  225|  1.24M|    r1 = _mm256_add_epi8(r1, _mm256_slli_si256(r1, 4));
  226|  1.24M|    r0 = _mm256_add_epi8(r0, _mm256_slli_si256(r0, 8));
  227|  1.24M|    r1 = _mm256_add_epi8(r1, _mm256_slli_si256(r1, 8));
  228|       |
  229|       |    /* Propagate each 8-record half-lane total from r0 into r1. */
  230|  1.24M|    r1 = _mm256_add_epi8(r1, _mm256_shuffle_epi8(r0, mask_hi16));
  231|       |
  232|       |    /* Build per-lane tile carry [carry, carry + sum_lo] and advance running carry128. */
  233|  1.24M|    __m128i sum_lo = _mm_shuffle_epi8(_mm256_castsi256_si128(r1), mask_hi16_128);
  234|  1.24M|    __m128i sum_hi = _mm_shuffle_epi8(_mm256_extracti128_si256(r1, 1), mask_hi16_128);
  235|  1.24M|    __m128i carry_hi = _mm_add_epi8(carry128, sum_lo);
  236|  1.24M|    __m256i tile_carry = _mm256_inserti128_si256(_mm256_castsi128_si256(carry128), carry_hi, 1);
  237|  1.24M|    carry128 = _mm_add_epi8(carry128, _mm_add_epi8(sum_lo, sum_hi));
  238|       |
  239|       |    /* Apply incoming cross-tile and cross-lane carry to all 32 records. */
  240|  1.24M|    r0 = _mm256_add_epi8(r0, tile_carry);
  241|  1.24M|    r1 = _mm256_add_epi8(r1, tile_carry);
  242|       |
  243|       |    /* Reorder lanes into two contiguous 32-byte stores (records 0..15, then 16..31). */
  244|  1.24M|    uint8_t *dst = output + i * 2;
  245|  1.24M|    _mm256_storeu_si256((__m256i *)dst, _mm256_permute2x128_si256(r0, r1, 0x20));
  246|  1.24M|    _mm256_storeu_si256((__m256i *)(dst + 32), _mm256_permute2x128_si256(r0, r1, 0x31));
  247|  1.24M|  }
  248|       |  /* Scalar tail for remaining <32 records and any incomplete trailing bytes. */
  249|     29|  uint8_t tail_carry[16];
  250|     29|  _mm_storeu_si128((__m128i *)tail_carry, carry128);
  251|     87|  for (int p = 0; p < 2; p++) {
  ------------------
  |  Branch (251:19): [True: 58, False: 29]
  ------------------
  252|     58|    uint8_t carry = tail_carry[p];
  253|    666|    for (int i = vector_count; i < count; i++) {
  ------------------
  |  Branch (253:32): [True: 608, False: 58]
  ------------------
  254|    608|      carry = (uint8_t)(carry + input[p * count + i]);
  255|    608|      output[i * 2 + p] = carry;
  256|    608|    }
  257|     58|  }
  258|     29|  memcpy(output + count * 2, input + count * 2, (size_t)(length % 2));
  259|     29|  return 1;
  260|     29|}
shuffle-bytedelta-avx2.c:backward4_avx2:
  262|     26|static int backward4_avx2(const uint8_t *input, uint8_t *output, int32_t length) {
  263|     26|  int count = length / 4, vector_count = count / 32 * 32;
  264|     26|  __m128i carry128 = _mm_setzero_si128();
  265|  1.35M|  for (int i = 0; i < vector_count; i += 32) {
  ------------------
  |  Branch (265:19): [True: 1.35M, False: 26]
  ------------------
  266|       |    /* Load 32 delta bytes from each of the 4 byte planes. */
  267|  1.35M|    __m256i p0 = _mm256_loadu_si256((const __m256i *)(input + 0 * count + i));
  268|  1.35M|    __m256i p1 = _mm256_loadu_si256((const __m256i *)(input + 1 * count + i));
  269|  1.35M|    __m256i p2 = _mm256_loadu_si256((const __m256i *)(input + 2 * count + i));
  270|  1.35M|    __m256i p3 = _mm256_loadu_si256((const __m256i *)(input + 3 * count + i));
  271|       |
  272|       |    /* Stage 1 & 2 in-lane transpose: interleave 4 planes into 4-byte records in r0..r3. */
  273|  1.35M|    __m256i a0 = _mm256_unpacklo_epi8(p0, p1);
  274|  1.35M|    __m256i a1 = _mm256_unpackhi_epi8(p0, p1);
  275|  1.35M|    __m256i a2 = _mm256_unpacklo_epi8(p2, p3);
  276|  1.35M|    __m256i a3 = _mm256_unpackhi_epi8(p2, p3);
  277|       |
  278|  1.35M|    __m256i r0 = _mm256_unpacklo_epi16(a0, a2);
  279|  1.35M|    __m256i r1 = _mm256_unpackhi_epi16(a0, a2);
  280|  1.35M|    __m256i r2 = _mm256_unpacklo_epi16(a1, a3);
  281|  1.35M|    __m256i r3 = _mm256_unpackhi_epi16(a1, a3);
  282|       |
  283|       |    /* Prefix sum across the 4 interleaved 4-byte records within each 128-bit lane. */
  284|  1.35M|    r0 = _mm256_add_epi8(r0, _mm256_slli_si256(r0, 4));
  285|  1.35M|    r1 = _mm256_add_epi8(r1, _mm256_slli_si256(r1, 4));
  286|  1.35M|    r2 = _mm256_add_epi8(r2, _mm256_slli_si256(r2, 4));
  287|  1.35M|    r3 = _mm256_add_epi8(r3, _mm256_slli_si256(r3, 4));
  288|       |
  289|  1.35M|    r0 = _mm256_add_epi8(r0, _mm256_slli_si256(r0, 8));
  290|  1.35M|    r1 = _mm256_add_epi8(r1, _mm256_slli_si256(r1, 8));
  291|  1.35M|    r2 = _mm256_add_epi8(r2, _mm256_slli_si256(r2, 8));
  292|  1.35M|    r3 = _mm256_add_epi8(r3, _mm256_slli_si256(r3, 8));
  293|       |
  294|       |    /* Tree-reduce quad totals across r0..r3 to get full 16-record local sums per lane. */
  295|  1.35M|    r1 = _mm256_add_epi8(r1, dup_hi32_256(r0));
  296|  1.35M|    r3 = _mm256_add_epi8(r3, dup_hi32_256(r2));
  297|  1.35M|    __m256i d1 = dup_hi32_256(r1);
  298|  1.35M|    __m256i r3_local = _mm256_add_epi8(r3, d1);
  299|       |
  300|       |    /* Build per-lane tile carry [carry, carry + sum_lo] and advance running carry128. */
  301|  1.35M|    __m128i sum_lo = _mm_shuffle_epi32(_mm256_castsi256_si128(r3_local), 0xff);
  302|  1.35M|    __m128i sum_hi = _mm_shuffle_epi32(_mm256_extracti128_si256(r3_local, 1), 0xff);
  303|  1.35M|    __m128i carry_hi = _mm_add_epi8(carry128, sum_lo);
  304|  1.35M|    __m256i tile_carry = _mm256_inserti128_si256(_mm256_castsi128_si256(carry128), carry_hi, 1);
  305|  1.35M|    carry128 = _mm_add_epi8(carry128, _mm_add_epi8(sum_lo, sum_hi));
  306|       |
  307|       |    /* Fold tile_carry with d1 for r2 and apply carries to all 4 vectors. */
  308|  1.35M|    __m256i d1c = _mm256_add_epi8(d1, tile_carry);
  309|  1.35M|    r0 = _mm256_add_epi8(r0, tile_carry);
  310|  1.35M|    r1 = _mm256_add_epi8(r1, tile_carry);
  311|  1.35M|    r2 = _mm256_add_epi8(r2, d1c);
  312|  1.35M|    r3 = _mm256_add_epi8(r3_local, tile_carry);
  313|       |
  314|       |    /* Reorder lanes into four contiguous 32-byte stores (records 0..31). */
  315|  1.35M|    uint8_t *dst = output + i * 4;
  316|  1.35M|    _mm256_storeu_si256((__m256i *)(dst + 0), _mm256_permute2x128_si256(r0, r1, 0x20));
  317|  1.35M|    _mm256_storeu_si256((__m256i *)(dst + 32), _mm256_permute2x128_si256(r2, r3, 0x20));
  318|  1.35M|    _mm256_storeu_si256((__m256i *)(dst + 64), _mm256_permute2x128_si256(r0, r1, 0x31));
  319|  1.35M|    _mm256_storeu_si256((__m256i *)(dst + 96), _mm256_permute2x128_si256(r2, r3, 0x31));
  320|  1.35M|  }
  321|       |  /* Scalar tail for remaining <32 records and any incomplete trailing bytes. */
  322|     26|  uint8_t tail_carry[16];
  323|     26|  _mm_storeu_si128((__m128i *)tail_carry, carry128);
  324|    130|  for (int p = 0; p < 4; p++) {
  ------------------
  |  Branch (324:19): [True: 104, False: 26]
  ------------------
  325|    104|    uint8_t carry = tail_carry[p];
  326|    744|    for (int i = vector_count; i < count; i++) {
  ------------------
  |  Branch (326:32): [True: 640, False: 104]
  ------------------
  327|    640|      carry = (uint8_t)(carry + input[p * count + i]);
  328|    640|      output[i * 4 + p] = carry;
  329|    640|    }
  330|    104|  }
  331|     26|  memcpy(output + count * 4, input + count * 4, (size_t)(length % 4));
  332|     26|  return 1;
  333|     26|}
shuffle-bytedelta-avx2.c:dup_hi32_256:
   95|  4.82M|static inline __m256i dup_hi32_256(__m256i v) {
   96|       |  /* Broadcast the top 32-bit record of each 128-bit lane across that lane. */
   97|       |  return _mm256_shuffle_epi32(v, 0xff);
   98|  4.82M|}
shuffle-bytedelta-avx2.c:backward8_avx2:
  335|     25|static int backward8_avx2(const uint8_t *input, uint8_t *output, int32_t length) {
  336|     25|  int count = length / 8, vector_count = count / 32 * 32;
  337|     25|  __m128i carry128 = _mm_setzero_si128();
  338|   257k|  for (int i = 0; i < vector_count; i += 32) {
  ------------------
  |  Branch (338:19): [True: 257k, False: 25]
  ------------------
  339|       |    /* Load 32 delta bytes from each of the 8 byte planes. */
  340|   257k|    __m256i p0 = _mm256_loadu_si256((const __m256i *)(input + 0 * count + i));
  341|   257k|    __m256i p1 = _mm256_loadu_si256((const __m256i *)(input + 1 * count + i));
  342|   257k|    __m256i p2 = _mm256_loadu_si256((const __m256i *)(input + 2 * count + i));
  343|   257k|    __m256i p3 = _mm256_loadu_si256((const __m256i *)(input + 3 * count + i));
  344|   257k|    __m256i p4 = _mm256_loadu_si256((const __m256i *)(input + 4 * count + i));
  345|   257k|    __m256i p5 = _mm256_loadu_si256((const __m256i *)(input + 5 * count + i));
  346|   257k|    __m256i p6 = _mm256_loadu_si256((const __m256i *)(input + 6 * count + i));
  347|   257k|    __m256i p7 = _mm256_loadu_si256((const __m256i *)(input + 7 * count + i));
  348|       |
  349|       |    /* Stage 1 (8-bit) transpose of low 4 planes; skip upper 4 planes when all zero. */
  350|   257k|    __m256i a0 = _mm256_unpacklo_epi8(p0, p1);
  351|   257k|    __m256i a1 = _mm256_unpackhi_epi8(p0, p1);
  352|   257k|    __m256i a2 = _mm256_unpacklo_epi8(p2, p3);
  353|   257k|    __m256i a3 = _mm256_unpackhi_epi8(p2, p3);
  354|       |
  355|   257k|    __m256i hi = _mm256_or_si256(_mm256_or_si256(p4, p5), _mm256_or_si256(p6, p7));
  356|   257k|    if (_mm256_testz_si256(hi, hi)) {
  ------------------
  |  Branch (356:9): [True: 257k, False: 12]
  ------------------
  357|   257k|      __m256i b0 = _mm256_unpacklo_epi16(a0, a2);
  358|   257k|      __m256i b1 = _mm256_unpackhi_epi16(a0, a2);
  359|   257k|      __m256i b2 = _mm256_unpacklo_epi16(a1, a3);
  360|   257k|      __m256i b3 = _mm256_unpackhi_epi16(a1, a3);
  361|       |
  362|   257k|      b0 = _mm256_add_epi8(b0, _mm256_slli_si256(b0, 4));
  363|   257k|      b1 = _mm256_add_epi8(b1, _mm256_slli_si256(b1, 4));
  364|   257k|      b2 = _mm256_add_epi8(b2, _mm256_slli_si256(b2, 4));
  365|   257k|      b3 = _mm256_add_epi8(b3, _mm256_slli_si256(b3, 4));
  366|       |
  367|   257k|      b0 = _mm256_add_epi8(b0, _mm256_slli_si256(b0, 8));
  368|   257k|      b1 = _mm256_add_epi8(b1, _mm256_slli_si256(b1, 8));
  369|   257k|      b2 = _mm256_add_epi8(b2, _mm256_slli_si256(b2, 8));
  370|   257k|      b3 = _mm256_add_epi8(b3, _mm256_slli_si256(b3, 8));
  371|       |
  372|   257k|      b1 = _mm256_add_epi8(b1, dup_hi32_256(b0));
  373|   257k|      b3 = _mm256_add_epi8(b3, dup_hi32_256(b2));
  374|   257k|      __m256i d1 = dup_hi32_256(b1);
  375|   257k|      __m256i b3_local = _mm256_add_epi8(b3, d1);
  376|       |
  377|   257k|      __m128i carry_lo128 = _mm_shuffle_epi32(carry128, 0x00);
  378|   257k|      __m128i carry_hi128 = _mm_shuffle_epi32(carry128, 0x55);
  379|   257k|      __m128i sum_lo = _mm_shuffle_epi32(_mm256_castsi256_si128(b3_local), 0xff);
  380|   257k|      __m128i sum_hi = _mm_shuffle_epi32(_mm256_extracti128_si256(b3_local, 1), 0xff);
  381|   257k|      __m128i carry_mid = _mm_add_epi8(carry_lo128, sum_lo);
  382|   257k|      __m256i tile_carry_lo = _mm256_inserti128_si256(
  383|   257k|          _mm256_castsi128_si256(carry_lo128), carry_mid, 1);
  384|   257k|      carry_lo128 = _mm_add_epi8(carry_mid, sum_hi);
  385|   257k|      carry128 = _mm_unpacklo_epi32(carry_lo128, carry_hi128);
  386|       |
  387|   257k|      __m256i d1c = _mm256_add_epi8(d1, tile_carry_lo);
  388|   257k|      b0 = _mm256_add_epi8(b0, tile_carry_lo);
  389|   257k|      b1 = _mm256_add_epi8(b1, tile_carry_lo);
  390|   257k|      b2 = _mm256_add_epi8(b2, d1c);
  391|   257k|      b3 = _mm256_add_epi8(b3_local, tile_carry_lo);
  392|       |
  393|   257k|      __m256i carry_hi256 = _mm256_inserti128_si256(
  394|   257k|          _mm256_castsi128_si256(carry_hi128), carry_hi128, 1);
  395|   257k|      __m256i r0 = _mm256_unpacklo_epi32(b0, carry_hi256);
  396|   257k|      __m256i r1 = _mm256_unpackhi_epi32(b0, carry_hi256);
  397|   257k|      __m256i r2 = _mm256_unpacklo_epi32(b1, carry_hi256);
  398|   257k|      __m256i r3 = _mm256_unpackhi_epi32(b1, carry_hi256);
  399|   257k|      __m256i r4 = _mm256_unpacklo_epi32(b2, carry_hi256);
  400|   257k|      __m256i r5 = _mm256_unpackhi_epi32(b2, carry_hi256);
  401|   257k|      __m256i r6 = _mm256_unpacklo_epi32(b3, carry_hi256);
  402|   257k|      __m256i r7 = _mm256_unpackhi_epi32(b3, carry_hi256);
  403|       |
  404|   257k|      uint8_t *dst = output + i * 8;
  405|   257k|      _mm_storeu_si128((__m128i *)(dst + 0), _mm256_castsi256_si128(r0));
  406|   257k|      _mm_storeu_si128((__m128i *)(dst + 16), _mm256_castsi256_si128(r1));
  407|   257k|      _mm_storeu_si128((__m128i *)(dst + 32), _mm256_castsi256_si128(r2));
  408|   257k|      _mm_storeu_si128((__m128i *)(dst + 48), _mm256_castsi256_si128(r3));
  409|   257k|      _mm_storeu_si128((__m128i *)(dst + 64), _mm256_castsi256_si128(r4));
  410|   257k|      _mm_storeu_si128((__m128i *)(dst + 80), _mm256_castsi256_si128(r5));
  411|   257k|      _mm_storeu_si128((__m128i *)(dst + 96), _mm256_castsi256_si128(r6));
  412|   257k|      _mm_storeu_si128((__m128i *)(dst + 112), _mm256_castsi256_si128(r7));
  413|   257k|      _mm_storeu_si128((__m128i *)(dst + 128), _mm256_extracti128_si256(r0, 1));
  414|   257k|      _mm_storeu_si128((__m128i *)(dst + 144), _mm256_extracti128_si256(r1, 1));
  415|   257k|      _mm_storeu_si128((__m128i *)(dst + 160), _mm256_extracti128_si256(r2, 1));
  416|   257k|      _mm_storeu_si128((__m128i *)(dst + 176), _mm256_extracti128_si256(r3, 1));
  417|   257k|      _mm_storeu_si128((__m128i *)(dst + 192), _mm256_extracti128_si256(r4, 1));
  418|   257k|      _mm_storeu_si128((__m128i *)(dst + 208), _mm256_extracti128_si256(r5, 1));
  419|   257k|      _mm_storeu_si128((__m128i *)(dst + 224), _mm256_extracti128_si256(r6, 1));
  420|   257k|      _mm_storeu_si128((__m128i *)(dst + 240), _mm256_extracti128_si256(r7, 1));
  421|   257k|      continue;
  422|   257k|    }
  423|       |
  424|     12|    __m256i a4 = _mm256_unpacklo_epi8(p4, p5);
  425|     12|    __m256i a5 = _mm256_unpackhi_epi8(p4, p5);
  426|     12|    __m256i a6 = _mm256_unpacklo_epi8(p6, p7);
  427|     12|    __m256i a7 = _mm256_unpackhi_epi8(p6, p7);
  428|       |
  429|     12|    __m256i b0 = _mm256_unpacklo_epi16(a0, a2);
  430|     12|    __m256i b1 = _mm256_unpackhi_epi16(a0, a2);
  431|     12|    __m256i b2 = _mm256_unpacklo_epi16(a1, a3);
  432|     12|    __m256i b3 = _mm256_unpackhi_epi16(a1, a3);
  433|     12|    __m256i b4 = _mm256_unpacklo_epi16(a4, a6);
  434|     12|    __m256i b5 = _mm256_unpackhi_epi16(a4, a6);
  435|     12|    __m256i b6 = _mm256_unpacklo_epi16(a5, a7);
  436|     12|    __m256i b7 = _mm256_unpackhi_epi16(a5, a7);
  437|       |
  438|     12|    __m256i r0 = _mm256_unpacklo_epi32(b0, b4);
  439|     12|    __m256i r1 = _mm256_unpackhi_epi32(b0, b4);
  440|     12|    __m256i r2 = _mm256_unpacklo_epi32(b1, b5);
  441|     12|    __m256i r3 = _mm256_unpackhi_epi32(b1, b5);
  442|     12|    __m256i r4 = _mm256_unpacklo_epi32(b2, b6);
  443|     12|    __m256i r5 = _mm256_unpackhi_epi32(b2, b6);
  444|     12|    __m256i r6 = _mm256_unpacklo_epi32(b3, b7);
  445|     12|    __m256i r7 = _mm256_unpackhi_epi32(b3, b7);
  446|       |
  447|       |    /* Prefix sum depth 1: combine adjacent pairs of 8-byte records within each 128-bit lane. */
  448|     12|    r0 = _mm256_add_epi8(r0, _mm256_slli_si256(r0, 8));
  449|     12|    r1 = _mm256_add_epi8(r1, _mm256_slli_si256(r1, 8));
  450|     12|    r2 = _mm256_add_epi8(r2, _mm256_slli_si256(r2, 8));
  451|     12|    r3 = _mm256_add_epi8(r3, _mm256_slli_si256(r3, 8));
  452|     12|    r4 = _mm256_add_epi8(r4, _mm256_slli_si256(r4, 8));
  453|     12|    r5 = _mm256_add_epi8(r5, _mm256_slli_si256(r5, 8));
  454|     12|    r6 = _mm256_add_epi8(r6, _mm256_slli_si256(r6, 8));
  455|     12|    r7 = _mm256_add_epi8(r7, _mm256_slli_si256(r7, 8));
  456|       |
  457|       |    /* Prefix sum depth 2: combine pairs into 4-record groups. */
  458|     12|    r1 = _mm256_add_epi8(r1, dup_hi64_256(r0));
  459|     12|    r3 = _mm256_add_epi8(r3, dup_hi64_256(r2));
  460|     12|    r5 = _mm256_add_epi8(r5, dup_hi64_256(r4));
  461|     12|    r7 = _mm256_add_epi8(r7, dup_hi64_256(r6));
  462|       |
  463|       |    /* Prefix sum depth 3: combine 4-record groups into 8-record halves. */
  464|     12|    __m256i d1 = dup_hi64_256(r1);
  465|     12|    __m256i d5 = dup_hi64_256(r5);
  466|     12|    r2 = _mm256_add_epi8(r2, d1);
  467|     12|    r3 = _mm256_add_epi8(r3, d1);
  468|     12|    r6 = _mm256_add_epi8(r6, d5);
  469|     12|    r7 = _mm256_add_epi8(r7, d5);
  470|       |
  471|       |    /* Prefix sum depth 4: compute 16-record local totals in r7_local before applying carries. */
  472|     12|    __m256i d3 = dup_hi64_256(r3);
  473|     12|    __m256i r7_local = _mm256_add_epi8(r7, d3);
  474|       |
  475|       |    /* Build per-lane tile carry [carry, carry + sum_lo] and advance running carry128. */
  476|     12|    __m128i r7_lo = _mm256_castsi256_si128(r7_local);
  477|     12|    __m128i r7_hi = _mm256_extracti128_si256(r7_local, 1);
  478|     12|    __m128i sum_lo = _mm_unpackhi_epi64(r7_lo, r7_lo);
  479|     12|    __m128i sum_hi = _mm_unpackhi_epi64(r7_hi, r7_hi);
  480|     12|    __m128i carry_hi = _mm_add_epi8(carry128, sum_lo);
  481|     12|    __m256i tile_carry = _mm256_inserti128_si256(_mm256_castsi128_si256(carry128), carry_hi, 1);
  482|     12|    carry128 = _mm_add_epi8(carry128, _mm_add_epi8(sum_lo, sum_hi));
  483|       |
  484|       |    /* Fold tile_carry with d3 for r4..r6 to save vector adds, then finalize r0..r7. */
  485|     12|    __m256i d3c = _mm256_add_epi8(d3, tile_carry);
  486|     12|    r0 = _mm256_add_epi8(r0, tile_carry);
  487|     12|    r1 = _mm256_add_epi8(r1, tile_carry);
  488|     12|    r2 = _mm256_add_epi8(r2, tile_carry);
  489|     12|    r3 = _mm256_add_epi8(r3, tile_carry);
  490|     12|    r4 = _mm256_add_epi8(r4, d3c);
  491|     12|    r5 = _mm256_add_epi8(r5, d3c);
  492|     12|    r6 = _mm256_add_epi8(r6, d3c);
  493|     12|    r7 = _mm256_add_epi8(r7_local, tile_carry);
  494|       |
  495|       |    /* Split-store low 128-bit lanes (records 0..15) and high lanes (16..31) without vperm2i128. */
  496|     12|    uint8_t *dst = output + i * 8;
  497|     12|    _mm_storeu_si128((__m128i *)(dst + 0), _mm256_castsi256_si128(r0));
  498|     12|    _mm_storeu_si128((__m128i *)(dst + 16), _mm256_castsi256_si128(r1));
  499|     12|    _mm_storeu_si128((__m128i *)(dst + 32), _mm256_castsi256_si128(r2));
  500|     12|    _mm_storeu_si128((__m128i *)(dst + 48), _mm256_castsi256_si128(r3));
  501|     12|    _mm_storeu_si128((__m128i *)(dst + 64), _mm256_castsi256_si128(r4));
  502|     12|    _mm_storeu_si128((__m128i *)(dst + 80), _mm256_castsi256_si128(r5));
  503|     12|    _mm_storeu_si128((__m128i *)(dst + 96), _mm256_castsi256_si128(r6));
  504|     12|    _mm_storeu_si128((__m128i *)(dst + 112), _mm256_castsi256_si128(r7));
  505|     12|    _mm_storeu_si128((__m128i *)(dst + 128), _mm256_extracti128_si256(r0, 1));
  506|     12|    _mm_storeu_si128((__m128i *)(dst + 144), _mm256_extracti128_si256(r1, 1));
  507|     12|    _mm_storeu_si128((__m128i *)(dst + 160), _mm256_extracti128_si256(r2, 1));
  508|     12|    _mm_storeu_si128((__m128i *)(dst + 176), _mm256_extracti128_si256(r3, 1));
  509|     12|    _mm_storeu_si128((__m128i *)(dst + 192), _mm256_extracti128_si256(r4, 1));
  510|     12|    _mm_storeu_si128((__m128i *)(dst + 208), _mm256_extracti128_si256(r5, 1));
  511|     12|    _mm_storeu_si128((__m128i *)(dst + 224), _mm256_extracti128_si256(r6, 1));
  512|     12|    _mm_storeu_si128((__m128i *)(dst + 240), _mm256_extracti128_si256(r7, 1));
  513|     12|  }
  514|       |  /* Scalar tail for remaining <32 records and any incomplete trailing bytes. */
  515|     25|  uint8_t tail_carry[16];
  516|     25|  _mm_storeu_si128((__m128i *)tail_carry, carry128);
  517|    225|  for (int p = 0; p < 8; p++) {
  ------------------
  |  Branch (517:19): [True: 200, False: 25]
  ------------------
  518|    200|    uint8_t carry = tail_carry[p];
  519|  2.16k|    for (int i = vector_count; i < count; i++) {
  ------------------
  |  Branch (519:32): [True: 1.96k, False: 200]
  ------------------
  520|  1.96k|      carry = (uint8_t)(carry + input[p * count + i]);
  521|  1.96k|      output[i * 8 + p] = carry;
  522|  1.96k|    }
  523|    200|  }
  524|     25|  memcpy(output + count * 8, input + count * 8, (size_t)(length % 8));
  525|     25|  return 1;
  526|     25|}
shuffle-bytedelta-avx2.c:dup_hi64_256:
   90|     84|static inline __m256i dup_hi64_256(__m256i v) {
   91|       |  /* Broadcast the upper 64-bit record of each 128-bit lane across that lane. */
   92|     84|  return _mm256_unpackhi_epi64(v, v);
   93|     84|}

shuffle_generic:
   15|  1.94k|                     const uint8_t *_src, uint8_t *_dest) {
   16|       |  /* Non-optimized shuffle */
   17|  1.94k|  shuffle_generic_inline(bytesoftype, 0, blocksize, _src, _dest);
   18|  1.94k|}
unshuffle_generic:
   22|  8.14k|                       const uint8_t *_src, uint8_t *_dest) {
   23|       |  /* Non-optimized unshuffle */
   24|  8.14k|  unshuffle_generic_inline(bytesoftype, 0, blocksize, _src, _dest);
   25|  8.14k|}

shuffle-generic.c:shuffle_generic_inline:
   36|  1.94k|                                   const uint8_t *_src, uint8_t *_dest) {
   37|  1.94k|  int32_t i, j;
   38|       |  /* Calculate the number of elements in the block. */
   39|  1.94k|  const int32_t neblock_quot = blocksize / type_size;
   40|  1.94k|  const int32_t neblock_rem = blocksize % type_size;
   41|  1.94k|  const int32_t vectorizable_elements = vectorizable_blocksize / type_size;
   42|       |
   43|       |
   44|       |  /* Non-optimized shuffle */
   45|  63.6k|  for (j = 0; j < type_size; j++) {
  ------------------
  |  Branch (45:15): [True: 61.7k, False: 1.94k]
  ------------------
   46|   314k|    for (i = vectorizable_elements; i < (int32_t)neblock_quot; i++) {
  ------------------
  |  Branch (46:37): [True: 252k, False: 61.7k]
  ------------------
   47|   252k|      _dest[j * neblock_quot + i] = _src[i * type_size + j];
   48|   252k|    }
   49|  61.7k|  }
   50|       |
   51|       |  /* Copy any leftover bytes in the block without shuffling them. */
   52|  1.94k|  memcpy(_dest + (blocksize - neblock_rem), _src + (blocksize - neblock_rem), neblock_rem);
   53|  1.94k|}
shuffle-generic.c:unshuffle_generic_inline:
   64|  8.14k|                                     const uint8_t *_src, uint8_t *_dest) {
   65|  8.14k|  int32_t i, j;
   66|       |
   67|       |  /* Calculate the number of elements in the block. */
   68|  8.14k|  const int32_t neblock_quot = blocksize / type_size;
   69|  8.14k|  const int32_t neblock_rem = blocksize % type_size;
   70|  8.14k|  const int32_t vectorizable_elements = vectorizable_blocksize / type_size;
   71|       |
   72|       |  /* Non-optimized unshuffle */
   73|   546M|  for (i = vectorizable_elements; i < (int32_t)neblock_quot; i++) {
  ------------------
  |  Branch (73:35): [True: 546M, False: 8.14k]
  ------------------
   74|  3.28G|    for (j = 0; j < type_size; j++) {
  ------------------
  |  Branch (74:17): [True: 2.73G, False: 546M]
  ------------------
   75|  2.73G|      _dest[i * type_size + j] = _src[j * neblock_quot + i];
   76|  2.73G|    }
   77|   546M|  }
   78|       |
   79|       |  /* Copy any leftover bytes in the block without unshuffling them. */
   80|  8.14k|  memcpy(_dest + (blocksize - neblock_rem), _src + (blocksize - neblock_rem), neblock_rem);
   81|  8.14k|}
shuffle-avx2.c:unshuffle_generic_inline:
   64|    193|                                     const uint8_t *_src, uint8_t *_dest) {
   65|    193|  int32_t i, j;
   66|       |
   67|       |  /* Calculate the number of elements in the block. */
   68|    193|  const int32_t neblock_quot = blocksize / type_size;
   69|    193|  const int32_t neblock_rem = blocksize % type_size;
   70|    193|  const int32_t vectorizable_elements = vectorizable_blocksize / type_size;
   71|       |
   72|       |  /* Non-optimized unshuffle */
   73|  2.92k|  for (i = vectorizable_elements; i < (int32_t)neblock_quot; i++) {
  ------------------
  |  Branch (73:35): [True: 2.73k, False: 193]
  ------------------
   74|   125k|    for (j = 0; j < type_size; j++) {
  ------------------
  |  Branch (74:17): [True: 123k, False: 2.73k]
  ------------------
   75|   123k|      _dest[i * type_size + j] = _src[j * neblock_quot + i];
   76|   123k|    }
   77|  2.73k|  }
   78|       |
   79|       |  /* Copy any leftover bytes in the block without unshuffling them. */
   80|    193|  memcpy(_dest + (blocksize - neblock_rem), _src + (blocksize - neblock_rem), neblock_rem);
   81|    193|}

shuffle_sse2:
  561|  3.46k|             const uint8_t *_src, uint8_t *_dest) {
  562|  3.46k|  const int32_t vectorized_chunk_size = bytesoftype * (int32_t)sizeof(__m128i);
  563|       |  /* If the blocksize is not a multiple of both the typesize and
  564|       |     the vector size, round the blocksize down to the next value
  565|       |     which is a multiple of both. The vectorized shuffle can be
  566|       |     used for that portion of the data, and the naive implementation
  567|       |     can be used for the remaining portion. */
  568|  3.46k|  const int32_t vectorizable_bytes = blocksize - (blocksize % vectorized_chunk_size);
  569|  3.46k|  const int32_t vectorizable_elements = vectorizable_bytes / bytesoftype;
  570|  3.46k|  const int32_t total_elements = blocksize / bytesoftype;
  571|       |
  572|       |  /* If the block size is too small to be vectorized,
  573|       |     use the generic implementation. */
  574|  3.46k|  if (blocksize < vectorized_chunk_size) {
  ------------------
  |  Branch (574:7): [True: 0, False: 3.46k]
  ------------------
  575|      0|    shuffle_generic(bytesoftype, blocksize, _src, _dest);
  576|      0|    return;
  577|      0|  }
  578|       |
  579|       |  /* Optimized shuffle implementations */
  580|  3.46k|  switch (bytesoftype) {
  581|      0|    case 2:
  ------------------
  |  Branch (581:5): [True: 0, False: 3.46k]
  ------------------
  582|      0|      shuffle2_sse2(_dest, _src, vectorizable_elements, total_elements);
  583|      0|      break;
  584|      4|    case 4:
  ------------------
  |  Branch (584:5): [True: 4, False: 3.45k]
  ------------------
  585|      4|      shuffle4_sse2(_dest, _src, vectorizable_elements, total_elements);
  586|      4|      break;
  587|  3.45k|    case 8:
  ------------------
  |  Branch (587:5): [True: 3.45k, False: 4]
  ------------------
  588|  3.45k|      shuffle8_sse2(_dest, _src, vectorizable_elements, total_elements);
  589|  3.45k|      break;
  590|      0|    case 16:
  ------------------
  |  Branch (590:5): [True: 0, False: 3.46k]
  ------------------
  591|      0|      shuffle16_sse2(_dest, _src, vectorizable_elements, total_elements);
  592|      0|      break;
  593|      0|    default:
  ------------------
  |  Branch (593:5): [True: 0, False: 3.46k]
  ------------------
  594|      0|      if (bytesoftype > (int32_t)sizeof(__m128i)) {
  ------------------
  |  Branch (594:11): [True: 0, False: 0]
  ------------------
  595|      0|        shuffle16_tiled_sse2(_dest, _src, vectorizable_elements, total_elements, bytesoftype);
  596|      0|      }
  597|      0|      else {
  598|       |        /* Non-optimized shuffle */
  599|      0|        shuffle_generic(bytesoftype, blocksize, _src, _dest);
  600|       |        /* The non-optimized function covers the whole buffer,
  601|       |           so we're done processing here. */
  602|      0|        return;
  603|      0|      }
  604|  3.46k|  }
  605|       |
  606|       |  /* If the buffer had any bytes at the end which couldn't be handled
  607|       |     by the vectorized implementations, use the non-optimized version
  608|       |     to finish them up. */
  609|  3.46k|  if (vectorizable_bytes < blocksize) {
  ------------------
  |  Branch (609:7): [True: 0, False: 3.46k]
  ------------------
  610|      0|    shuffle_generic_inline(bytesoftype, vectorizable_bytes, blocksize, _src, _dest);
  611|      0|  }
  612|  3.46k|}
shuffle-sse2.c:shuffle4_sse2:
   64|      4|              const int32_t vectorizable_elements, const int32_t total_elements) {
   65|      4|  static const int32_t bytesoftype = 4;
   66|      4|  int32_t i;
   67|      4|  int j;
   68|      4|  const __m128i mask16 = _mm_set1_epi16(0x00ff);
   69|      4|  __m128i lo[4], hi[4];
   70|       |
   71|     20|  for (i = 0; i < vectorizable_elements; i += sizeof(__m128i)) {
  ------------------
  |  Branch (71:15): [True: 16, False: 4]
  ------------------
   72|       |    /* Fetch 16 elements (64 bytes) and split 16-bit halves with sign extension for packs. */
   73|     80|    for (j = 0; j < 4; j++) {
  ------------------
  |  Branch (73:17): [True: 64, False: 16]
  ------------------
   74|     64|      __m128i x = _mm_loadu_si128((__m128i*)(src + (i * bytesoftype) + (j * sizeof(__m128i))));
   75|     64|      lo[j] = _mm_srai_epi32(_mm_slli_epi32(x, 16), 16);
   76|     64|      hi[j] = _mm_srai_epi32(x, 16);
   77|     64|    }
   78|     16|    __m128i p01_lo = _mm_packs_epi32(lo[0], lo[1]);
   79|     16|    __m128i p23_lo = _mm_packs_epi32(lo[2], lo[3]);
   80|     16|    __m128i p01_hi = _mm_packs_epi32(hi[0], hi[1]);
   81|     16|    __m128i p23_hi = _mm_packs_epi32(hi[2], hi[3]);
   82|       |    /* Store the result vectors */
   83|     16|    uint8_t* const dest_for_ith_element = dest + i;
   84|     16|    _mm_storeu_si128((__m128i*)(dest_for_ith_element + 0 * total_elements),
   85|     16|                     _mm_packus_epi16(_mm_and_si128(p01_lo, mask16), _mm_and_si128(p23_lo, mask16)));
   86|     16|    _mm_storeu_si128((__m128i*)(dest_for_ith_element + 1 * total_elements),
   87|     16|                     _mm_packus_epi16(_mm_srli_epi16(p01_lo, 8), _mm_srli_epi16(p23_lo, 8)));
   88|     16|    _mm_storeu_si128((__m128i*)(dest_for_ith_element + 2 * total_elements),
   89|     16|                     _mm_packus_epi16(_mm_and_si128(p01_hi, mask16), _mm_and_si128(p23_hi, mask16)));
   90|     16|    _mm_storeu_si128((__m128i*)(dest_for_ith_element + 3 * total_elements),
   91|     16|                     _mm_packus_epi16(_mm_srli_epi16(p01_hi, 8), _mm_srli_epi16(p23_hi, 8)));
   92|     16|  }
   93|      4|}
shuffle-sse2.c:shuffle8_sse2:
   98|  3.45k|              const int32_t vectorizable_elements, const int32_t total_elements) {
   99|  3.45k|  static const int32_t bytesoftype = 8;
  100|  3.45k|  int32_t j;
  101|  3.45k|  int k, l;
  102|  3.45k|  uint8_t* dest_for_jth_element;
  103|  3.45k|  __m128i xmm0[8], xmm1[8];
  104|       |
  105|  6.91k|  for (j = 0; j < vectorizable_elements; j += sizeof(__m128i)) {
  ------------------
  |  Branch (105:15): [True: 3.45k, False: 3.45k]
  ------------------
  106|       |    /* Fetch 16 elements (128 bytes) then transpose bytes. */
  107|  31.1k|    for (k = 0; k < 8; k++) {
  ------------------
  |  Branch (107:17): [True: 27.6k, False: 3.45k]
  ------------------
  108|  27.6k|      xmm0[k] = _mm_loadu_si128((__m128i*)(src + (j * bytesoftype) + (k * sizeof(__m128i))));
  109|  27.6k|      xmm1[k] = _mm_shuffle_epi32(xmm0[k], 0x4e);
  110|  27.6k|      xmm1[k] = _mm_unpacklo_epi8(xmm0[k], xmm1[k]);
  111|  27.6k|    }
  112|       |    /* Transpose words */
  113|  17.2k|    for (k = 0, l = 0; k < 4; k++, l += 2) {
  ------------------
  |  Branch (113:24): [True: 13.8k, False: 3.45k]
  ------------------
  114|  13.8k|      xmm0[k * 2] = _mm_unpacklo_epi16(xmm1[l], xmm1[l + 1]);
  115|  13.8k|      xmm0[k * 2 + 1] = _mm_unpackhi_epi16(xmm1[l], xmm1[l + 1]);
  116|  13.8k|    }
  117|       |    /* Transpose double words */
  118|  17.2k|    for (k = 0, l = 0; k < 4; k++, l++) {
  ------------------
  |  Branch (118:24): [True: 13.8k, False: 3.45k]
  ------------------
  119|  13.8k|      if (k == 2) l += 2;
  ------------------
  |  Branch (119:11): [True: 3.45k, False: 10.3k]
  ------------------
  120|  13.8k|      xmm1[k * 2] = _mm_unpacklo_epi32(xmm0[l], xmm0[l + 2]);
  121|  13.8k|      xmm1[k * 2 + 1] = _mm_unpackhi_epi32(xmm0[l], xmm0[l + 2]);
  122|  13.8k|    }
  123|       |    /* Transpose quad words */
  124|  17.2k|    for (k = 0; k < 4; k++) {
  ------------------
  |  Branch (124:17): [True: 13.8k, False: 3.45k]
  ------------------
  125|  13.8k|      xmm0[k * 2] = _mm_unpacklo_epi64(xmm1[k], xmm1[k + 4]);
  126|  13.8k|      xmm0[k * 2 + 1] = _mm_unpackhi_epi64(xmm1[k], xmm1[k + 4]);
  127|  13.8k|    }
  128|       |    /* Store the result vectors */
  129|  3.45k|    dest_for_jth_element = dest + j;
  130|  31.1k|    for (k = 0; k < 8; k++) {
  ------------------
  |  Branch (130:17): [True: 27.6k, False: 3.45k]
  ------------------
  131|  27.6k|      _mm_storeu_si128((__m128i*)(dest_for_jth_element + (k * total_elements)), xmm0[k]);
  132|  27.6k|    }
  133|  3.45k|  }
  134|  3.45k|}

shuffle_bytedelta_available:
  443|     80|int shuffle_bytedelta_available(void) {
  444|     80|  init_shuffle_implementation();
  445|       |  return host_shuffle_bytedelta_forward != NULL;
  446|     80|}
blosc_cpu_has_avx2:
  448|  7.64k|int blosc_cpu_has_avx2(void) {
  449|  7.64k|  init_shuffle_implementation();
  450|  7.64k|  return host_has_avx2;
  451|  7.64k|}
shuffle_bytedelta_backward:
  462|     80|int shuffle_bytedelta_backward(const uint8_t *input, uint8_t *output, int32_t length, int typesize) {
  463|     80|  init_shuffle_implementation();
  464|     80|  if ((typesize != 2 && typesize != 4 && typesize != 8) || length < 0 || input == output ||
  ------------------
  |  Branch (464:8): [True: 51, False: 29]
  |  Branch (464:25): [True: 25, False: 26]
  |  Branch (464:42): [True: 0, False: 25]
  |  Branch (464:60): [True: 0, False: 80]
  |  Branch (464:74): [True: 0, False: 80]
  ------------------
  465|     80|      host_shuffle_bytedelta_backward == NULL) {
  ------------------
  |  Branch (465:7): [True: 0, False: 80]
  ------------------
  466|      0|    return 0;
  467|      0|  }
  468|     80|  return host_shuffle_bytedelta_backward(input, output, length, typesize);
  469|     80|}
blosc2_shuffle:
  475|  1.95k|               const void* src, void* dest) {
  476|       |  /* Initialize the shuffle implementation if necessary. */
  477|  1.95k|  init_shuffle_implementation();
  478|       |
  479|  1.95k|  if (typesize < 1 || typesize > 256 || blocksize < 0) {
  ------------------
  |  Branch (479:7): [True: 0, False: 1.95k]
  |  Branch (479:23): [True: 0, False: 1.95k]
  |  Branch (479:41): [True: 0, False: 1.95k]
  ------------------
  480|      0|    return BLOSC2_ERROR_INVALID_PARAM;
  481|      0|  }
  482|       |
  483|       |  /* Shuffling single bytes is the identity; the generic routine would copy them one by one. */
  484|  1.95k|  if (typesize == 1) {
  ------------------
  |  Branch (484:7): [True: 0, False: 1.95k]
  ------------------
  485|      0|    if (dest != src) {
  ------------------
  |  Branch (485:9): [True: 0, False: 0]
  ------------------
  486|      0|      memcpy(dest, src, (size_t)blocksize);
  487|      0|    }
  488|      0|    return blocksize;
  489|      0|  }
  490|       |
  491|       |  /* The implementation is initialized.
  492|       |     Dispatch to its shuffle routine. */
  493|  1.95k|  (host_implementation.shuffle)(typesize, blocksize, src, dest);
  494|       |
  495|  1.95k|  return blocksize;
  496|  1.95k|}
blosc2_unshuffle:
  502|  4.83k|                 const void* src, void* dest) {
  503|       |  /* Initialize the shuffle implementation if necessary. */
  504|  4.83k|  init_shuffle_implementation();
  505|       |
  506|  4.83k|  if (typesize < 1 || typesize > 256 || blocksize < 0) {
  ------------------
  |  Branch (506:7): [True: 0, False: 4.83k]
  |  Branch (506:23): [True: 0, False: 4.83k]
  |  Branch (506:41): [True: 0, False: 4.83k]
  ------------------
  507|      0|    return BLOSC2_ERROR_INVALID_PARAM;
  508|      0|  }
  509|       |
  510|       |  /* Unshuffling single bytes is the identity (see blosc2_shuffle). */
  511|  4.83k|  if (typesize == 1) {
  ------------------
  |  Branch (511:7): [True: 0, False: 4.83k]
  ------------------
  512|      0|    if (dest != src) {
  ------------------
  |  Branch (512:9): [True: 0, False: 0]
  ------------------
  513|      0|      memcpy(dest, src, (size_t)blocksize);
  514|      0|    }
  515|      0|    return blocksize;
  516|      0|  }
  517|       |
  518|       |  /* The implementation is initialized.
  519|       |     Dispatch to it's unshuffle routine. */
  520|  4.83k|  (host_implementation.unshuffle)(typesize, blocksize, src, dest);
  521|       |
  522|  4.83k|  return blocksize;
  523|  4.83k|}
bitshuffle:
  546|  3.46k|                   const void* src, void* dest, void* tmp) {
  547|       |  /* Initialize the shuffle implementation if necessary. */
  548|  3.46k|  init_shuffle_implementation();
  549|  3.46k|  size_t size = blocksize / typesize;
  550|       |
  551|  3.46k|  if (typesize < 1 || typesize > 256 || blocksize < 0) {
  ------------------
  |  Branch (551:7): [True: 0, False: 3.46k]
  |  Branch (551:23): [True: 0, False: 3.46k]
  |  Branch (551:41): [True: 0, False: 3.46k]
  ------------------
  552|      0|    return BLOSC2_ERROR_INVALID_PARAM;
  553|      0|  }
  554|       |
  555|       |  /* bitshuffle only supports a number of elements that is a multiple of 8. */
  556|  3.46k|  size -= size % 8;
  557|  3.46k|  int ret = (int) run_bitshuffle(host_implementation.bitshuffle, src, dest, size, typesize, tmp);
  558|  3.46k|  if (ret < 0) {
  ------------------
  |  Branch (558:7): [True: 0, False: 3.46k]
  ------------------
  559|       |    // Some error in bitshuffle (should not happen)
  560|      0|    BLOSC_TRACE_ERROR("the impossible happened: the bitshuffle filter failed!");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  561|      0|    return ret;
  562|      0|  }
  563|       |
  564|       |  // Copy the leftovers
  565|  3.46k|  size_t offset = size * typesize;
  566|  3.46k|  memcpy((uint8_t *) dest + offset, (const uint8_t *) src + offset, blocksize - offset);
  567|       |
  568|  3.46k|  return blocksize;
  569|  3.46k|}
bitunshuffle:
  582|  3.85k|                     const uint8_t format_version) {
  583|       |  /* Initialize the shuffle implementation if necessary. */
  584|  3.85k|  init_shuffle_implementation();
  585|  3.85k|  size_t size = blocksize / typesize;
  586|       |
  587|  3.85k|  if (format_version == 2) {
  ------------------
  |  Branch (587:7): [True: 76, False: 3.77k]
  ------------------
  588|       |    /* Starting from version 3, bitshuffle() works differently */
  589|     76|    if ((size % 8) == 0) {
  ------------------
  |  Branch (589:9): [True: 55, False: 21]
  ------------------
  590|       |      /* The number of elems is a multiple of 8 which is supported by
  591|       |         bitshuffle. */
  592|     55|      int ret = (int) run_bitshuffle(host_implementation.bitunshuffle,
  593|     55|                                     src, dest, size, typesize, tmp);
  594|     55|      if (ret < 0) {
  ------------------
  |  Branch (594:11): [True: 0, False: 55]
  ------------------
  595|       |        // Some error in bitshuffle (should not happen)
  596|      0|        BLOSC_TRACE_ERROR("the impossible happened: the bitunshuffle filter failed!");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  597|      0|        return ret;
  598|      0|      }
  599|       |      /* Copy the leftovers (the bytes that do not make up a whole element), as
  600|       |         Blosc1 does when it writes them after the shuffled part. */
  601|     55|      size_t offset = size * typesize;
  602|     55|      memcpy((uint8_t *) dest + offset, (const uint8_t *) src + offset, blocksize - offset);
  603|     55|    }
  604|     21|    else {
  605|     21|      memcpy(dest, src, blocksize);
  606|     21|    }
  607|     76|  }
  608|  3.77k|  else {
  609|       |    /* bitshuffle only supports a number of bytes that is a multiple of 8. */
  610|  3.77k|    size -= size % 8;
  611|  3.77k|    int ret = (int) run_bitshuffle(host_implementation.bitunshuffle, src, dest, size, typesize, tmp);
  612|  3.77k|    if (ret < 0) {
  ------------------
  |  Branch (612:9): [True: 0, False: 3.77k]
  ------------------
  613|      0|      BLOSC_TRACE_ERROR("the impossible happened: the bitunshuffle filter failed!");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  614|      0|      return ret;
  615|      0|    }
  616|       |
  617|       |    /* Copy the leftovers */
  618|  3.77k|    size_t offset = size * typesize;
  619|  3.77k|    memcpy((uint8_t *) dest + offset, (const uint8_t *) src + offset, blocksize - offset);
  620|  3.77k|  }
  621|       |
  622|  3.85k|  return blocksize;
  623|  3.85k|}
shuffle.c:init_shuffle_implementation:
  436|  21.9k|static void init_shuffle_implementation(void) {
  437|  21.9k|  pthread_once(&implementation_once, set_host_implementation);
  438|  21.9k|}
shuffle.c:set_host_implementation:
  392|      1|static void set_host_implementation(void) {
  393|      1|  host_implementation = get_shuffle_implementation();
  394|      1|#if defined(SHUFFLE_AVX512_ENABLED) || defined(SHUFFLE_AVX2_ENABLED) || defined(SHUFFLE_SSE2_ENABLED)
  395|      1|  blosc_cpu_features cpu_features = blosc_get_cpu_features();
  396|      1|  host_has_avx2 = (cpu_features & BLOSC_HAVE_AVX2) != 0;
  397|      1|#if defined(SHUFFLE_BYTEDELTA_AVX2_ENABLED)
  398|      1|  if (cpu_features & BLOSC_HAVE_AVX2) {
  ------------------
  |  Branch (398:7): [True: 1, False: 0]
  ------------------
  399|      1|    host_shuffle_bytedelta_forward = shuffle_bytedelta_avx2_forward;
  400|      1|    host_shuffle_bytedelta_backward = shuffle_bytedelta_avx2_backward;
  401|      1|  }
  402|      1|#endif
  403|      1|#if defined(SHUFFLE_BYTEDELTA_SSSE3_ENABLED)
  404|       |  /* SSSE3 needs only the legacy XMM state, not AVX/XSAVE or YMM support. */
  405|      1|  if (host_shuffle_bytedelta_forward == NULL && (cpu_features & BLOSC_HAVE_SSSE3)) {
  ------------------
  |  Branch (405:7): [True: 0, False: 1]
  |  Branch (405:49): [True: 0, False: 0]
  ------------------
  406|      0|    host_shuffle_bytedelta_forward = shuffle_bytedelta_ssse3_forward;
  407|      0|    host_shuffle_bytedelta_backward = shuffle_bytedelta_ssse3_backward;
  408|      0|  }
  409|      1|#endif
  410|       |#elif defined(SHUFFLE_BYTEDELTA_NEON_ENABLED) && (defined(__aarch64__) || defined(_M_ARM64))
  411|       |  host_shuffle_bytedelta_forward = shuffle_bytedelta_neon_forward;
  412|       |  host_shuffle_bytedelta_backward = shuffle_bytedelta_neon_backward;
  413|       |#endif
  414|      1|}
shuffle.c:get_shuffle_implementation:
  303|      1|static shuffle_implementation_t get_shuffle_implementation(void) {
  304|      1|#if defined(SHUFFLE_AVX512_ENABLED) || defined(SHUFFLE_AVX2_ENABLED) || defined(SHUFFLE_SSE2_ENABLED) || defined(SHUFFLE_NEON_ENABLED) || defined(SHUFFLE_ALTIVEC_ENABLED)
  305|      1|  blosc_cpu_features cpu_features = blosc_get_cpu_features();
  306|      1|#endif
  307|      1|#if defined(SHUFFLE_AVX512_ENABLED)
  308|      1|  if (cpu_features & BLOSC_HAVE_AVX512 && is_shuffle_avx2 && is_bshuf_AVX512) {
  ------------------
  |  Branch (308:7): [True: 0, False: 1]
  |  Branch (308:43): [True: 0, False: 0]
  |  Branch (308:62): [True: 0, False: 0]
  ------------------
  309|      0|    shuffle_implementation_t impl_avx512;
  310|      0|    impl_avx512.name = "avx512";
  311|      0|    impl_avx512.shuffle = (shuffle_func)shuffle_avx2;
  312|      0|    impl_avx512.unshuffle = (unshuffle_func)unshuffle_avx2;
  313|      0|    impl_avx512.bitshuffle = (bitshuffle_func) bshuf_trans_bit_elem_AVX512;
  314|      0|    impl_avx512.bitunshuffle = (bitunshuffle_func)bshuf_untrans_bit_elem_AVX512;
  315|      0|    return impl_avx512;
  316|      0|  }
  317|      1|#endif  /* defined(SHUFFLE_AVX512_ENABLED) */
  318|       |
  319|      1|#if defined(SHUFFLE_AVX2_ENABLED)
  320|      1|  if (cpu_features & BLOSC_HAVE_AVX2 && is_shuffle_avx2 && is_bshuf_AVX) {
  ------------------
  |  Branch (320:7): [True: 1, False: 0]
  |  Branch (320:41): [True: 1, False: 0]
  |  Branch (320:60): [True: 1, False: 0]
  ------------------
  321|      1|    shuffle_implementation_t impl_avx2;
  322|      1|    impl_avx2.name = "avx2";
  323|      1|    impl_avx2.shuffle = (shuffle_func)shuffle_avx2;
  324|      1|    impl_avx2.unshuffle = (unshuffle_func)unshuffle_avx2;
  325|      1|    impl_avx2.bitshuffle = (bitshuffle_func) bshuf_trans_bit_elem_AVX;
  326|      1|    impl_avx2.bitunshuffle = (bitunshuffle_func)bshuf_untrans_bit_elem_AVX;
  327|      1|    return impl_avx2;
  328|      1|  }
  329|      0|#endif  /* defined(SHUFFLE_AVX2_ENABLED) */
  330|       |
  331|      0|#if defined(SHUFFLE_SSE2_ENABLED)
  332|      0|  if (cpu_features & BLOSC_HAVE_SSE2 && is_shuffle_sse2 && is_bshuf_SSE) {
  ------------------
  |  Branch (332:7): [True: 0, False: 0]
  |  Branch (332:41): [True: 0, False: 0]
  |  Branch (332:60): [True: 0, False: 0]
  ------------------
  333|      0|    shuffle_implementation_t impl_sse2;
  334|      0|    impl_sse2.name = "sse2";
  335|      0|    impl_sse2.shuffle = (shuffle_func)shuffle_sse2;
  336|      0|    impl_sse2.unshuffle = (unshuffle_func)unshuffle_sse2;
  337|      0|    impl_sse2.bitshuffle = (bitshuffle_func)bshuf_trans_bit_elem_SSE;
  338|      0|    impl_sse2.bitunshuffle = (bitunshuffle_func) bshuf_untrans_bit_elem_SSE;
  339|      0|    return impl_sse2;
  340|      0|  }
  341|      0|#endif  /* defined(SHUFFLE_SSE2_ENABLED) */
  342|       |
  343|       |#if defined(SHUFFLE_NEON_ENABLED)
  344|       |  if (cpu_features & BLOSC_HAVE_NEON && is_shuffle_neon) {
  345|       |    shuffle_implementation_t impl_neon;
  346|       |    impl_neon.name = "neon";
  347|       |    impl_neon.shuffle = (shuffle_func)shuffle_neon;
  348|       |    impl_neon.unshuffle = (unshuffle_func)unshuffle_neon;
  349|       |#if defined(BITSHUFFLE_NEON_ENABLED)
  350|       |    impl_neon.bitshuffle = (bitshuffle_func)bshuf_trans_bit_elem_NEON;
  351|       |    impl_neon.bitunshuffle = (bitunshuffle_func)bshuf_untrans_bit_elem_NEON;
  352|       |#else
  353|       |    // The optimized bitshuffle transpose requires AArch64; ARMv7 stays scalar.
  354|       |    impl_neon.bitshuffle = (bitshuffle_func)bshuf_trans_bit_elem_scal;
  355|       |    impl_neon.bitunshuffle = (bitunshuffle_func)bshuf_untrans_bit_elem_scal;
  356|       |#endif
  357|       |    return impl_neon;
  358|       |  }
  359|       |#endif  /* defined(SHUFFLE_NEON_ENABLED) */
  360|       |
  361|       |#if defined(SHUFFLE_ALTIVEC_ENABLED)
  362|       |  if (cpu_features & BLOSC_HAVE_ALTIVEC && is_shuffle_altivec && is_bshuf_altivec) {
  363|       |    shuffle_implementation_t impl_altivec;
  364|       |    impl_altivec.name = "altivec";
  365|       |    impl_altivec.shuffle = (shuffle_func)shuffle_altivec;
  366|       |    impl_altivec.unshuffle = (unshuffle_func)unshuffle_altivec;
  367|       |    impl_altivec.bitshuffle = (bitshuffle_func)bshuf_trans_bit_elem_altivec;
  368|       |    impl_altivec.bitunshuffle = (bitunshuffle_func)bshuf_untrans_bit_elem_altivec;
  369|       |    return impl_altivec;
  370|       |  }
  371|       |#endif  /* defined(SHUFFLE_ALTIVEC_ENABLED) */
  372|       |
  373|       |  /* Processor doesn't support any of the hardware-accelerated implementations,
  374|       |     so use the generic implementation. */
  375|      0|  shuffle_implementation_t impl_generic;
  376|      0|  impl_generic.name = "generic";
  377|      0|  impl_generic.shuffle = (shuffle_func)shuffle_generic;
  378|      0|  impl_generic.unshuffle = (unshuffle_func)unshuffle_generic;
  379|      0|  impl_generic.bitshuffle = (bitshuffle_func)bshuf_trans_bit_elem_scal;
  380|      0|  impl_generic.bitunshuffle = (bitunshuffle_func)bshuf_untrans_bit_elem_scal;
  381|      0|  return impl_generic;
  382|      0|}
shuffle.c:blosc_get_cpu_features:
  107|      2|static blosc_cpu_features blosc_get_cpu_features(void) {
  108|      2|  blosc_cpu_features cpu_features = BLOSC_HAVE_NOTHING;
  109|      2|  if (__builtin_cpu_supports("sse2")) {
  ------------------
  |  Branch (109:7): [True: 2, False: 0]
  ------------------
  110|      2|    cpu_features |= BLOSC_HAVE_SSE2;
  111|      2|  }
  112|      2|  if (__builtin_cpu_supports("ssse3")) {
  ------------------
  |  Branch (112:7): [True: 2, False: 0]
  ------------------
  113|      2|    cpu_features |= BLOSC_HAVE_SSSE3;
  114|      2|  }
  115|      2|  if (__builtin_cpu_supports("avx2")) {
  ------------------
  |  Branch (115:7): [True: 2, False: 0]
  ------------------
  116|      2|    cpu_features |= BLOSC_HAVE_AVX2;
  117|      2|  }
  118|      2|  if (__builtin_cpu_supports("avx512f") && __builtin_cpu_supports("avx512bw")) {
  ------------------
  |  Branch (118:7): [True: 0, False: 2]
  |  Branch (118:44): [True: 0, False: 0]
  ------------------
  119|      0|    cpu_features |= BLOSC_HAVE_AVX512;
  120|      0|  }
  121|      2|  return cpu_features;
  122|      2|}
shuffle.c:run_bitshuffle:
  528|  7.29k|                              const size_t size, const size_t typesize, void* tmp) {
  529|  7.29k|  if (size == 0) {
  ------------------
  |  Branch (529:7): [True: 31, False: 7.26k]
  ------------------
  530|     31|    return 0;  /* fewer than 8 elements: only leftovers */
  531|     31|  }
  532|  7.26k|  void* scratch = (tmp != NULL) ? tmp : malloc(size * typesize);
  ------------------
  |  Branch (532:19): [True: 7.26k, False: 0]
  ------------------
  533|  7.26k|  if (scratch == NULL) {
  ------------------
  |  Branch (533:7): [True: 0, False: 7.26k]
  ------------------
  534|      0|    return BLOSC2_ERROR_MEMORY_ALLOC;
  535|      0|  }
  536|  7.26k|  int64_t ret = routine(src, dest, size, typesize, scratch);
  537|  7.26k|  if (scratch != tmp) {
  ------------------
  |  Branch (537:7): [True: 0, False: 7.26k]
  ------------------
  538|      0|    free(scratch);
  539|      0|  }
  540|  7.26k|  return ret;
  541|  7.26k|}

blosc_stune_next_blocksize:
   47|  2.05k|int blosc_stune_next_blocksize(blosc2_context *context) {
   48|  2.05k|  int32_t clevel = context->clevel;
   49|  2.05k|  int32_t typesize = context->typesize;
   50|  2.05k|  int32_t nbytes = context->sourcesize;
   51|  2.05k|  int32_t user_blocksize = context->blocksize;
   52|  2.05k|  int32_t blocksize = nbytes;
   53|       |
   54|       |  // Protection against very small buffers
   55|  2.05k|  if (nbytes < typesize) {
  ------------------
  |  Branch (55:7): [True: 0, False: 2.05k]
  ------------------
   56|      0|    context->blocksize = 1;
   57|      0|    return BLOSC2_ERROR_SUCCESS;
   58|      0|  }
   59|       |
   60|  2.05k|  int splitmode = split_block(context, typesize, blocksize);
   61|  2.05k|  if (user_blocksize) {
  ------------------
  |  Branch (61:7): [True: 2.05k, False: 0]
  ------------------
   62|  2.05k|    blocksize = user_blocksize;
   63|  2.05k|    goto last;
   64|  2.05k|  }
   65|       |
   66|      0|  if (nbytes >= L1) {
  ------------------
  |  |   19|      0|#define L1 (32 * 1024)
  ------------------
  |  Branch (66:7): [True: 0, False: 0]
  ------------------
   67|      0|    blocksize = L1;
  ------------------
  |  |   19|      0|#define L1 (32 * 1024)
  ------------------
   68|       |
   69|       |    /* For HCR codecs, increase the block sizes by a factor of 2 because they
   70|       |        are meant for compressing large blocks (i.e. they show a big overhead
   71|       |        when compressing small ones). */
   72|      0|    if (is_HCR(context)) {
  ------------------
  |  Branch (72:9): [True: 0, False: 0]
  ------------------
   73|      0|      blocksize *= 2;
   74|      0|    }
   75|       |
   76|       |    // Choose a different blocksize depending on the compression level
   77|      0|    switch (clevel) {
   78|      0|      case 0:
  ------------------
  |  Branch (78:7): [True: 0, False: 0]
  ------------------
   79|       |        // Case of plain copy
   80|      0|        blocksize /= 4;
   81|      0|        break;
   82|      0|      case 1:
  ------------------
  |  Branch (82:7): [True: 0, False: 0]
  ------------------
   83|      0|        blocksize /= 2;
   84|      0|        break;
   85|      0|      case 2:
  ------------------
  |  Branch (85:7): [True: 0, False: 0]
  ------------------
   86|      0|        blocksize *= 1;
   87|      0|        break;
   88|      0|      case 3:
  ------------------
  |  Branch (88:7): [True: 0, False: 0]
  ------------------
   89|      0|        blocksize *= 2;
   90|      0|        break;
   91|      0|      case 4:
  ------------------
  |  Branch (91:7): [True: 0, False: 0]
  ------------------
   92|      0|      case 5:
  ------------------
  |  Branch (92:7): [True: 0, False: 0]
  ------------------
   93|      0|        blocksize *= 4;
   94|      0|        break;
   95|      0|      case 6:
  ------------------
  |  Branch (95:7): [True: 0, False: 0]
  ------------------
   96|      0|      case 7:
  ------------------
  |  Branch (96:7): [True: 0, False: 0]
  ------------------
   97|      0|      case 8:
  ------------------
  |  Branch (97:7): [True: 0, False: 0]
  ------------------
   98|      0|        blocksize *= 8;
   99|      0|        break;
  100|      0|      case 9:
  ------------------
  |  Branch (100:7): [True: 0, False: 0]
  ------------------
  101|       |        // Do not exceed 256 KB for non HCR codecs
  102|      0|        blocksize *= 8;
  103|      0|        if (is_HCR(context)) {
  ------------------
  |  Branch (103:13): [True: 0, False: 0]
  ------------------
  104|      0|          blocksize *= 2;
  105|      0|        }
  106|      0|        break;
  107|      0|      default:
  ------------------
  |  Branch (107:7): [True: 0, False: 0]
  ------------------
  108|      0|        break;
  109|      0|    }
  110|      0|  }
  111|       |
  112|       |  /* Now the blocksize for splittable codecs */
  113|      0|  if (clevel > 0 && splitmode) {
  ------------------
  |  Branch (113:7): [True: 0, False: 0]
  |  Branch (113:21): [True: 0, False: 0]
  ------------------
  114|       |    // For performance reasons, do not exceed 256 KB (it must fit in L2 cache)
  115|      0|    switch (clevel) {
  116|      0|      case 1:
  ------------------
  |  Branch (116:7): [True: 0, False: 0]
  ------------------
  117|      0|      case 2:
  ------------------
  |  Branch (117:7): [True: 0, False: 0]
  ------------------
  118|      0|      case 3:
  ------------------
  |  Branch (118:7): [True: 0, False: 0]
  ------------------
  119|      0|        blocksize = 32 * 1024;
  120|      0|        break;
  121|      0|      case 4:
  ------------------
  |  Branch (121:7): [True: 0, False: 0]
  ------------------
  122|      0|      case 5:
  ------------------
  |  Branch (122:7): [True: 0, False: 0]
  ------------------
  123|      0|      case 6:
  ------------------
  |  Branch (123:7): [True: 0, False: 0]
  ------------------
  124|      0|        blocksize = 64 * 1024;
  125|      0|        break;
  126|      0|      case 7:
  ------------------
  |  Branch (126:7): [True: 0, False: 0]
  ------------------
  127|      0|        blocksize = 128 * 1024;
  128|      0|        break;
  129|      0|      case 8:
  ------------------
  |  Branch (129:7): [True: 0, False: 0]
  ------------------
  130|      0|        blocksize = 256 * 1024;
  131|      0|        break;
  132|      0|      case 9:
  ------------------
  |  Branch (132:7): [True: 0, False: 0]
  ------------------
  133|      0|      default:
  ------------------
  |  Branch (133:7): [True: 0, False: 0]
  ------------------
  134|      0|        blocksize = 512 * 1024;
  135|      0|        break;
  136|      0|    }
  137|       |    // Multiply by typesize to get proper split sizes
  138|      0|    blocksize *= typesize;
  139|       |    // But do not exceed 4 MB per thread (having this capacity in L3 is normal in modern CPUs)
  140|      0|    if (blocksize > 4 * 1024 * 1024) {
  ------------------
  |  Branch (140:9): [True: 0, False: 0]
  ------------------
  141|      0|      blocksize = 4 * 1024 * 1024;
  142|      0|    }
  143|      0|    if (blocksize < 32 * 1024) {
  ------------------
  |  Branch (143:9): [True: 0, False: 0]
  ------------------
  144|       |      /* Do not use a too small blocksize (< 32 KB) when typesize is small */
  145|      0|      blocksize = 32 * 1024;
  146|      0|    }
  147|      0|  }
  148|       |
  149|  2.05k|  last:
  150|       |  /* Check that blocksize is not too large */
  151|  2.05k|  if (blocksize > nbytes) {
  ------------------
  |  Branch (151:7): [True: 680, False: 1.37k]
  ------------------
  152|    680|    blocksize = nbytes;
  153|    680|  }
  154|       |
  155|       |  // blocksize *must absolutely* be a multiple of the typesize
  156|  2.05k|  if (blocksize > typesize) {
  ------------------
  |  Branch (156:7): [True: 2.01k, False: 43]
  ------------------
  157|  2.01k|    blocksize = blocksize / typesize * typesize;
  158|  2.01k|  }
  159|       |
  160|  2.05k|  context->blocksize = blocksize;
  161|  2.05k|  BLOSC_INFO("compcode: %d, clevel: %d, blocksize: %d, splitmode: %d, typesize: %d",
  ------------------
  |  |  121|  2.05k|    do {                                            \
  |  |  122|  2.05k|        const char *__e = getenv("BLOSC_INFO");     \
  |  |  123|  2.05k|        if (!__e) { break; }                        \
  |  |  ------------------
  |  |  |  Branch (123:13): [True: 2.05k, False: 0]
  |  |  ------------------
  |  |  124|  2.05k|        fprintf(stderr, "[INFO] - " msg "\n", ##__VA_ARGS__); \
  |  |  125|      0|    } while(0)
  |  |  ------------------
  |  |  |  Branch (125:13): [Folded, False: 0]
  |  |  ------------------
  ------------------
  162|  2.05k|             context->compcode, context->clevel, blocksize, splitmode, typesize);
  163|       |
  164|  2.05k|  return BLOSC2_ERROR_SUCCESS;
  165|      0|}
split_block:
  190|  3.24k|int split_block(blosc2_context *context, int32_t typesize, int32_t blocksize) {
  191|  3.24k|  if (context->blosc1_format &&
  ------------------
  |  Branch (191:7): [True: 0, False: 3.24k]
  ------------------
  192|      0|      (typesize > MAX_STREAMS || (blocksize / typesize) < BLOSC1_MIN_SPLIT_ELEMENTS)) {
  ------------------
  |  |   24|      0|#define MAX_STREAMS 16 /* Cannot be larger than 128 */
  ------------------
                    (typesize > MAX_STREAMS || (blocksize / typesize) < BLOSC1_MIN_SPLIT_ELEMENTS)) {
  ------------------
  |  |  188|      0|#define BLOSC1_MIN_SPLIT_ELEMENTS 128
  ------------------
  |  Branch (192:8): [True: 0, False: 0]
  |  Branch (192:34): [True: 0, False: 0]
  ------------------
  193|       |    // A C-Blosc 1.x reader would not split this block whatever the flag says
  194|      0|    return 0;
  195|      0|  }
  196|  3.24k|  switch (context->splitmode) {
  197|      0|    case BLOSC_ALWAYS_SPLIT:
  ------------------
  |  Branch (197:5): [True: 0, False: 3.24k]
  ------------------
  198|      0|      return 1;
  199|  1.19k|    case BLOSC_NEVER_SPLIT:
  ------------------
  |  Branch (199:5): [True: 1.19k, False: 2.05k]
  ------------------
  200|  1.19k|      return 0;
  201|  2.05k|    case BLOSC_FORWARD_COMPAT_SPLIT:
  ------------------
  |  Branch (201:5): [True: 2.05k, False: 1.19k]
  ------------------
  202|  2.05k|    case BLOSC_AUTO_SPLIT:
  ------------------
  |  Branch (202:5): [True: 0, False: 3.24k]
  ------------------
  203|       |      // These cases will be handled later
  204|  2.05k|      break;
  205|      0|    default:
  ------------------
  |  Branch (205:5): [True: 0, False: 3.24k]
  ------------------
  206|      0|      BLOSC_TRACE_WARNING("Unrecognized split mode.  Default to BLOSC_FORWARD_COMPAT_SPLIT");
  ------------------
  |  |   94|      0|#define BLOSC_TRACE_WARNING(msg, ...) BLOSC_TRACE(warning, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  207|  3.24k|  }
  208|       |
  209|  2.05k|  int compcode = context->compcode;
  210|  2.05k|  if (compcode == BLOSC_CODEC_OPENZL) {
  ------------------
  |  Branch (210:7): [True: 0, False: 2.05k]
  ------------------
  211|       |    // Never split blocks for OpenZL, as it has its own block mechanisms
  212|      0|    return 0;
  213|      0|  }
  214|  2.05k|  return (
  215|       |          // Fast codecs like blosclz, lz4 seems to prefer to split
  216|  2.05k|          ((compcode == BLOSC_BLOSCLZ) || (compcode == BLOSC_LZ4)
  ------------------
  |  Branch (216:12): [True: 1.01k, False: 1.04k]
  |  Branch (216:43): [True: 51, False: 989]
  ------------------
  217|       |            // and low levels of zstd too
  218|    989|            || ((compcode == BLOSC_ZSTD) && (context->clevel <= 5))
  ------------------
  |  Branch (218:17): [True: 676, False: 313]
  |  Branch (218:45): [True: 389, False: 287]
  ------------------
  219|  2.05k|            ) &&
  220|       |          // ...but split seems to harm cratio too much when not using shuffle
  221|  1.45k|          (context->filter_flags & BLOSC_DOSHUFFLE) &&
  ------------------
  |  Branch (221:11): [True: 861, False: 592]
  ------------------
  222|    861|          (typesize <= MAX_STREAMS) &&
  ------------------
  |  |   24|    861|#define MAX_STREAMS 16 /* Cannot be larger than 128 */
  ------------------
  |  Branch (222:11): [True: 861, False: 0]
  ------------------
  223|    861|          (blocksize / typesize) >= BLOSC_MIN_BUFFERSIZE);
  ------------------
  |  Branch (223:11): [True: 751, False: 110]
  ------------------
  224|  2.05k|}

truncate_precision32:
   24|      3|                         const int32_t* src, int32_t* dest) {
   25|       |  // Make sure that we don't remove all the bits in mantissa so that we
   26|       |  // don't mess with NaNs or Infinite representation in IEEE 754:
   27|       |  // https://en.wikipedia.org/wiki/NaN
   28|      3|  if ((abs(prec_bits) > BITS_MANTISSA_FLOAT)) {
  ------------------
  |  |   19|      3|#define BITS_MANTISSA_FLOAT 23
  ------------------
  |  Branch (28:7): [True: 1, False: 2]
  ------------------
   29|      1|    BLOSC_TRACE_ERROR("The precision cannot be larger than %d bits for floats (asking for %d bits)",
  ------------------
  |  |   93|      1|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      1|    do {                                            \
  |  |  |  |   98|      1|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      1|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 1, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      1|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   30|      0|                      BITS_MANTISSA_FLOAT, prec_bits);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   19|      0|#define BITS_MANTISSA_FLOAT 23
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
   30|      1|                      BITS_MANTISSA_FLOAT, prec_bits);
   31|      1|    return -1;
   32|      1|  }
   33|      2|  int zeroed_bits = (prec_bits >= 0) ? BITS_MANTISSA_FLOAT - prec_bits : -prec_bits;
  ------------------
  |  |   19|      0|#define BITS_MANTISSA_FLOAT 23
  ------------------
  |  Branch (33:21): [True: 0, False: 2]
  ------------------
   34|      2|  if (zeroed_bits >= BITS_MANTISSA_FLOAT) {
  ------------------
  |  |   19|      2|#define BITS_MANTISSA_FLOAT 23
  ------------------
  |  Branch (34:7): [True: 0, False: 2]
  ------------------
   35|      0|    BLOSC_TRACE_ERROR("The reduction in precision cannot be larger or equal than %d bits for floats (asking for %d bits)",
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   36|      0|                      BITS_MANTISSA_FLOAT, zeroed_bits);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   19|      0|#define BITS_MANTISSA_FLOAT 23
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
   36|      0|                      BITS_MANTISSA_FLOAT, zeroed_bits);
   37|      0|    return -1;
   38|      0|  }
   39|      2|  int32_t mask = ~((1 << zeroed_bits) - 1);
   40|    514|  for (int i = 0; i < nelems; i++) {
  ------------------
  |  Branch (40:19): [True: 512, False: 2]
  ------------------
   41|    512|    dest[i] = src[i] & mask;
   42|    512|  }
   43|      2|  return 0;
   44|      2|}
truncate_precision64:
   47|    266|                          const int64_t* src, int64_t* dest) {
   48|       |  // Make sure that we don't remove all the bits in mantissa so that we
   49|       |  // don't mess with NaNs or Infinite representation in IEEE 754:
   50|       |  // https://en.wikipedia.org/wiki/NaN
   51|    266|  if ((abs(prec_bits) > BITS_MANTISSA_DOUBLE)) {
  ------------------
  |  |   20|    266|#define BITS_MANTISSA_DOUBLE 52
  ------------------
  |  Branch (51:7): [True: 0, False: 266]
  ------------------
   52|      0|    BLOSC_TRACE_ERROR("The precision cannot be larger than %d bits for floats (asking for %d bits)",
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   53|      0|                      BITS_MANTISSA_DOUBLE, prec_bits);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   20|      0|#define BITS_MANTISSA_DOUBLE 52
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
   53|      0|                      BITS_MANTISSA_DOUBLE, prec_bits);
   54|      0|    return -1;
   55|      0|  }
   56|    266|  int zeroed_bits = (prec_bits >= 0) ? BITS_MANTISSA_DOUBLE - prec_bits : -prec_bits;
  ------------------
  |  |   20|      8|#define BITS_MANTISSA_DOUBLE 52
  ------------------
  |  Branch (56:21): [True: 8, False: 258]
  ------------------
   57|    266|  if (zeroed_bits >= BITS_MANTISSA_DOUBLE) {
  ------------------
  |  |   20|    266|#define BITS_MANTISSA_DOUBLE 52
  ------------------
  |  Branch (57:7): [True: 0, False: 266]
  ------------------
   58|      0|    BLOSC_TRACE_ERROR("The reduction in precision cannot be larger or equal than %d bits for floats (asking for %d bits)",
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   59|      0|                      BITS_MANTISSA_DOUBLE, zeroed_bits);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   20|      0|#define BITS_MANTISSA_DOUBLE 52
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
   59|      0|                      BITS_MANTISSA_DOUBLE, zeroed_bits);
   60|      0|    return -1;
   61|      0|  }
   62|    266|  uint64_t mask = ~((1ULL << zeroed_bits) - 1ULL);
   63|  4.90k|  for (int i = 0; i < nelems; i++) {
  ------------------
  |  Branch (63:19): [True: 4.64k, False: 266]
  ------------------
   64|  4.64k|    dest[i] = (int64_t)(src[i] & mask);
   65|  4.64k|  }
   66|    266|  return 0;
   67|    266|}
truncate_precision:
   71|    269|                       const uint8_t* src, uint8_t* dest) {
   72|       |  // Positive values of prec_bits will set absolute precision bits, whereas negative
   73|       |  // values will reduce the precision bits (similar to Python slicing convention).
   74|    269|  switch (typesize) {
   75|      3|    case 4:
  ------------------
  |  Branch (75:5): [True: 3, False: 266]
  ------------------
   76|      3|      return truncate_precision32(prec_bits, nbytes / typesize,
   77|      3|                              (int32_t *)src, (int32_t *)dest);
   78|    266|    case 8:
  ------------------
  |  Branch (78:5): [True: 266, False: 3]
  ------------------
   79|    266|      return truncate_precision64(prec_bits, nbytes / typesize,
   80|    266|                              (int64_t *)src, (int64_t *)dest);
   81|      0|    default:
  ------------------
  |  Branch (81:5): [True: 0, False: 269]
  ------------------
   82|       |      BLOSC_TRACE_ERROR("Error in trunc-prec filter: Precision for typesize %d not handled",
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
   83|      0|                        (int)typesize);
   84|      0|      return -1;
   85|    269|  }
   86|    269|}

b2nd.c:b2nd_deserialize_meta_inline:
  721|  1.54k|                                                int32_t *chunkshape, int32_t *blockshape, char **dtype, int8_t *dtype_format) {
  722|  1.54k|  BLOSC_ERROR_NULL(smeta, BLOSC2_ERROR_NULL_POINTER);
  ------------------
  |  |  104|  1.54k|    do {                                            \
  |  |  105|  1.54k|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 1.54k]
  |  |  ------------------
  |  |  106|      0|            BLOSC_TRACE_ERROR("Pointer is null");   \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  107|      0|            return (rc);                            \
  |  |  108|      0|        }                                           \
  |  |  109|  1.54k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 1.54k]
  |  |  ------------------
  ------------------
  723|  1.54k|  BLOSC_ERROR_NULL(ndim, BLOSC2_ERROR_NULL_POINTER);
  ------------------
  |  |  104|  1.54k|    do {                                            \
  |  |  105|  1.54k|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 1.54k]
  |  |  ------------------
  |  |  106|      0|            BLOSC_TRACE_ERROR("Pointer is null");   \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  107|      0|            return (rc);                            \
  |  |  108|      0|        }                                           \
  |  |  109|  1.54k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 1.54k]
  |  |  ------------------
  ------------------
  724|  1.54k|  BLOSC_ERROR_NULL(shape, BLOSC2_ERROR_NULL_POINTER);
  ------------------
  |  |  104|  1.54k|    do {                                            \
  |  |  105|  1.54k|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 1.54k]
  |  |  ------------------
  |  |  106|      0|            BLOSC_TRACE_ERROR("Pointer is null");   \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  107|      0|            return (rc);                            \
  |  |  108|      0|        }                                           \
  |  |  109|  1.54k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 1.54k]
  |  |  ------------------
  ------------------
  725|  1.54k|  BLOSC_ERROR_NULL(chunkshape, BLOSC2_ERROR_NULL_POINTER);
  ------------------
  |  |  104|  1.54k|    do {                                            \
  |  |  105|  1.54k|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 1.54k]
  |  |  ------------------
  |  |  106|      0|            BLOSC_TRACE_ERROR("Pointer is null");   \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  107|      0|            return (rc);                            \
  |  |  108|      0|        }                                           \
  |  |  109|  1.54k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 1.54k]
  |  |  ------------------
  ------------------
  726|  1.54k|  BLOSC_ERROR_NULL(blockshape, BLOSC2_ERROR_NULL_POINTER);
  ------------------
  |  |  104|  1.54k|    do {                                            \
  |  |  105|  1.54k|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 1.54k]
  |  |  ------------------
  |  |  106|      0|            BLOSC_TRACE_ERROR("Pointer is null");   \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  107|      0|            return (rc);                            \
  |  |  108|      0|        }                                           \
  |  |  109|  1.54k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 1.54k]
  |  |  ------------------
  ------------------
  727|  1.54k|  if (dtype != NULL) {
  ------------------
  |  Branch (727:7): [True: 139, False: 1.40k]
  ------------------
  728|    139|    *dtype = NULL;
  729|    139|  }
  730|  1.54k|  if (dtype_format != NULL) {
  ------------------
  |  Branch (730:7): [True: 139, False: 1.40k]
  ------------------
  731|    139|    *dtype_format = 0;
  732|    139|  }
  733|  1.54k|  if (smeta_len <= 0) {
  ------------------
  |  Branch (733:7): [True: 0, False: 1.54k]
  ------------------
  734|      0|    BLOSC_TRACE_ERROR("Malformed b2nd metalayer: empty metadata");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  735|      0|    return BLOSC2_ERROR_FAILURE;
  736|      0|  }
  737|       |
  738|  1.54k|  const uint8_t *pmeta = smeta;
  739|       |
  740|  1.54k|#define B2ND_REQUIRE_META_NBYTES(nbytes)                                             \
  741|  1.54k|  do {                                                                                \
  742|  1.54k|    size_t consumed = (size_t)(pmeta - smeta);                                        \
  743|  1.54k|    size_t total = (size_t)smeta_len;                                                 \
  744|  1.54k|    if (consumed > total || (total - consumed) < (size_t)(nbytes)) {                 \
  745|  1.54k|      BLOSC_TRACE_ERROR("Malformed b2nd metalayer: truncated metadata");            \
  746|  1.54k|      return BLOSC2_ERROR_FAILURE;                                                    \
  747|  1.54k|    }                                                                                 \
  748|  1.54k|  } while (0)
  749|       |
  750|       |  // Check that we have an array with 7 entries (version, ndim, shape, chunkshape, blockshape, dtype_format, dtype)
  751|  1.54k|  B2ND_REQUIRE_META_NBYTES(1);
  ------------------
  |  |  741|  1.54k|  do {                                                                                \
  |  |  742|  1.54k|    size_t consumed = (size_t)(pmeta - smeta);                                        \
  |  |  743|  1.54k|    size_t total = (size_t)smeta_len;                                                 \
  |  |  744|  1.54k|    if (consumed > total || (total - consumed) < (size_t)(nbytes)) {                 \
  |  |  ------------------
  |  |  |  Branch (744:9): [True: 0, False: 1.54k]
  |  |  |  Branch (744:29): [True: 0, False: 1.54k]
  |  |  ------------------
  |  |  745|      0|      BLOSC_TRACE_ERROR("Malformed b2nd metalayer: truncated metadata");            \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  746|      0|      return BLOSC2_ERROR_FAILURE;                                                    \
  |  |  747|      0|    }                                                                                 \
  |  |  748|  1.54k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (748:12): [Folded, False: 1.54k]
  |  |  ------------------
  ------------------
  752|  1.54k|  pmeta += 1;
  753|       |
  754|       |  // version entry
  755|       |  // int8_t version = (int8_t)pmeta[0];  // positive fixnum (7-bit positive integer) commented to avoid warning
  756|  1.54k|  B2ND_REQUIRE_META_NBYTES(1);
  ------------------
  |  |  741|  1.54k|  do {                                                                                \
  |  |  742|  1.54k|    size_t consumed = (size_t)(pmeta - smeta);                                        \
  |  |  743|  1.54k|    size_t total = (size_t)smeta_len;                                                 \
  |  |  744|  1.54k|    if (consumed > total || (total - consumed) < (size_t)(nbytes)) {                 \
  |  |  ------------------
  |  |  |  Branch (744:9): [True: 0, False: 1.54k]
  |  |  |  Branch (744:29): [True: 0, False: 1.54k]
  |  |  ------------------
  |  |  745|      0|      BLOSC_TRACE_ERROR("Malformed b2nd metalayer: truncated metadata");            \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  746|      0|      return BLOSC2_ERROR_FAILURE;                                                    \
  |  |  747|      0|    }                                                                                 \
  |  |  748|  1.54k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (748:12): [Folded, False: 1.54k]
  |  |  ------------------
  ------------------
  757|  1.54k|  pmeta += 1;
  758|       |
  759|       |  // ndim entry
  760|  1.54k|  B2ND_REQUIRE_META_NBYTES(1);
  ------------------
  |  |  741|  1.54k|  do {                                                                                \
  |  |  742|  1.54k|    size_t consumed = (size_t)(pmeta - smeta);                                        \
  |  |  743|  1.54k|    size_t total = (size_t)smeta_len;                                                 \
  |  |  744|  1.54k|    if (consumed > total || (total - consumed) < (size_t)(nbytes)) {                 \
  |  |  ------------------
  |  |  |  Branch (744:9): [True: 0, False: 1.54k]
  |  |  |  Branch (744:29): [True: 0, False: 1.54k]
  |  |  ------------------
  |  |  745|      0|      BLOSC_TRACE_ERROR("Malformed b2nd metalayer: truncated metadata");            \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  746|      0|      return BLOSC2_ERROR_FAILURE;                                                    \
  |  |  747|      0|    }                                                                                 \
  |  |  748|  1.54k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (748:12): [Folded, False: 1.54k]
  |  |  ------------------
  ------------------
  761|  1.54k|  *ndim = (int8_t) pmeta[0];
  762|  1.54k|  int8_t ndim_aux = *ndim;  // positive fixnum (7-bit positive integer)
  763|  1.54k|  if (ndim_aux < 0 || ndim_aux > B2ND_MAX_DIM) {
  ------------------
  |  |   50|  1.54k|#define B2ND_MAX_DIM 16
  ------------------
  |  Branch (763:7): [True: 0, False: 1.54k]
  |  Branch (763:23): [True: 0, False: 1.54k]
  ------------------
  764|      0|    BLOSC_TRACE_ERROR("ndim %d is out of range", ndim_aux);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  765|      0|    return BLOSC2_ERROR_FAILURE;
  766|      0|  }
  767|  1.54k|  pmeta += 1;
  768|       |
  769|       |  // shape entry
  770|       |  // Initialize to ones, as required by b2nd
  771|  7.46k|  for (int i = 0; i < ndim_aux; i++) shape[i] = 1;
  ------------------
  |  Branch (771:19): [True: 5.91k, False: 1.54k]
  ------------------
  772|  1.54k|  B2ND_REQUIRE_META_NBYTES(1);
  ------------------
  |  |  741|  1.54k|  do {                                                                                \
  |  |  742|  1.54k|    size_t consumed = (size_t)(pmeta - smeta);                                        \
  |  |  743|  1.54k|    size_t total = (size_t)smeta_len;                                                 \
  |  |  744|  1.54k|    if (consumed > total || (total - consumed) < (size_t)(nbytes)) {                 \
  |  |  ------------------
  |  |  |  Branch (744:9): [True: 0, False: 1.54k]
  |  |  |  Branch (744:29): [True: 0, False: 1.54k]
  |  |  ------------------
  |  |  745|      0|      BLOSC_TRACE_ERROR("Malformed b2nd metalayer: truncated metadata");            \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  746|      0|      return BLOSC2_ERROR_FAILURE;                                                    \
  |  |  747|      0|    }                                                                                 \
  |  |  748|  1.54k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (748:12): [Folded, False: 1.54k]
  |  |  ------------------
  ------------------
  773|  1.54k|  pmeta += 1;
  774|  7.46k|  for (int8_t i = 0; i < ndim_aux; i++) {
  ------------------
  |  Branch (774:22): [True: 5.91k, False: 1.54k]
  ------------------
  775|  5.91k|    B2ND_REQUIRE_META_NBYTES(1 + sizeof(int64_t));
  ------------------
  |  |  741|  5.91k|  do {                                                                                \
  |  |  742|  5.91k|    size_t consumed = (size_t)(pmeta - smeta);                                        \
  |  |  743|  5.91k|    size_t total = (size_t)smeta_len;                                                 \
  |  |  744|  5.91k|    if (consumed > total || (total - consumed) < (size_t)(nbytes)) {                 \
  |  |  ------------------
  |  |  |  Branch (744:9): [True: 0, False: 5.91k]
  |  |  |  Branch (744:29): [True: 0, False: 5.91k]
  |  |  ------------------
  |  |  745|      0|      BLOSC_TRACE_ERROR("Malformed b2nd metalayer: truncated metadata");            \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  746|      0|      return BLOSC2_ERROR_FAILURE;                                                    \
  |  |  747|      0|    }                                                                                 \
  |  |  748|  5.91k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (748:12): [Folded, False: 5.91k]
  |  |  ------------------
  ------------------
  776|  5.91k|    pmeta += 1;
  777|  5.91k|    swap_store(shape + i, pmeta, sizeof(int64_t));
  778|  5.91k|    pmeta += sizeof(int64_t);
  779|  5.91k|  }
  780|       |
  781|       |  // chunkshape entry
  782|       |  // Initialize to ones, as required by b2nd
  783|  7.46k|  for (int i = 0; i < ndim_aux; i++) chunkshape[i] = 1;
  ------------------
  |  Branch (783:19): [True: 5.91k, False: 1.54k]
  ------------------
  784|  1.54k|  B2ND_REQUIRE_META_NBYTES(1);
  ------------------
  |  |  741|  1.54k|  do {                                                                                \
  |  |  742|  1.54k|    size_t consumed = (size_t)(pmeta - smeta);                                        \
  |  |  743|  1.54k|    size_t total = (size_t)smeta_len;                                                 \
  |  |  744|  1.54k|    if (consumed > total || (total - consumed) < (size_t)(nbytes)) {                 \
  |  |  ------------------
  |  |  |  Branch (744:9): [True: 0, False: 1.54k]
  |  |  |  Branch (744:29): [True: 0, False: 1.54k]
  |  |  ------------------
  |  |  745|      0|      BLOSC_TRACE_ERROR("Malformed b2nd metalayer: truncated metadata");            \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  746|      0|      return BLOSC2_ERROR_FAILURE;                                                    \
  |  |  747|      0|    }                                                                                 \
  |  |  748|  1.54k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (748:12): [Folded, False: 1.54k]
  |  |  ------------------
  ------------------
  785|  1.54k|  pmeta += 1;
  786|  7.46k|  for (int8_t i = 0; i < ndim_aux; i++) {
  ------------------
  |  Branch (786:22): [True: 5.91k, False: 1.54k]
  ------------------
  787|  5.91k|    B2ND_REQUIRE_META_NBYTES(1 + sizeof(int32_t));
  ------------------
  |  |  741|  5.91k|  do {                                                                                \
  |  |  742|  5.91k|    size_t consumed = (size_t)(pmeta - smeta);                                        \
  |  |  743|  5.91k|    size_t total = (size_t)smeta_len;                                                 \
  |  |  744|  5.91k|    if (consumed > total || (total - consumed) < (size_t)(nbytes)) {                 \
  |  |  ------------------
  |  |  |  Branch (744:9): [True: 0, False: 5.91k]
  |  |  |  Branch (744:29): [True: 0, False: 5.91k]
  |  |  ------------------
  |  |  745|      0|      BLOSC_TRACE_ERROR("Malformed b2nd metalayer: truncated metadata");            \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  746|      0|      return BLOSC2_ERROR_FAILURE;                                                    \
  |  |  747|      0|    }                                                                                 \
  |  |  748|  5.91k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (748:12): [Folded, False: 5.91k]
  |  |  ------------------
  ------------------
  788|  5.91k|    pmeta += 1;
  789|  5.91k|    swap_store(chunkshape + i, pmeta, sizeof(int32_t));
  790|  5.91k|    pmeta += sizeof(int32_t);
  791|  5.91k|  }
  792|       |
  793|       |  // blockshape entry
  794|       |  // Initialize to ones, as required by b2nd
  795|  7.46k|  for (int i = 0; i < ndim_aux; i++) blockshape[i] = 1;
  ------------------
  |  Branch (795:19): [True: 5.91k, False: 1.54k]
  ------------------
  796|  1.54k|  B2ND_REQUIRE_META_NBYTES(1);
  ------------------
  |  |  741|  1.54k|  do {                                                                                \
  |  |  742|  1.54k|    size_t consumed = (size_t)(pmeta - smeta);                                        \
  |  |  743|  1.54k|    size_t total = (size_t)smeta_len;                                                 \
  |  |  744|  1.54k|    if (consumed > total || (total - consumed) < (size_t)(nbytes)) {                 \
  |  |  ------------------
  |  |  |  Branch (744:9): [True: 0, False: 1.54k]
  |  |  |  Branch (744:29): [True: 0, False: 1.54k]
  |  |  ------------------
  |  |  745|      0|      BLOSC_TRACE_ERROR("Malformed b2nd metalayer: truncated metadata");            \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  746|      0|      return BLOSC2_ERROR_FAILURE;                                                    \
  |  |  747|      0|    }                                                                                 \
  |  |  748|  1.54k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (748:12): [Folded, False: 1.54k]
  |  |  ------------------
  ------------------
  797|  1.54k|  pmeta += 1;
  798|  7.46k|  for (int8_t i = 0; i < ndim_aux; i++) {
  ------------------
  |  Branch (798:22): [True: 5.91k, False: 1.54k]
  ------------------
  799|  5.91k|    B2ND_REQUIRE_META_NBYTES(1 + sizeof(int32_t));
  ------------------
  |  |  741|  5.91k|  do {                                                                                \
  |  |  742|  5.91k|    size_t consumed = (size_t)(pmeta - smeta);                                        \
  |  |  743|  5.91k|    size_t total = (size_t)smeta_len;                                                 \
  |  |  744|  5.91k|    if (consumed > total || (total - consumed) < (size_t)(nbytes)) {                 \
  |  |  ------------------
  |  |  |  Branch (744:9): [True: 0, False: 5.91k]
  |  |  |  Branch (744:29): [True: 0, False: 5.91k]
  |  |  ------------------
  |  |  745|      0|      BLOSC_TRACE_ERROR("Malformed b2nd metalayer: truncated metadata");            \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  746|      0|      return BLOSC2_ERROR_FAILURE;                                                    \
  |  |  747|      0|    }                                                                                 \
  |  |  748|  5.91k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (748:12): [Folded, False: 5.91k]
  |  |  ------------------
  ------------------
  800|  5.91k|    pmeta += 1;
  801|  5.91k|    swap_store(blockshape + i, pmeta, sizeof(int32_t));
  802|  5.91k|    pmeta += sizeof(int32_t);
  803|  5.91k|  }
  804|       |
  805|       |  // dtype entry
  806|  1.54k|  if (dtype_format == NULL || dtype == NULL) {
  ------------------
  |  Branch (806:7): [True: 1.40k, False: 139]
  |  Branch (806:31): [True: 0, False: 139]
  ------------------
  807|  1.40k|    return (int32_t)(pmeta - smeta);
  808|  1.40k|  }
  809|    139|  if (pmeta - smeta < smeta_len) {
  ------------------
  |  Branch (809:7): [True: 139, False: 0]
  ------------------
  810|       |    // dtype info is here
  811|    139|    B2ND_REQUIRE_META_NBYTES(1 + 1 + sizeof(int32_t));
  ------------------
  |  |  741|    139|  do {                                                                                \
  |  |  742|    139|    size_t consumed = (size_t)(pmeta - smeta);                                        \
  |  |  743|    139|    size_t total = (size_t)smeta_len;                                                 \
  |  |  744|    139|    if (consumed > total || (total - consumed) < (size_t)(nbytes)) {                 \
  |  |  ------------------
  |  |  |  Branch (744:9): [True: 0, False: 139]
  |  |  |  Branch (744:29): [True: 0, False: 139]
  |  |  ------------------
  |  |  745|      0|      BLOSC_TRACE_ERROR("Malformed b2nd metalayer: truncated metadata");            \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  746|      0|      return BLOSC2_ERROR_FAILURE;                                                    \
  |  |  747|      0|    }                                                                                 \
  |  |  748|    139|  } while (0)
  |  |  ------------------
  |  |  |  Branch (748:12): [Folded, False: 139]
  |  |  ------------------
  ------------------
  812|    139|    *dtype_format = (int8_t) *(pmeta++);
  813|    139|    if (*pmeta != 0xdb) {
  ------------------
  |  Branch (813:9): [True: 0, False: 139]
  ------------------
  814|      0|      BLOSC_TRACE_ERROR("Malformed b2nd metalayer: invalid dtype MsgPack marker");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  815|      0|      return BLOSC2_ERROR_FAILURE;
  816|      0|    }
  817|    139|    pmeta += 1;
  818|    139|    int32_t dtype_len;
  819|    139|    swap_store(&dtype_len, pmeta, sizeof(int32_t));
  820|    139|    pmeta += sizeof(int32_t);
  821|    139|    if (dtype_len < 0) {
  ------------------
  |  Branch (821:9): [True: 0, False: 139]
  ------------------
  822|      0|      BLOSC_TRACE_ERROR("Malformed b2nd metalayer: negative dtype length");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  823|      0|      return BLOSC2_ERROR_FAILURE;
  824|      0|    }
  825|    139|    B2ND_REQUIRE_META_NBYTES(dtype_len);
  ------------------
  |  |  741|    139|  do {                                                                                \
  |  |  742|    139|    size_t consumed = (size_t)(pmeta - smeta);                                        \
  |  |  743|    139|    size_t total = (size_t)smeta_len;                                                 \
  |  |  744|    139|    if (consumed > total || (total - consumed) < (size_t)(nbytes)) {                 \
  |  |  ------------------
  |  |  |  Branch (744:9): [True: 0, False: 139]
  |  |  |  Branch (744:29): [True: 0, False: 139]
  |  |  ------------------
  |  |  745|      0|      BLOSC_TRACE_ERROR("Malformed b2nd metalayer: truncated metadata");            \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  746|      0|      return BLOSC2_ERROR_FAILURE;                                                    \
  |  |  747|      0|    }                                                                                 \
  |  |  748|    139|  } while (0)
  |  |  ------------------
  |  |  |  Branch (748:12): [Folded, False: 139]
  |  |  ------------------
  ------------------
  826|    139|    size_t dtype_len_ = (size_t)dtype_len;
  827|    139|    *dtype = (char*)malloc(dtype_len_ + 1);
  828|    139|    BLOSC_ERROR_NULL(*dtype, BLOSC2_ERROR_MEMORY_ALLOC);
  ------------------
  |  |  104|    139|    do {                                            \
  |  |  105|    139|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 139]
  |  |  ------------------
  |  |  106|      0|            BLOSC_TRACE_ERROR("Pointer is null");   \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  107|      0|            return (rc);                            \
  |  |  108|      0|        }                                           \
  |  |  109|    139|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 139]
  |  |  ------------------
  ------------------
  829|    139|    char* dtype_ = *dtype;
  830|    139|    memcpy(dtype_, (char*)pmeta, dtype_len_);
  831|    139|    dtype_[dtype_len_] = '\0';
  832|    139|    pmeta += dtype_len_;
  833|    139|  }
  834|      0|  else {
  835|       |    // dtype is mandatory in b2nd metalayer, but this is mainly meant as
  836|       |    // a fall-back for deprecated caterva headers
  837|      0|    *dtype = NULL;
  838|      0|    *dtype_format = 0;
  839|      0|  }
  840|       |
  841|    139|#undef B2ND_REQUIRE_META_NBYTES
  842|       |
  843|    139|  int32_t slen = (int32_t) (pmeta - smeta);
  844|    139|  return (int)slen;
  845|    139|}

blosc2.c:print_error:
  525|     20|static inline char *print_error(int rc) {
  526|       |  // TODO: remove this function, use blosc2_error_string only
  527|     20|  return (char *) blosc2_error_string(rc);
  528|     20|}
schunk.c:blosc2_meta_exists:
 2705|     70|static inline int blosc2_meta_exists(blosc2_schunk *schunk, const char *name) {
 2706|     70|  if (strlen(name) > BLOSC2_METALAYER_NAME_MAXLEN) {
  ------------------
  |  | 1896|     70|#define BLOSC2_METALAYER_NAME_MAXLEN 31
  ------------------
  |  Branch (2706:7): [True: 0, False: 70]
  ------------------
 2707|      0|    BLOSC_TRACE_ERROR("Metalayers cannot be larger than %d chars.", BLOSC2_METALAYER_NAME_MAXLEN);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  ------------------
  |  |  |  |  |  | 2707|      0|    BLOSC_TRACE_ERROR("Metalayers cannot be larger than %d chars.", BLOSC2_METALAYER_NAME_MAXLEN);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1896|      0|#define BLOSC2_METALAYER_NAME_MAXLEN 31
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2708|      0|    return BLOSC2_ERROR_INVALID_PARAM;
 2709|      0|  }
 2710|       |
 2711|     70|  if (schunk == NULL) {
  ------------------
  |  Branch (2711:7): [True: 0, False: 70]
  ------------------
 2712|      0|    BLOSC_TRACE_ERROR("Schunk must not be NUll.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2713|      0|    return BLOSC2_ERROR_INVALID_PARAM;
 2714|      0|  }
 2715|       |
 2716|     70|  for (int nmetalayer = 0; nmetalayer < schunk->nmetalayers; nmetalayer++) {
  ------------------
  |  Branch (2716:28): [True: 0, False: 70]
  ------------------
 2717|      0|    if (strcmp(name, schunk->metalayers[nmetalayer]->name) == 0) {
  ------------------
  |  Branch (2717:9): [True: 0, False: 0]
  ------------------
 2718|      0|      return nmetalayer;
 2719|      0|    }
 2720|      0|  }
 2721|     70|  return BLOSC2_ERROR_NOT_FOUND;
 2722|     70|}
b2nd.c:print_error:
  525|      2|static inline char *print_error(int rc) {
  526|       |  // TODO: remove this function, use blosc2_error_string only
  527|      2|  return (char *) blosc2_error_string(rc);
  528|      2|}
b2nd.c:swap_store:
 3274|  18.7k|static inline void swap_store(void *dest, const void *pa, int size) {
 3275|  18.7k|  uint8_t *pa_ = (uint8_t *) pa;
 3276|  18.7k|  uint8_t *pa2_ = (uint8_t*)malloc((size_t) size);
 3277|  18.7k|  int i = 1; /* for big/little endian detection */
 3278|  18.7k|  char *p = (char *) &i;
 3279|       |
 3280|  18.7k|  if (p[0] == 1) {
  ------------------
  |  Branch (3280:7): [True: 18.7k, False: 0]
  ------------------
 3281|       |    /* little endian */
 3282|  18.7k|    switch (size) {
 3283|  6.16k|      case 8:
  ------------------
  |  Branch (3283:7): [True: 6.16k, False: 12.5k]
  ------------------
 3284|  6.16k|        pa2_[0] = pa_[7];
 3285|  6.16k|        pa2_[1] = pa_[6];
 3286|  6.16k|        pa2_[2] = pa_[5];
 3287|  6.16k|        pa2_[3] = pa_[4];
 3288|  6.16k|        pa2_[4] = pa_[3];
 3289|  6.16k|        pa2_[5] = pa_[2];
 3290|  6.16k|        pa2_[6] = pa_[1];
 3291|  6.16k|        pa2_[7] = pa_[0];
 3292|  6.16k|        break;
 3293|  12.5k|      case 4:
  ------------------
  |  Branch (3293:7): [True: 12.5k, False: 6.16k]
  ------------------
 3294|  12.5k|        pa2_[0] = pa_[3];
 3295|  12.5k|        pa2_[1] = pa_[2];
 3296|  12.5k|        pa2_[2] = pa_[1];
 3297|  12.5k|        pa2_[3] = pa_[0];
 3298|  12.5k|        break;
 3299|      0|      case 2:
  ------------------
  |  Branch (3299:7): [True: 0, False: 18.7k]
  ------------------
 3300|      0|        pa2_[0] = pa_[1];
 3301|      0|        pa2_[1] = pa_[0];
 3302|      0|        break;
 3303|      0|      case 1:
  ------------------
  |  Branch (3303:7): [True: 0, False: 18.7k]
  ------------------
 3304|      0|        pa2_[0] = pa_[0];
 3305|      0|        break;
 3306|      0|      default:
  ------------------
  |  Branch (3306:7): [True: 0, False: 18.7k]
  ------------------
 3307|      0|        fprintf(stderr, "Unhandled nitems: %d\n", size);
 3308|  18.7k|    }
 3309|  18.7k|  } else {
 3310|       |    /* big endian: native byte order is already big-endian, just copy */
 3311|      0|    memcpy(pa2_, pa_, size);
 3312|      0|  }
 3313|  18.7k|  memcpy(dest, pa2_, size);
 3314|  18.7k|  free(pa2_);
 3315|  18.7k|}
b2nd.c:blosc2_meta_exists:
 2705|    139|static inline int blosc2_meta_exists(blosc2_schunk *schunk, const char *name) {
 2706|    139|  if (strlen(name) > BLOSC2_METALAYER_NAME_MAXLEN) {
  ------------------
  |  | 1896|    139|#define BLOSC2_METALAYER_NAME_MAXLEN 31
  ------------------
  |  Branch (2706:7): [True: 0, False: 139]
  ------------------
 2707|      0|    BLOSC_TRACE_ERROR("Metalayers cannot be larger than %d chars.", BLOSC2_METALAYER_NAME_MAXLEN);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  ------------------
  |  |  |  |  |  | 2707|      0|    BLOSC_TRACE_ERROR("Metalayers cannot be larger than %d chars.", BLOSC2_METALAYER_NAME_MAXLEN);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1896|      0|#define BLOSC2_METALAYER_NAME_MAXLEN 31
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2708|      0|    return BLOSC2_ERROR_INVALID_PARAM;
 2709|      0|  }
 2710|       |
 2711|    139|  if (schunk == NULL) {
  ------------------
  |  Branch (2711:7): [True: 0, False: 139]
  ------------------
 2712|      0|    BLOSC_TRACE_ERROR("Schunk must not be NUll.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2713|      0|    return BLOSC2_ERROR_INVALID_PARAM;
 2714|      0|  }
 2715|       |
 2716|    139|  for (int nmetalayer = 0; nmetalayer < schunk->nmetalayers; nmetalayer++) {
  ------------------
  |  Branch (2716:28): [True: 139, False: 0]
  ------------------
 2717|    139|    if (strcmp(name, schunk->metalayers[nmetalayer]->name) == 0) {
  ------------------
  |  Branch (2717:9): [True: 139, False: 0]
  ------------------
 2718|    139|      return nmetalayer;
 2719|    139|    }
 2720|    139|  }
 2721|      0|  return BLOSC2_ERROR_NOT_FOUND;
 2722|    139|}
b2nd.c:blosc2_meta_get:
 2774|    139|                                  int32_t *content_len) {
 2775|    139|  if (schunk == NULL || name == NULL || content == NULL || content_len == NULL) {
  ------------------
  |  Branch (2775:7): [True: 0, False: 139]
  |  Branch (2775:25): [True: 0, False: 139]
  |  Branch (2775:41): [True: 0, False: 139]
  |  Branch (2775:60): [True: 0, False: 139]
  ------------------
 2776|      0|    BLOSC_TRACE_ERROR("Invalid parameters.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2777|      0|    return BLOSC2_ERROR_INVALID_PARAM;
 2778|      0|  }
 2779|       |
 2780|    139|  int nmetalayer = blosc2_meta_exists(schunk, name);
 2781|    139|  if (nmetalayer < 0) {
  ------------------
  |  Branch (2781:7): [True: 0, False: 139]
  ------------------
 2782|      0|    BLOSC_TRACE_WARNING("Metalayer \"%s\" not found.", name);
  ------------------
  |  |   94|      0|#define BLOSC_TRACE_WARNING(msg, ...) BLOSC_TRACE(warning, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2783|      0|    return nmetalayer;
 2784|      0|  }
 2785|    139|  int32_t len = schunk->metalayers[nmetalayer]->content_len;
 2786|    139|  if (len < 0) {
  ------------------
  |  Branch (2786:7): [True: 0, False: 139]
  ------------------
 2787|      0|    BLOSC_TRACE_ERROR("Metalayer \"%s\" has corrupted content length %d.", name, len);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2788|      0|    return BLOSC2_ERROR_DATA;
 2789|      0|  }
 2790|    139|  *content_len = len;
 2791|    139|  if (len == 0) {
  ------------------
  |  Branch (2791:7): [True: 0, False: 139]
  ------------------
 2792|      0|    *content = NULL;
 2793|      0|    return nmetalayer;
 2794|      0|  }
 2795|    139|  *content = (uint8_t*)malloc((size_t)len);
 2796|    139|  if (*content == NULL) {
  ------------------
  |  Branch (2796:7): [True: 0, False: 139]
  ------------------
 2797|      0|    BLOSC_TRACE_ERROR("Unable to allocate metalayer content buffer.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2798|      0|    *content_len = 0;
 2799|      0|    return BLOSC2_ERROR_MEMORY_ALLOC;
 2800|      0|  }
 2801|    139|  if (len > 0 && schunk->metalayers[nmetalayer]->content == NULL) {
  ------------------
  |  Branch (2801:7): [True: 139, False: 0]
  |  Branch (2801:18): [True: 0, False: 139]
  ------------------
 2802|      0|    free(*content);
 2803|      0|    *content = NULL;
 2804|      0|    *content_len = 0;
 2805|      0|    BLOSC_TRACE_ERROR("Metalayer \"%s\" has corrupted content pointer.", name);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2806|      0|    return BLOSC2_ERROR_DATA;
 2807|      0|  }
 2808|    139|  memcpy(*content, schunk->metalayers[nmetalayer]->content, (size_t)len);
 2809|    139|  return nmetalayer;
 2810|    139|}
blosc2-zfp.c:blosc2_meta_get:
 2774|    388|                                  int32_t *content_len) {
 2775|    388|  if (schunk == NULL || name == NULL || content == NULL || content_len == NULL) {
  ------------------
  |  Branch (2775:7): [True: 0, False: 388]
  |  Branch (2775:25): [True: 0, False: 388]
  |  Branch (2775:41): [True: 0, False: 388]
  |  Branch (2775:60): [True: 0, False: 388]
  ------------------
 2776|      0|    BLOSC_TRACE_ERROR("Invalid parameters.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2777|      0|    return BLOSC2_ERROR_INVALID_PARAM;
 2778|      0|  }
 2779|       |
 2780|    388|  int nmetalayer = blosc2_meta_exists(schunk, name);
 2781|    388|  if (nmetalayer < 0) {
  ------------------
  |  Branch (2781:7): [True: 0, False: 388]
  ------------------
 2782|      0|    BLOSC_TRACE_WARNING("Metalayer \"%s\" not found.", name);
  ------------------
  |  |   94|      0|#define BLOSC_TRACE_WARNING(msg, ...) BLOSC_TRACE(warning, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2783|      0|    return nmetalayer;
 2784|      0|  }
 2785|    388|  int32_t len = schunk->metalayers[nmetalayer]->content_len;
 2786|    388|  if (len < 0) {
  ------------------
  |  Branch (2786:7): [True: 0, False: 388]
  ------------------
 2787|      0|    BLOSC_TRACE_ERROR("Metalayer \"%s\" has corrupted content length %d.", name, len);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2788|      0|    return BLOSC2_ERROR_DATA;
 2789|      0|  }
 2790|    388|  *content_len = len;
 2791|    388|  if (len == 0) {
  ------------------
  |  Branch (2791:7): [True: 0, False: 388]
  ------------------
 2792|      0|    *content = NULL;
 2793|      0|    return nmetalayer;
 2794|      0|  }
 2795|    388|  *content = (uint8_t*)malloc((size_t)len);
 2796|    388|  if (*content == NULL) {
  ------------------
  |  Branch (2796:7): [True: 0, False: 388]
  ------------------
 2797|      0|    BLOSC_TRACE_ERROR("Unable to allocate metalayer content buffer.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2798|      0|    *content_len = 0;
 2799|      0|    return BLOSC2_ERROR_MEMORY_ALLOC;
 2800|      0|  }
 2801|    388|  if (len > 0 && schunk->metalayers[nmetalayer]->content == NULL) {
  ------------------
  |  Branch (2801:7): [True: 388, False: 0]
  |  Branch (2801:18): [True: 0, False: 388]
  ------------------
 2802|      0|    free(*content);
 2803|      0|    *content = NULL;
 2804|      0|    *content_len = 0;
 2805|      0|    BLOSC_TRACE_ERROR("Metalayer \"%s\" has corrupted content pointer.", name);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2806|      0|    return BLOSC2_ERROR_DATA;
 2807|      0|  }
 2808|    388|  memcpy(*content, schunk->metalayers[nmetalayer]->content, (size_t)len);
 2809|    388|  return nmetalayer;
 2810|    388|}
blosc2-zfp.c:blosc2_meta_exists:
 2705|    388|static inline int blosc2_meta_exists(blosc2_schunk *schunk, const char *name) {
 2706|    388|  if (strlen(name) > BLOSC2_METALAYER_NAME_MAXLEN) {
  ------------------
  |  | 1896|    388|#define BLOSC2_METALAYER_NAME_MAXLEN 31
  ------------------
  |  Branch (2706:7): [True: 0, False: 388]
  ------------------
 2707|      0|    BLOSC_TRACE_ERROR("Metalayers cannot be larger than %d chars.", BLOSC2_METALAYER_NAME_MAXLEN);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  ------------------
  |  |  |  |  |  | 2707|      0|    BLOSC_TRACE_ERROR("Metalayers cannot be larger than %d chars.", BLOSC2_METALAYER_NAME_MAXLEN);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1896|      0|#define BLOSC2_METALAYER_NAME_MAXLEN 31
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2708|      0|    return BLOSC2_ERROR_INVALID_PARAM;
 2709|      0|  }
 2710|       |
 2711|    388|  if (schunk == NULL) {
  ------------------
  |  Branch (2711:7): [True: 0, False: 388]
  ------------------
 2712|      0|    BLOSC_TRACE_ERROR("Schunk must not be NUll.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2713|      0|    return BLOSC2_ERROR_INVALID_PARAM;
 2714|      0|  }
 2715|       |
 2716|    388|  for (int nmetalayer = 0; nmetalayer < schunk->nmetalayers; nmetalayer++) {
  ------------------
  |  Branch (2716:28): [True: 388, False: 0]
  ------------------
 2717|    388|    if (strcmp(name, schunk->metalayers[nmetalayer]->name) == 0) {
  ------------------
  |  Branch (2717:9): [True: 388, False: 0]
  ------------------
 2718|    388|      return nmetalayer;
 2719|    388|    }
 2720|    388|  }
 2721|      0|  return BLOSC2_ERROR_NOT_FOUND;
 2722|    388|}
ndlz8x8.c:blosc2_meta_get:
 2774|      1|                                  int32_t *content_len) {
 2775|      1|  if (schunk == NULL || name == NULL || content == NULL || content_len == NULL) {
  ------------------
  |  Branch (2775:7): [True: 0, False: 1]
  |  Branch (2775:25): [True: 0, False: 1]
  |  Branch (2775:41): [True: 0, False: 1]
  |  Branch (2775:60): [True: 0, False: 1]
  ------------------
 2776|      0|    BLOSC_TRACE_ERROR("Invalid parameters.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2777|      0|    return BLOSC2_ERROR_INVALID_PARAM;
 2778|      0|  }
 2779|       |
 2780|      1|  int nmetalayer = blosc2_meta_exists(schunk, name);
 2781|      1|  if (nmetalayer < 0) {
  ------------------
  |  Branch (2781:7): [True: 0, False: 1]
  ------------------
 2782|      0|    BLOSC_TRACE_WARNING("Metalayer \"%s\" not found.", name);
  ------------------
  |  |   94|      0|#define BLOSC_TRACE_WARNING(msg, ...) BLOSC_TRACE(warning, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2783|      0|    return nmetalayer;
 2784|      0|  }
 2785|      1|  int32_t len = schunk->metalayers[nmetalayer]->content_len;
 2786|      1|  if (len < 0) {
  ------------------
  |  Branch (2786:7): [True: 0, False: 1]
  ------------------
 2787|      0|    BLOSC_TRACE_ERROR("Metalayer \"%s\" has corrupted content length %d.", name, len);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2788|      0|    return BLOSC2_ERROR_DATA;
 2789|      0|  }
 2790|      1|  *content_len = len;
 2791|      1|  if (len == 0) {
  ------------------
  |  Branch (2791:7): [True: 0, False: 1]
  ------------------
 2792|      0|    *content = NULL;
 2793|      0|    return nmetalayer;
 2794|      0|  }
 2795|      1|  *content = (uint8_t*)malloc((size_t)len);
 2796|      1|  if (*content == NULL) {
  ------------------
  |  Branch (2796:7): [True: 0, False: 1]
  ------------------
 2797|      0|    BLOSC_TRACE_ERROR("Unable to allocate metalayer content buffer.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2798|      0|    *content_len = 0;
 2799|      0|    return BLOSC2_ERROR_MEMORY_ALLOC;
 2800|      0|  }
 2801|      1|  if (len > 0 && schunk->metalayers[nmetalayer]->content == NULL) {
  ------------------
  |  Branch (2801:7): [True: 1, False: 0]
  |  Branch (2801:18): [True: 0, False: 1]
  ------------------
 2802|      0|    free(*content);
 2803|      0|    *content = NULL;
 2804|      0|    *content_len = 0;
 2805|      0|    BLOSC_TRACE_ERROR("Metalayer \"%s\" has corrupted content pointer.", name);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2806|      0|    return BLOSC2_ERROR_DATA;
 2807|      0|  }
 2808|      1|  memcpy(*content, schunk->metalayers[nmetalayer]->content, (size_t)len);
 2809|      1|  return nmetalayer;
 2810|      1|}
ndlz8x8.c:blosc2_meta_exists:
 2705|      1|static inline int blosc2_meta_exists(blosc2_schunk *schunk, const char *name) {
 2706|      1|  if (strlen(name) > BLOSC2_METALAYER_NAME_MAXLEN) {
  ------------------
  |  | 1896|      1|#define BLOSC2_METALAYER_NAME_MAXLEN 31
  ------------------
  |  Branch (2706:7): [True: 0, False: 1]
  ------------------
 2707|      0|    BLOSC_TRACE_ERROR("Metalayers cannot be larger than %d chars.", BLOSC2_METALAYER_NAME_MAXLEN);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  ------------------
  |  |  |  |  |  | 2707|      0|    BLOSC_TRACE_ERROR("Metalayers cannot be larger than %d chars.", BLOSC2_METALAYER_NAME_MAXLEN);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1896|      0|#define BLOSC2_METALAYER_NAME_MAXLEN 31
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2708|      0|    return BLOSC2_ERROR_INVALID_PARAM;
 2709|      0|  }
 2710|       |
 2711|      1|  if (schunk == NULL) {
  ------------------
  |  Branch (2711:7): [True: 0, False: 1]
  ------------------
 2712|      0|    BLOSC_TRACE_ERROR("Schunk must not be NUll.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2713|      0|    return BLOSC2_ERROR_INVALID_PARAM;
 2714|      0|  }
 2715|       |
 2716|      1|  for (int nmetalayer = 0; nmetalayer < schunk->nmetalayers; nmetalayer++) {
  ------------------
  |  Branch (2716:28): [True: 1, False: 0]
  ------------------
 2717|      1|    if (strcmp(name, schunk->metalayers[nmetalayer]->name) == 0) {
  ------------------
  |  Branch (2717:9): [True: 1, False: 0]
  ------------------
 2718|      1|      return nmetalayer;
 2719|      1|    }
 2720|      1|  }
 2721|      0|  return BLOSC2_ERROR_NOT_FOUND;
 2722|      1|}
ndcell.c:blosc2_meta_get:
 2774|    973|                                  int32_t *content_len) {
 2775|    973|  if (schunk == NULL || name == NULL || content == NULL || content_len == NULL) {
  ------------------
  |  Branch (2775:7): [True: 2, False: 971]
  |  Branch (2775:25): [True: 0, False: 971]
  |  Branch (2775:41): [True: 0, False: 971]
  |  Branch (2775:60): [True: 0, False: 971]
  ------------------
 2776|      2|    BLOSC_TRACE_ERROR("Invalid parameters.");
  ------------------
  |  |   93|      2|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      2|    do {                                            \
  |  |  |  |   98|      2|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      2|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 2, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      2|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2777|      2|    return BLOSC2_ERROR_INVALID_PARAM;
 2778|      2|  }
 2779|       |
 2780|    971|  int nmetalayer = blosc2_meta_exists(schunk, name);
 2781|    971|  if (nmetalayer < 0) {
  ------------------
  |  Branch (2781:7): [True: 0, False: 971]
  ------------------
 2782|      0|    BLOSC_TRACE_WARNING("Metalayer \"%s\" not found.", name);
  ------------------
  |  |   94|      0|#define BLOSC_TRACE_WARNING(msg, ...) BLOSC_TRACE(warning, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2783|      0|    return nmetalayer;
 2784|      0|  }
 2785|    971|  int32_t len = schunk->metalayers[nmetalayer]->content_len;
 2786|    971|  if (len < 0) {
  ------------------
  |  Branch (2786:7): [True: 0, False: 971]
  ------------------
 2787|      0|    BLOSC_TRACE_ERROR("Metalayer \"%s\" has corrupted content length %d.", name, len);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2788|      0|    return BLOSC2_ERROR_DATA;
 2789|      0|  }
 2790|    971|  *content_len = len;
 2791|    971|  if (len == 0) {
  ------------------
  |  Branch (2791:7): [True: 0, False: 971]
  ------------------
 2792|      0|    *content = NULL;
 2793|      0|    return nmetalayer;
 2794|      0|  }
 2795|    971|  *content = (uint8_t*)malloc((size_t)len);
 2796|    971|  if (*content == NULL) {
  ------------------
  |  Branch (2796:7): [True: 0, False: 971]
  ------------------
 2797|      0|    BLOSC_TRACE_ERROR("Unable to allocate metalayer content buffer.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2798|      0|    *content_len = 0;
 2799|      0|    return BLOSC2_ERROR_MEMORY_ALLOC;
 2800|      0|  }
 2801|    971|  if (len > 0 && schunk->metalayers[nmetalayer]->content == NULL) {
  ------------------
  |  Branch (2801:7): [True: 971, False: 0]
  |  Branch (2801:18): [True: 0, False: 971]
  ------------------
 2802|      0|    free(*content);
 2803|      0|    *content = NULL;
 2804|      0|    *content_len = 0;
 2805|      0|    BLOSC_TRACE_ERROR("Metalayer \"%s\" has corrupted content pointer.", name);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2806|      0|    return BLOSC2_ERROR_DATA;
 2807|      0|  }
 2808|    971|  memcpy(*content, schunk->metalayers[nmetalayer]->content, (size_t)len);
 2809|    971|  return nmetalayer;
 2810|    971|}
ndcell.c:blosc2_meta_exists:
 2705|    971|static inline int blosc2_meta_exists(blosc2_schunk *schunk, const char *name) {
 2706|    971|  if (strlen(name) > BLOSC2_METALAYER_NAME_MAXLEN) {
  ------------------
  |  | 1896|    971|#define BLOSC2_METALAYER_NAME_MAXLEN 31
  ------------------
  |  Branch (2706:7): [True: 0, False: 971]
  ------------------
 2707|      0|    BLOSC_TRACE_ERROR("Metalayers cannot be larger than %d chars.", BLOSC2_METALAYER_NAME_MAXLEN);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  ------------------
  |  |  |  |  |  | 2707|      0|    BLOSC_TRACE_ERROR("Metalayers cannot be larger than %d chars.", BLOSC2_METALAYER_NAME_MAXLEN);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1896|      0|#define BLOSC2_METALAYER_NAME_MAXLEN 31
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2708|      0|    return BLOSC2_ERROR_INVALID_PARAM;
 2709|      0|  }
 2710|       |
 2711|    971|  if (schunk == NULL) {
  ------------------
  |  Branch (2711:7): [True: 0, False: 971]
  ------------------
 2712|      0|    BLOSC_TRACE_ERROR("Schunk must not be NUll.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2713|      0|    return BLOSC2_ERROR_INVALID_PARAM;
 2714|      0|  }
 2715|       |
 2716|    971|  for (int nmetalayer = 0; nmetalayer < schunk->nmetalayers; nmetalayer++) {
  ------------------
  |  Branch (2716:28): [True: 971, False: 0]
  ------------------
 2717|    971|    if (strcmp(name, schunk->metalayers[nmetalayer]->name) == 0) {
  ------------------
  |  Branch (2717:9): [True: 971, False: 0]
  ------------------
 2718|    971|      return nmetalayer;
 2719|    971|    }
 2720|    971|  }
 2721|      0|  return BLOSC2_ERROR_NOT_FOUND;
 2722|    971|}
ndmean.c:blosc2_meta_get:
 2774|     51|                                  int32_t *content_len) {
 2775|     51|  if (schunk == NULL || name == NULL || content == NULL || content_len == NULL) {
  ------------------
  |  Branch (2775:7): [True: 3, False: 48]
  |  Branch (2775:25): [True: 0, False: 48]
  |  Branch (2775:41): [True: 0, False: 48]
  |  Branch (2775:60): [True: 0, False: 48]
  ------------------
 2776|      3|    BLOSC_TRACE_ERROR("Invalid parameters.");
  ------------------
  |  |   93|      3|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      3|    do {                                            \
  |  |  |  |   98|      3|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      3|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 3, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      3|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2777|      3|    return BLOSC2_ERROR_INVALID_PARAM;
 2778|      3|  }
 2779|       |
 2780|     48|  int nmetalayer = blosc2_meta_exists(schunk, name);
 2781|     48|  if (nmetalayer < 0) {
  ------------------
  |  Branch (2781:7): [True: 0, False: 48]
  ------------------
 2782|      0|    BLOSC_TRACE_WARNING("Metalayer \"%s\" not found.", name);
  ------------------
  |  |   94|      0|#define BLOSC_TRACE_WARNING(msg, ...) BLOSC_TRACE(warning, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2783|      0|    return nmetalayer;
 2784|      0|  }
 2785|     48|  int32_t len = schunk->metalayers[nmetalayer]->content_len;
 2786|     48|  if (len < 0) {
  ------------------
  |  Branch (2786:7): [True: 0, False: 48]
  ------------------
 2787|      0|    BLOSC_TRACE_ERROR("Metalayer \"%s\" has corrupted content length %d.", name, len);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2788|      0|    return BLOSC2_ERROR_DATA;
 2789|      0|  }
 2790|     48|  *content_len = len;
 2791|     48|  if (len == 0) {
  ------------------
  |  Branch (2791:7): [True: 0, False: 48]
  ------------------
 2792|      0|    *content = NULL;
 2793|      0|    return nmetalayer;
 2794|      0|  }
 2795|     48|  *content = (uint8_t*)malloc((size_t)len);
 2796|     48|  if (*content == NULL) {
  ------------------
  |  Branch (2796:7): [True: 0, False: 48]
  ------------------
 2797|      0|    BLOSC_TRACE_ERROR("Unable to allocate metalayer content buffer.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2798|      0|    *content_len = 0;
 2799|      0|    return BLOSC2_ERROR_MEMORY_ALLOC;
 2800|      0|  }
 2801|     48|  if (len > 0 && schunk->metalayers[nmetalayer]->content == NULL) {
  ------------------
  |  Branch (2801:7): [True: 48, False: 0]
  |  Branch (2801:18): [True: 0, False: 48]
  ------------------
 2802|      0|    free(*content);
 2803|      0|    *content = NULL;
 2804|      0|    *content_len = 0;
 2805|      0|    BLOSC_TRACE_ERROR("Metalayer \"%s\" has corrupted content pointer.", name);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2806|      0|    return BLOSC2_ERROR_DATA;
 2807|      0|  }
 2808|     48|  memcpy(*content, schunk->metalayers[nmetalayer]->content, (size_t)len);
 2809|     48|  return nmetalayer;
 2810|     48|}
ndmean.c:blosc2_meta_exists:
 2705|     48|static inline int blosc2_meta_exists(blosc2_schunk *schunk, const char *name) {
 2706|     48|  if (strlen(name) > BLOSC2_METALAYER_NAME_MAXLEN) {
  ------------------
  |  | 1896|     48|#define BLOSC2_METALAYER_NAME_MAXLEN 31
  ------------------
  |  Branch (2706:7): [True: 0, False: 48]
  ------------------
 2707|      0|    BLOSC_TRACE_ERROR("Metalayers cannot be larger than %d chars.", BLOSC2_METALAYER_NAME_MAXLEN);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  ------------------
  |  |  |  |  |  | 2707|      0|    BLOSC_TRACE_ERROR("Metalayers cannot be larger than %d chars.", BLOSC2_METALAYER_NAME_MAXLEN);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1896|      0|#define BLOSC2_METALAYER_NAME_MAXLEN 31
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2708|      0|    return BLOSC2_ERROR_INVALID_PARAM;
 2709|      0|  }
 2710|       |
 2711|     48|  if (schunk == NULL) {
  ------------------
  |  Branch (2711:7): [True: 0, False: 48]
  ------------------
 2712|      0|    BLOSC_TRACE_ERROR("Schunk must not be NUll.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2713|      0|    return BLOSC2_ERROR_INVALID_PARAM;
 2714|      0|  }
 2715|       |
 2716|     48|  for (int nmetalayer = 0; nmetalayer < schunk->nmetalayers; nmetalayer++) {
  ------------------
  |  Branch (2716:28): [True: 48, False: 0]
  ------------------
 2717|     48|    if (strcmp(name, schunk->metalayers[nmetalayer]->name) == 0) {
  ------------------
  |  Branch (2717:9): [True: 48, False: 0]
  ------------------
 2718|     48|      return nmetalayer;
 2719|     48|    }
 2720|     48|  }
 2721|      0|  return BLOSC2_ERROR_NOT_FOUND;
 2722|     48|}
bytedelta.c:print_error:
  525|     10|static inline char *print_error(int rc) {
  526|       |  // TODO: remove this function, use blosc2_error_string only
  527|     10|  return (char *) blosc2_error_string(rc);
  528|     10|}

register_codecs:
   18|  1.96k|void register_codecs(void) {
   19|       |  // May add .free func in future
   20|       |
   21|  1.96k|  blosc2_codec ndlz;
   22|  1.96k|  ndlz.compcode = BLOSC_CODEC_NDLZ;
   23|  1.96k|  ndlz.version = 1;
   24|  1.96k|  ndlz.complib = BLOSC_CODEC_NDLZ;
   25|  1.96k|  ndlz.encoder = &ndlz_compress;
   26|  1.96k|  ndlz.decoder = &ndlz_decompress;
   27|  1.96k|  ndlz.compname = "ndlz";
   28|       |  // ndlz.free = NULL; 
   29|  1.96k|  register_codec_private(&ndlz);
   30|       |
   31|  1.96k|#if defined(HAVE_ZFP)
   32|  1.96k|  blosc2_codec zfp_acc;
   33|  1.96k|  zfp_acc.compcode = BLOSC_CODEC_ZFP_FIXED_ACCURACY;
   34|  1.96k|  zfp_acc.version = 1;
   35|  1.96k|  zfp_acc.complib = BLOSC_CODEC_ZFP_FIXED_ACCURACY;
   36|  1.96k|  zfp_acc.encoder = &zfp_acc_compress;
   37|  1.96k|  zfp_acc.decoder = &zfp_acc_decompress;
   38|       |  // zfp_acc.free = NULL;
   39|  1.96k|  zfp_acc.compname = "zfp_acc";
   40|  1.96k|  register_codec_private(&zfp_acc);
   41|       |
   42|  1.96k|  blosc2_codec zfp_prec;
   43|  1.96k|  zfp_prec.compcode = BLOSC_CODEC_ZFP_FIXED_PRECISION;
   44|  1.96k|  zfp_prec.version = 1;
   45|  1.96k|  zfp_prec.complib = BLOSC_CODEC_ZFP_FIXED_PRECISION;
   46|  1.96k|  zfp_prec.encoder = &zfp_prec_compress;
   47|  1.96k|  zfp_prec.decoder = &zfp_prec_decompress;
   48|       |  // zfp_prec.free = NULL;
   49|  1.96k|  zfp_prec.compname = "zfp_prec";
   50|  1.96k|  register_codec_private(&zfp_prec);
   51|       |
   52|  1.96k|  blosc2_codec zfp_rate;
   53|  1.96k|  zfp_rate.compcode = BLOSC_CODEC_ZFP_FIXED_RATE;
   54|  1.96k|  zfp_rate.version = 1;
   55|  1.96k|  zfp_rate.complib = BLOSC_CODEC_ZFP_FIXED_RATE;
   56|  1.96k|  zfp_rate.encoder = &zfp_rate_compress;
   57|  1.96k|  zfp_rate.decoder = &zfp_rate_decompress;
   58|  1.96k|  zfp_rate.compname = "zfp_rate";
   59|       |  // zfp_rate.free = NULL;
   60|  1.96k|  register_codec_private(&zfp_rate);
   61|  1.96k|#endif
   62|       |
   63|  1.96k|  blosc2_codec openhtj2k;
   64|  1.96k|  openhtj2k.compcode = BLOSC_CODEC_OPENHTJ2K;
   65|  1.96k|  openhtj2k.version = 1;
   66|  1.96k|  openhtj2k.complib = BLOSC_CODEC_OPENHTJ2K;
   67|  1.96k|  openhtj2k.encoder = NULL;
   68|  1.96k|  openhtj2k.decoder = NULL;
   69|       |  // openhtj2k.free = NULL;
   70|  1.96k|  openhtj2k.compname = "openhtj2k";
   71|  1.96k|  register_codec_private(&openhtj2k);
   72|       |
   73|  1.96k|  blosc2_codec grok;
   74|  1.96k|  grok.compcode = BLOSC_CODEC_GROK;
   75|  1.96k|  grok.version = 1;
   76|  1.96k|  grok.complib = BLOSC_CODEC_GROK;
   77|  1.96k|  grok.encoder = NULL;
   78|  1.96k|  grok.decoder = NULL;
   79|       |  // grok.free = NULL;
   80|  1.96k|  grok.compname = "grok";
   81|  1.96k|  register_codec_private(&grok);
   82|       |
   83|  1.96k|  blosc2_codec openzl;
   84|  1.96k|  openzl.compcode = BLOSC_CODEC_OPENZL;
   85|  1.96k|  openzl.version = 1;
   86|  1.96k|  openzl.complib = BLOSC_CODEC_OPENZL;
   87|  1.96k|  openzl.encoder = NULL;
   88|  1.96k|  openzl.decoder = NULL;
   89|       |  // openzl.free = NULL;
   90|  1.96k|  openzl.compname = "openzl";
   91|  1.96k|  register_codec_private(&openzl);
   92|       |
   93|  1.96k|  blosc2_codec j2k;
   94|  1.96k|  j2k.compcode = BLOSC_CODEC_J2K;
   95|  1.96k|  j2k.version = 1;
   96|  1.96k|  j2k.complib = BLOSC_CODEC_J2K;
   97|  1.96k|  j2k.encoder = NULL;
   98|  1.96k|  j2k.decoder = NULL;
   99|       |  // j2k.free = NULL;
  100|  1.96k|  j2k.compname = "j2k";
  101|  1.96k|  register_codec_private(&j2k);
  102|       |
  103|  1.96k|  blosc2_codec htj2k;
  104|  1.96k|  htj2k.compcode = BLOSC_CODEC_HTJ2K;
  105|  1.96k|  htj2k.version = 1;
  106|  1.96k|  htj2k.complib = BLOSC_CODEC_HTJ2K;
  107|  1.96k|  htj2k.encoder = NULL;
  108|  1.96k|  htj2k.decoder = NULL;
  109|       |  // htj2k.free = NULL;
  110|  1.96k|  htj2k.compname = "htj2k";
  111|  1.96k|  register_codec_private(&htj2k);
  112|  1.96k|}

ndlz_compress:
   24|      1|                  uint8_t meta, blosc2_cparams *cparams, const void *chunk) {
   25|      1|  NDLZ_ERROR_NULL(input);
  ------------------
  |  |   19|      1|  do {                           \
  |  |   20|      1|    if ((pointer) == NULL) {     \
  |  |  ------------------
  |  |  |  Branch (20:9): [True: 0, False: 1]
  |  |  ------------------
  |  |   21|      0|      return 0;                  \
  |  |   22|      0|    }                            \
  |  |   23|      1|  } while (0)
  |  |  ------------------
  |  |  |  Branch (23:12): [Folded, False: 1]
  |  |  ------------------
  ------------------
   26|      1|  NDLZ_ERROR_NULL(output);
  ------------------
  |  |   19|      1|  do {                           \
  |  |   20|      1|    if ((pointer) == NULL) {     \
  |  |  ------------------
  |  |  |  Branch (20:9): [True: 0, False: 1]
  |  |  ------------------
  |  |   21|      0|      return 0;                  \
  |  |   22|      0|    }                            \
  |  |   23|      1|  } while (0)
  |  |  ------------------
  |  |  |  Branch (23:12): [Folded, False: 1]
  |  |  ------------------
  ------------------
   27|      1|  NDLZ_ERROR_NULL(cparams);
  ------------------
  |  |   19|      1|  do {                           \
  |  |   20|      1|    if ((pointer) == NULL) {     \
  |  |  ------------------
  |  |  |  Branch (20:9): [True: 0, False: 1]
  |  |  ------------------
  |  |   21|      0|      return 0;                  \
  |  |   22|      0|    }                            \
  |  |   23|      1|  } while (0)
  |  |  ------------------
  |  |  |  Branch (23:12): [Folded, False: 1]
  |  |  ------------------
  ------------------
   28|      1|  BLOSC_UNUSED_PARAM(chunk);
  ------------------
  |  |   28|      1|#define BLOSC_UNUSED_PARAM(x) ((void)(x))
  ------------------
   29|       |
   30|      1|  switch (meta) {
   31|      0|    case 4:
  ------------------
  |  Branch (31:5): [True: 0, False: 1]
  ------------------
   32|      0|      return ndlz4_compress(input, input_len, output, output_len, meta, cparams);
   33|      1|    case 8:
  ------------------
  |  Branch (33:5): [True: 1, False: 0]
  ------------------
   34|      1|      return ndlz8_compress(input, input_len, output, output_len, meta, cparams);
   35|      0|    default:
  ------------------
  |  Branch (35:5): [True: 0, False: 1]
  ------------------
   36|      0|      BLOSC_TRACE_ERROR("NDLZ is not available for this cellsize: %d", meta);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
   37|      1|  }
   38|      0|  return BLOSC2_ERROR_FAILURE;
   39|      1|}
ndlz_decompress:
   42|      3|                    uint8_t meta, blosc2_dparams *dparams, const void *chunk) {
   43|      3|  NDLZ_ERROR_NULL(input);
  ------------------
  |  |   19|      3|  do {                           \
  |  |   20|      3|    if ((pointer) == NULL) {     \
  |  |  ------------------
  |  |  |  Branch (20:9): [True: 0, False: 3]
  |  |  ------------------
  |  |   21|      0|      return 0;                  \
  |  |   22|      0|    }                            \
  |  |   23|      3|  } while (0)
  |  |  ------------------
  |  |  |  Branch (23:12): [Folded, False: 3]
  |  |  ------------------
  ------------------
   44|      3|  NDLZ_ERROR_NULL(output);
  ------------------
  |  |   19|      3|  do {                           \
  |  |   20|      3|    if ((pointer) == NULL) {     \
  |  |  ------------------
  |  |  |  Branch (20:9): [True: 0, False: 3]
  |  |  ------------------
  |  |   21|      0|      return 0;                  \
  |  |   22|      0|    }                            \
  |  |   23|      3|  } while (0)
  |  |  ------------------
  |  |  |  Branch (23:12): [Folded, False: 3]
  |  |  ------------------
  ------------------
   45|      3|  NDLZ_ERROR_NULL(dparams);
  ------------------
  |  |   19|      3|  do {                           \
  |  |   20|      3|    if ((pointer) == NULL) {     \
  |  |  ------------------
  |  |  |  Branch (20:9): [True: 0, False: 3]
  |  |  ------------------
  |  |   21|      0|      return 0;                  \
  |  |   22|      0|    }                            \
  |  |   23|      3|  } while (0)
  |  |  ------------------
  |  |  |  Branch (23:12): [Folded, False: 3]
  |  |  ------------------
  ------------------
   46|      3|  BLOSC_UNUSED_PARAM(chunk);
  ------------------
  |  |   28|      3|#define BLOSC_UNUSED_PARAM(x) ((void)(x))
  ------------------
   47|       |
   48|      3|  switch (meta) {
   49|      1|    case 4:
  ------------------
  |  Branch (49:5): [True: 1, False: 2]
  ------------------
   50|      1|      return ndlz4_decompress(input, input_len, output, output_len, meta, dparams);
   51|      1|    case 8:
  ------------------
  |  Branch (51:5): [True: 1, False: 2]
  ------------------
   52|      1|      return ndlz8_decompress(input, input_len, output, output_len, meta, dparams);
   53|      1|    default:
  ------------------
  |  Branch (53:5): [True: 1, False: 2]
  ------------------
   54|      1|      BLOSC_TRACE_ERROR("NDLZ is not available for this cellsize: %d", meta);
  ------------------
  |  |   93|      1|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      1|    do {                                            \
  |  |  |  |   98|      1|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      1|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 1, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      1|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
   55|      3|  }
   56|      1|  return BLOSC2_ERROR_FAILURE;
   57|      3|}

ndlz4_decompress:
  526|      1|                     uint8_t meta, blosc2_dparams *dparams) {
  527|      1|  BLOSC_UNUSED_PARAM(meta);
  ------------------
  |  |   28|      1|#define BLOSC_UNUSED_PARAM(x) ((void)(x))
  ------------------
  528|      1|  BLOSC_UNUSED_PARAM(dparams);
  ------------------
  |  |   28|      1|#define BLOSC_UNUSED_PARAM(x) ((void)(x))
  ------------------
  529|      1|  BLOSC_ERROR_NULL(input, BLOSC2_ERROR_NULL_POINTER);
  ------------------
  |  |  104|      1|    do {                                            \
  |  |  105|      1|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 1]
  |  |  ------------------
  |  |  106|      0|            BLOSC_TRACE_ERROR("Pointer is null");   \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  107|      0|            return (rc);                            \
  |  |  108|      0|        }                                           \
  |  |  109|      1|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 1]
  |  |  ------------------
  ------------------
  530|      1|  BLOSC_ERROR_NULL(output, BLOSC2_ERROR_NULL_POINTER);
  ------------------
  |  |  104|      1|    do {                                            \
  |  |  105|      1|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 1]
  |  |  ------------------
  |  |  106|      0|            BLOSC_TRACE_ERROR("Pointer is null");   \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  107|      0|            return (rc);                            \
  |  |  108|      0|        }                                           \
  |  |  109|      1|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 1]
  |  |  ------------------
  ------------------
  531|       |
  532|      1|  uint8_t *ip = (uint8_t *) input;
  533|      1|  uint8_t *op = (uint8_t *) output;
  534|      1|  uint8_t ndim;
  535|      1|  int32_t blockshape[2];
  536|      1|  int32_t eshape[2];
  537|      1|  uint8_t *buffercpy;
  538|      1|  uint8_t local_buffer[16];
  539|      1|  uint8_t token;
  540|       |  // The fixed header is 1 (ndim) + 2 * int32 (blockshape) = 9 bytes.  Reject any
  541|       |  // input too short to hold it -- the previous `< 8` check let an 8-byte input
  542|       |  // through and the header parse below then read a 9th byte.  The cast keeps the
  543|       |  // comparison signed so a negative `input_len` is rejected here, before the
  544|       |  // `ip + input_len` pointer arithmetic (which would otherwise be UB) is reached.
  545|      1|  if (NDLZ_UNEXPECT_CONDITIONAL(input_len < (int32_t) (1 + 2 * sizeof(int32_t)))) {
  ------------------
  |  |   30|      1|#define NDLZ_UNEXPECT_CONDITIONAL(c)  (__builtin_expect((c), 0))
  |  |  ------------------
  |  |  |  Branch (30:39): [True: 1, False: 0]
  |  |  ------------------
  ------------------
  546|      1|    return 0;
  547|      1|  }
  548|      0|  uint8_t *ip_limit = ip + input_len;
  549|       |
  550|       |  // Validate that a read of `len` bytes starting at byte offset `pos` (measured
  551|       |  // from the start of `input`) lies fully within the compressed buffer.  A
  552|       |  // crafted token `offset` otherwise makes a back-reference point before
  553|       |  // `input`, and the cell-fill memcpy then leaks out-of-bounds heap memory into
  554|       |  // the (attacker-visible) output buffer -- CWE-125.  The per-cell `ip > ip_limit`
  555|       |  // check is not enough because each cell reads a 2-byte offset and literal bytes
  556|       |  // past that point.  All arithmetic is done on integer offsets so we never form
  557|       |  // an out-of-bounds pointer (which is undefined behaviour in C, even when the
  558|       |  // pointer is only compared and not dereferenced).
  559|      0|#define NDLZ4_CHECK_RANGE(pos, len)                                              \
  560|      0|  do {                                                                           \
  561|      0|    int64_t _pos = (int64_t) (pos);                                              \
  562|      0|    int64_t _len = (int64_t) (len);                                              \
  563|      0|    if (_pos < 0 || _len < 0 || _pos > (int64_t) input_len - _len) {             \
  564|      0|      BLOSC_TRACE_ERROR("ndlz4: out-of-bounds reference in compressed stream");  \
  565|      0|      return BLOSC2_ERROR_FAILURE;                                               \
  566|      0|    }                                                                            \
  567|      0|  } while (0)
  568|       |
  569|       |  /* we start with literal copy */
  570|      0|  ndim = *ip;
  571|      0|  ip++;
  572|      0|  if (ndim != 2) {
  ------------------
  |  Branch (572:7): [True: 0, False: 0]
  ------------------
  573|      0|    BLOSC_TRACE_ERROR("This codec only works for ndim = 2");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  574|      0|    return BLOSC2_ERROR_FAILURE;
  575|      0|  }
  576|      0|  memcpy(&blockshape[0], ip, 4);
  577|      0|  ip += 4;
  578|      0|  memcpy(&blockshape[1], ip, 4);
  579|      0|  ip += 4;
  580|       |
  581|       |  // Sanity check.  See https://www.cve.org/CVERecord?id=CVE-2024-3204
  582|      0|  if (output_len < 0 || blockshape[0] < 0 || blockshape[1] < 0) {
  ------------------
  |  Branch (582:7): [True: 0, False: 0]
  |  Branch (582:25): [True: 0, False: 0]
  |  Branch (582:46): [True: 0, False: 0]
  ------------------
  583|      0|    BLOSC_TRACE_ERROR("Output length or blockshape is negative");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  584|      0|    return BLOSC2_ERROR_FAILURE;
  585|      0|  }
  586|       |
  587|      0|  eshape[0] = ((blockshape[0] + 3) / 4) * 4;
  588|      0|  eshape[1] = ((blockshape[1] + 3) / 4) * 4;
  589|       |
  590|      0|  if (NDLZ_UNEXPECT_CONDITIONAL((int64_t)output_len < (int64_t)blockshape[0] * (int64_t)blockshape[1])) {
  ------------------
  |  |   30|      0|#define NDLZ_UNEXPECT_CONDITIONAL(c)  (__builtin_expect((c), 0))
  |  |  ------------------
  |  |  |  Branch (30:39): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  591|      0|    BLOSC_TRACE_ERROR("The blockshape is bigger than the output buffer");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  592|      0|    return 0;
  593|      0|  }
  594|      0|  memset(op, 0, blockshape[0] * blockshape[1]);
  595|       |
  596|      0|  uint32_t i_stop[2];
  597|      0|  for (int i = 0; i < 2; ++i) {
  ------------------
  |  Branch (597:19): [True: 0, False: 0]
  ------------------
  598|      0|    i_stop[i] = eshape[i] / 4;
  599|      0|  }
  600|       |
  601|       |  /* main loop */
  602|      0|  uint32_t ii[2];
  603|      0|  uint32_t padding[2] = {0};
  604|      0|  uint32_t ind = 0;
  605|      0|  uint8_t cell_aux[16];
  606|      0|  for (ii[0] = 0; ii[0] < i_stop[0]; ++ii[0]) {
  ------------------
  |  Branch (606:19): [True: 0, False: 0]
  ------------------
  607|      0|    for (ii[1] = 0; ii[1] < i_stop[1]; ++ii[1]) {      // for each cell
  ------------------
  |  Branch (607:21): [True: 0, False: 0]
  ------------------
  608|      0|      if (NDLZ_UNEXPECT_CONDITIONAL(ip > ip_limit)) {
  ------------------
  |  |   30|      0|#define NDLZ_UNEXPECT_CONDITIONAL(c)  (__builtin_expect((c), 0))
  |  |  ------------------
  |  |  |  Branch (30:39): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  609|      0|        BLOSC_TRACE_ERROR("Exceeding input length");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  610|      0|        return BLOSC2_ERROR_FAILURE;
  611|      0|      }
  612|      0|      if (ii[0] == i_stop[0] - 1) {
  ------------------
  |  Branch (612:11): [True: 0, False: 0]
  ------------------
  613|      0|        padding[0] = (blockshape[0] % 4 == 0) ? 4 : blockshape[0] % 4;
  ------------------
  |  Branch (613:22): [True: 0, False: 0]
  ------------------
  614|      0|      } else {
  615|      0|        padding[0] = 4;
  616|      0|      }
  617|      0|      if (ii[1] == i_stop[1] - 1) {
  ------------------
  |  Branch (617:11): [True: 0, False: 0]
  ------------------
  618|      0|        padding[1] = (blockshape[1] % 4 == 0) ? 4 : blockshape[1] % 4;
  ------------------
  |  Branch (618:22): [True: 0, False: 0]
  ------------------
  619|      0|      } else {
  620|      0|        padding[1] = 4;
  621|      0|      }
  622|      0|      int64_t cur = ip - (const uint8_t *) input;   // in-range: ip is within [input, ip_limit]
  623|      0|      NDLZ4_CHECK_RANGE(cur, 1);
  ------------------
  |  |  560|      0|  do {                                                                           \
  |  |  561|      0|    int64_t _pos = (int64_t) (pos);                                              \
  |  |  562|      0|    int64_t _len = (int64_t) (len);                                              \
  |  |  563|      0|    if (_pos < 0 || _len < 0 || _pos > (int64_t) input_len - _len) {             \
  |  |  ------------------
  |  |  |  Branch (563:9): [True: 0, False: 0]
  |  |  |  Branch (563:21): [True: 0, False: 0]
  |  |  |  Branch (563:33): [True: 0, False: 0]
  |  |  ------------------
  |  |  564|      0|      BLOSC_TRACE_ERROR("ndlz4: out-of-bounds reference in compressed stream");  \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  565|      0|      return BLOSC2_ERROR_FAILURE;                                               \
  |  |  566|      0|    }                                                                            \
  |  |  567|      0|  } while (0)
  |  |  ------------------
  |  |  |  Branch (567:12): [Folded, False: 0]
  |  |  ------------------
  ------------------
  624|      0|      token = *ip++;
  625|      0|      if (token == 0) {    // no match
  ------------------
  |  Branch (625:11): [True: 0, False: 0]
  ------------------
  626|      0|        NDLZ4_CHECK_RANGE(cur + 1, (int64_t) padding[0] * padding[1]);
  ------------------
  |  |  560|      0|  do {                                                                           \
  |  |  561|      0|    int64_t _pos = (int64_t) (pos);                                              \
  |  |  562|      0|    int64_t _len = (int64_t) (len);                                              \
  |  |  563|      0|    if (_pos < 0 || _len < 0 || _pos > (int64_t) input_len - _len) {             \
  |  |  ------------------
  |  |  |  Branch (563:9): [True: 0, False: 0]
  |  |  |  Branch (563:21): [True: 0, False: 0]
  |  |  |  Branch (563:33): [True: 0, False: 0]
  |  |  ------------------
  |  |  564|      0|      BLOSC_TRACE_ERROR("ndlz4: out-of-bounds reference in compressed stream");  \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  565|      0|      return BLOSC2_ERROR_FAILURE;                                               \
  |  |  566|      0|    }                                                                            \
  |  |  567|      0|  } while (0)
  |  |  ------------------
  |  |  |  Branch (567:12): [Folded, False: 0]
  |  |  ------------------
  ------------------
  627|      0|        buffercpy = ip;
  628|      0|        ip += padding[0] * padding[1];
  629|      0|      } else if (token == (uint8_t) ((1U << 7U) | (1U << 6U))) {  // cell match
  ------------------
  |  Branch (629:18): [True: 0, False: 0]
  ------------------
  630|      0|        NDLZ4_CHECK_RANGE(cur + 1, 2);
  ------------------
  |  |  560|      0|  do {                                                                           \
  |  |  561|      0|    int64_t _pos = (int64_t) (pos);                                              \
  |  |  562|      0|    int64_t _len = (int64_t) (len);                                              \
  |  |  563|      0|    if (_pos < 0 || _len < 0 || _pos > (int64_t) input_len - _len) {             \
  |  |  ------------------
  |  |  |  Branch (563:9): [True: 0, False: 0]
  |  |  |  Branch (563:21): [True: 0, False: 0]
  |  |  |  Branch (563:33): [True: 0, False: 0]
  |  |  ------------------
  |  |  564|      0|      BLOSC_TRACE_ERROR("ndlz4: out-of-bounds reference in compressed stream");  \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  565|      0|      return BLOSC2_ERROR_FAILURE;                                               \
  |  |  566|      0|    }                                                                            \
  |  |  567|      0|  } while (0)
  |  |  ------------------
  |  |  |  Branch (567:12): [Folded, False: 0]
  |  |  ------------------
  ------------------
  631|      0|        uint16_t offset;
  632|      0|        memcpy(&offset, ip, sizeof(offset));
  633|      0|        int64_t bpos = (cur + 1) - (int64_t) offset - 1;   // back-reference start offset
  634|      0|        NDLZ4_CHECK_RANGE(bpos, (int64_t) padding[0] * padding[1]);
  ------------------
  |  |  560|      0|  do {                                                                           \
  |  |  561|      0|    int64_t _pos = (int64_t) (pos);                                              \
  |  |  562|      0|    int64_t _len = (int64_t) (len);                                              \
  |  |  563|      0|    if (_pos < 0 || _len < 0 || _pos > (int64_t) input_len - _len) {             \
  |  |  ------------------
  |  |  |  Branch (563:9): [True: 0, False: 0]
  |  |  |  Branch (563:21): [True: 0, False: 0]
  |  |  |  Branch (563:33): [True: 0, False: 0]
  |  |  ------------------
  |  |  564|      0|      BLOSC_TRACE_ERROR("ndlz4: out-of-bounds reference in compressed stream");  \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  565|      0|      return BLOSC2_ERROR_FAILURE;                                               \
  |  |  566|      0|    }                                                                            \
  |  |  567|      0|  } while (0)
  |  |  ------------------
  |  |  |  Branch (567:12): [Folded, False: 0]
  |  |  ------------------
  ------------------
  635|      0|        buffercpy = (uint8_t *) input + bpos;
  636|      0|        ip += 2;
  637|      0|      } else if (token == (uint8_t) (1U << 6U)) { // whole cell of same element
  ------------------
  |  Branch (637:18): [True: 0, False: 0]
  ------------------
  638|      0|        NDLZ4_CHECK_RANGE(cur + 1, 1);
  ------------------
  |  |  560|      0|  do {                                                                           \
  |  |  561|      0|    int64_t _pos = (int64_t) (pos);                                              \
  |  |  562|      0|    int64_t _len = (int64_t) (len);                                              \
  |  |  563|      0|    if (_pos < 0 || _len < 0 || _pos > (int64_t) input_len - _len) {             \
  |  |  ------------------
  |  |  |  Branch (563:9): [True: 0, False: 0]
  |  |  |  Branch (563:21): [True: 0, False: 0]
  |  |  |  Branch (563:33): [True: 0, False: 0]
  |  |  ------------------
  |  |  564|      0|      BLOSC_TRACE_ERROR("ndlz4: out-of-bounds reference in compressed stream");  \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  565|      0|      return BLOSC2_ERROR_FAILURE;                                               \
  |  |  566|      0|    }                                                                            \
  |  |  567|      0|  } while (0)
  |  |  ------------------
  |  |  |  Branch (567:12): [Folded, False: 0]
  |  |  ------------------
  ------------------
  639|      0|        buffercpy = cell_aux;
  640|      0|        memset(buffercpy, *ip, 16);
  641|      0|        ip++;
  642|      0|      } else if (token >= 224) { // three rows match
  ------------------
  |  Branch (642:18): [True: 0, False: 0]
  ------------------
  643|      0|        buffercpy = local_buffer;
  644|      0|        NDLZ4_CHECK_RANGE(cur + 1, 2);
  ------------------
  |  |  560|      0|  do {                                                                           \
  |  |  561|      0|    int64_t _pos = (int64_t) (pos);                                              \
  |  |  562|      0|    int64_t _len = (int64_t) (len);                                              \
  |  |  563|      0|    if (_pos < 0 || _len < 0 || _pos > (int64_t) input_len - _len) {             \
  |  |  ------------------
  |  |  |  Branch (563:9): [True: 0, False: 0]
  |  |  |  Branch (563:21): [True: 0, False: 0]
  |  |  |  Branch (563:33): [True: 0, False: 0]
  |  |  ------------------
  |  |  564|      0|      BLOSC_TRACE_ERROR("ndlz4: out-of-bounds reference in compressed stream");  \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  565|      0|      return BLOSC2_ERROR_FAILURE;                                               \
  |  |  566|      0|    }                                                                            \
  |  |  567|      0|  } while (0)
  |  |  ------------------
  |  |  |  Branch (567:12): [Folded, False: 0]
  |  |  ------------------
  ------------------
  645|      0|        uint16_t offset;
  646|      0|        memcpy(&offset, ip, sizeof(offset));
  647|      0|        offset += 3;
  648|      0|        ip += 2;
  649|      0|        int i, j, k;
  650|      0|        if ((token >> 3U) == 28) {
  ------------------
  |  Branch (650:13): [True: 0, False: 0]
  ------------------
  651|      0|          i = 1;
  652|      0|          j = 2;
  653|      0|          k = 3;
  654|      0|        } else {
  655|      0|          i = 0;
  656|      0|          if ((token >> 3U) < 30) {
  ------------------
  |  Branch (656:15): [True: 0, False: 0]
  ------------------
  657|      0|            j = 1;
  658|      0|            k = 2;
  659|      0|          } else {
  660|      0|            k = 3;
  661|      0|            if ((token >> 3U) == 30) {
  ------------------
  |  Branch (661:17): [True: 0, False: 0]
  ------------------
  662|      0|              j = 1;
  663|      0|            } else {
  664|      0|              j = 2;
  665|      0|            }
  666|      0|          }
  667|      0|        }
  668|      0|        int64_t bpos = (cur + 3) - (int64_t) offset;   // == (ip - offset) as an offset
  669|      0|        NDLZ4_CHECK_RANGE(bpos, 12);
  ------------------
  |  |  560|      0|  do {                                                                           \
  |  |  561|      0|    int64_t _pos = (int64_t) (pos);                                              \
  |  |  562|      0|    int64_t _len = (int64_t) (len);                                              \
  |  |  563|      0|    if (_pos < 0 || _len < 0 || _pos > (int64_t) input_len - _len) {             \
  |  |  ------------------
  |  |  |  Branch (563:9): [True: 0, False: 0]
  |  |  |  Branch (563:21): [True: 0, False: 0]
  |  |  |  Branch (563:33): [True: 0, False: 0]
  |  |  ------------------
  |  |  564|      0|      BLOSC_TRACE_ERROR("ndlz4: out-of-bounds reference in compressed stream");  \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  565|      0|      return BLOSC2_ERROR_FAILURE;                                               \
  |  |  566|      0|    }                                                                            \
  |  |  567|      0|  } while (0)
  |  |  ------------------
  |  |  |  Branch (567:12): [Folded, False: 0]
  |  |  ------------------
  ------------------
  670|      0|        const uint8_t *ref = (const uint8_t *) input + bpos;
  671|      0|        memcpy(&buffercpy[i * 4], ref, 4);
  672|      0|        memcpy(&buffercpy[j * 4], ref + 4, 4);
  673|      0|        memcpy(&buffercpy[k * 4], ref + 8, 4);
  674|      0|        for (int l = 0; l < 4; l++) {
  ------------------
  |  Branch (674:25): [True: 0, False: 0]
  ------------------
  675|      0|          if ((l != i) && (l != j) && (l != k)) {
  ------------------
  |  Branch (675:15): [True: 0, False: 0]
  |  Branch (675:27): [True: 0, False: 0]
  |  Branch (675:39): [True: 0, False: 0]
  ------------------
  676|      0|            NDLZ4_CHECK_RANGE(ip - (const uint8_t *) input, 4);
  ------------------
  |  |  560|      0|  do {                                                                           \
  |  |  561|      0|    int64_t _pos = (int64_t) (pos);                                              \
  |  |  562|      0|    int64_t _len = (int64_t) (len);                                              \
  |  |  563|      0|    if (_pos < 0 || _len < 0 || _pos > (int64_t) input_len - _len) {             \
  |  |  ------------------
  |  |  |  Branch (563:9): [True: 0, False: 0]
  |  |  |  Branch (563:21): [True: 0, False: 0]
  |  |  |  Branch (563:33): [True: 0, False: 0]
  |  |  ------------------
  |  |  564|      0|      BLOSC_TRACE_ERROR("ndlz4: out-of-bounds reference in compressed stream");  \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  565|      0|      return BLOSC2_ERROR_FAILURE;                                               \
  |  |  566|      0|    }                                                                            \
  |  |  567|      0|  } while (0)
  |  |  ------------------
  |  |  |  Branch (567:12): [Folded, False: 0]
  |  |  ------------------
  ------------------
  677|      0|            memcpy(&buffercpy[l * 4], ip, 4);
  678|      0|            ip += 4;
  679|      0|            break;
  680|      0|          }
  681|      0|        }
  682|       |
  683|      0|      } else if ((token >= 128) && (token <= 191)) { // rows pair match
  ------------------
  |  Branch (683:18): [True: 0, False: 0]
  |  Branch (683:36): [True: 0, False: 0]
  ------------------
  684|      0|        buffercpy = local_buffer;
  685|      0|        NDLZ4_CHECK_RANGE(cur + 1, 2);
  ------------------
  |  |  560|      0|  do {                                                                           \
  |  |  561|      0|    int64_t _pos = (int64_t) (pos);                                              \
  |  |  562|      0|    int64_t _len = (int64_t) (len);                                              \
  |  |  563|      0|    if (_pos < 0 || _len < 0 || _pos > (int64_t) input_len - _len) {             \
  |  |  ------------------
  |  |  |  Branch (563:9): [True: 0, False: 0]
  |  |  |  Branch (563:21): [True: 0, False: 0]
  |  |  |  Branch (563:33): [True: 0, False: 0]
  |  |  ------------------
  |  |  564|      0|      BLOSC_TRACE_ERROR("ndlz4: out-of-bounds reference in compressed stream");  \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  565|      0|      return BLOSC2_ERROR_FAILURE;                                               \
  |  |  566|      0|    }                                                                            \
  |  |  567|      0|  } while (0)
  |  |  ------------------
  |  |  |  Branch (567:12): [Folded, False: 0]
  |  |  ------------------
  ------------------
  686|      0|        uint16_t offset;
  687|      0|        memcpy(&offset, ip, sizeof(offset));
  688|      0|        offset += 3;
  689|      0|        ip += 2;
  690|      0|        int i, j;
  691|      0|        if (token == 128) {
  ------------------
  |  Branch (691:13): [True: 0, False: 0]
  ------------------
  692|      0|          i = 2;
  693|      0|          j = 3;
  694|      0|        } else {
  695|      0|          i = (token - 128) >> 5U;
  696|      0|          j = ((token - 128) >> 3U) - (i << 2U);
  697|      0|        }
  698|      0|        int64_t bpos = (cur + 3) - (int64_t) offset;
  699|      0|        NDLZ4_CHECK_RANGE(bpos, 8);
  ------------------
  |  |  560|      0|  do {                                                                           \
  |  |  561|      0|    int64_t _pos = (int64_t) (pos);                                              \
  |  |  562|      0|    int64_t _len = (int64_t) (len);                                              \
  |  |  563|      0|    if (_pos < 0 || _len < 0 || _pos > (int64_t) input_len - _len) {             \
  |  |  ------------------
  |  |  |  Branch (563:9): [True: 0, False: 0]
  |  |  |  Branch (563:21): [True: 0, False: 0]
  |  |  |  Branch (563:33): [True: 0, False: 0]
  |  |  ------------------
  |  |  564|      0|      BLOSC_TRACE_ERROR("ndlz4: out-of-bounds reference in compressed stream");  \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  565|      0|      return BLOSC2_ERROR_FAILURE;                                               \
  |  |  566|      0|    }                                                                            \
  |  |  567|      0|  } while (0)
  |  |  ------------------
  |  |  |  Branch (567:12): [Folded, False: 0]
  |  |  ------------------
  ------------------
  700|      0|        const uint8_t *ref = (const uint8_t *) input + bpos;
  701|      0|        memcpy(&buffercpy[i * 4], ref, 4);
  702|      0|        memcpy(&buffercpy[j * 4], ref + 4, 4);
  703|      0|        for (int k = 0; k < 4; k++) {
  ------------------
  |  Branch (703:25): [True: 0, False: 0]
  ------------------
  704|      0|          if ((k != i) && (k != j)) {
  ------------------
  |  Branch (704:15): [True: 0, False: 0]
  |  Branch (704:27): [True: 0, False: 0]
  ------------------
  705|      0|            NDLZ4_CHECK_RANGE(ip - (const uint8_t *) input, 4);
  ------------------
  |  |  560|      0|  do {                                                                           \
  |  |  561|      0|    int64_t _pos = (int64_t) (pos);                                              \
  |  |  562|      0|    int64_t _len = (int64_t) (len);                                              \
  |  |  563|      0|    if (_pos < 0 || _len < 0 || _pos > (int64_t) input_len - _len) {             \
  |  |  ------------------
  |  |  |  Branch (563:9): [True: 0, False: 0]
  |  |  |  Branch (563:21): [True: 0, False: 0]
  |  |  |  Branch (563:33): [True: 0, False: 0]
  |  |  ------------------
  |  |  564|      0|      BLOSC_TRACE_ERROR("ndlz4: out-of-bounds reference in compressed stream");  \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  565|      0|      return BLOSC2_ERROR_FAILURE;                                               \
  |  |  566|      0|    }                                                                            \
  |  |  567|      0|  } while (0)
  |  |  ------------------
  |  |  |  Branch (567:12): [Folded, False: 0]
  |  |  ------------------
  ------------------
  706|      0|            memcpy(&buffercpy[k * 4], ip, 4);
  707|      0|            ip += 4;
  708|      0|          }
  709|      0|        }
  710|      0|      } else if ((token >= 40) && (token <= 63)) {  // 2 rows pair matches
  ------------------
  |  Branch (710:18): [True: 0, False: 0]
  |  Branch (710:35): [True: 0, False: 0]
  ------------------
  711|      0|        buffercpy = local_buffer;
  712|      0|        NDLZ4_CHECK_RANGE(cur + 1, 2);
  ------------------
  |  |  560|      0|  do {                                                                           \
  |  |  561|      0|    int64_t _pos = (int64_t) (pos);                                              \
  |  |  562|      0|    int64_t _len = (int64_t) (len);                                              \
  |  |  563|      0|    if (_pos < 0 || _len < 0 || _pos > (int64_t) input_len - _len) {             \
  |  |  ------------------
  |  |  |  Branch (563:9): [True: 0, False: 0]
  |  |  |  Branch (563:21): [True: 0, False: 0]
  |  |  |  Branch (563:33): [True: 0, False: 0]
  |  |  ------------------
  |  |  564|      0|      BLOSC_TRACE_ERROR("ndlz4: out-of-bounds reference in compressed stream");  \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  565|      0|      return BLOSC2_ERROR_FAILURE;                                               \
  |  |  566|      0|    }                                                                            \
  |  |  567|      0|  } while (0)
  |  |  ------------------
  |  |  |  Branch (567:12): [Folded, False: 0]
  |  |  ------------------
  ------------------
  713|      0|        uint16_t offset_1;
  714|      0|        memcpy(&offset_1, ip, sizeof(offset_1));
  715|      0|        offset_1 += 5;
  716|      0|        ip += 2;
  717|      0|        NDLZ4_CHECK_RANGE(cur + 3, 2);
  ------------------
  |  |  560|      0|  do {                                                                           \
  |  |  561|      0|    int64_t _pos = (int64_t) (pos);                                              \
  |  |  562|      0|    int64_t _len = (int64_t) (len);                                              \
  |  |  563|      0|    if (_pos < 0 || _len < 0 || _pos > (int64_t) input_len - _len) {             \
  |  |  ------------------
  |  |  |  Branch (563:9): [True: 0, False: 0]
  |  |  |  Branch (563:21): [True: 0, False: 0]
  |  |  |  Branch (563:33): [True: 0, False: 0]
  |  |  ------------------
  |  |  564|      0|      BLOSC_TRACE_ERROR("ndlz4: out-of-bounds reference in compressed stream");  \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  565|      0|      return BLOSC2_ERROR_FAILURE;                                               \
  |  |  566|      0|    }                                                                            \
  |  |  567|      0|  } while (0)
  |  |  ------------------
  |  |  |  Branch (567:12): [Folded, False: 0]
  |  |  ------------------
  ------------------
  718|      0|        uint16_t offset_2;
  719|      0|        memcpy(&offset_2, ip, sizeof(offset_2));
  720|      0|        offset_2 += 5;
  721|      0|        ip += 2;
  722|      0|        int i, j, k, l, m;
  723|      0|        i = 0;
  724|      0|        j = ((token - 32) >> 3U);
  725|      0|        l = -1;
  726|      0|        for (k = 1; k < 4; k++) {
  ------------------
  |  Branch (726:21): [True: 0, False: 0]
  ------------------
  727|      0|          if ((k != i) && (k != j)) {
  ------------------
  |  Branch (727:15): [True: 0, False: 0]
  |  Branch (727:27): [True: 0, False: 0]
  ------------------
  728|      0|            if (l == -1) {
  ------------------
  |  Branch (728:17): [True: 0, False: 0]
  ------------------
  729|      0|              l = k;
  730|      0|            } else {
  731|      0|              m = k;
  732|      0|            }
  733|      0|          }
  734|      0|        }
  735|      0|        int64_t bpos1 = (cur + 5) - (int64_t) offset_1;
  736|      0|        NDLZ4_CHECK_RANGE(bpos1, 8);
  ------------------
  |  |  560|      0|  do {                                                                           \
  |  |  561|      0|    int64_t _pos = (int64_t) (pos);                                              \
  |  |  562|      0|    int64_t _len = (int64_t) (len);                                              \
  |  |  563|      0|    if (_pos < 0 || _len < 0 || _pos > (int64_t) input_len - _len) {             \
  |  |  ------------------
  |  |  |  Branch (563:9): [True: 0, False: 0]
  |  |  |  Branch (563:21): [True: 0, False: 0]
  |  |  |  Branch (563:33): [True: 0, False: 0]
  |  |  ------------------
  |  |  564|      0|      BLOSC_TRACE_ERROR("ndlz4: out-of-bounds reference in compressed stream");  \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  565|      0|      return BLOSC2_ERROR_FAILURE;                                               \
  |  |  566|      0|    }                                                                            \
  |  |  567|      0|  } while (0)
  |  |  ------------------
  |  |  |  Branch (567:12): [Folded, False: 0]
  |  |  ------------------
  ------------------
  737|      0|        const uint8_t *ref1 = (const uint8_t *) input + bpos1;
  738|      0|        memcpy(&buffercpy[i * 4], ref1, 4);
  739|      0|        memcpy(&buffercpy[j * 4], ref1 + 4, 4);
  740|      0|        int64_t bpos2 = (cur + 5) - (int64_t) offset_2;
  741|      0|        NDLZ4_CHECK_RANGE(bpos2, 8);
  ------------------
  |  |  560|      0|  do {                                                                           \
  |  |  561|      0|    int64_t _pos = (int64_t) (pos);                                              \
  |  |  562|      0|    int64_t _len = (int64_t) (len);                                              \
  |  |  563|      0|    if (_pos < 0 || _len < 0 || _pos > (int64_t) input_len - _len) {             \
  |  |  ------------------
  |  |  |  Branch (563:9): [True: 0, False: 0]
  |  |  |  Branch (563:21): [True: 0, False: 0]
  |  |  |  Branch (563:33): [True: 0, False: 0]
  |  |  ------------------
  |  |  564|      0|      BLOSC_TRACE_ERROR("ndlz4: out-of-bounds reference in compressed stream");  \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  565|      0|      return BLOSC2_ERROR_FAILURE;                                               \
  |  |  566|      0|    }                                                                            \
  |  |  567|      0|  } while (0)
  |  |  ------------------
  |  |  |  Branch (567:12): [Folded, False: 0]
  |  |  ------------------
  ------------------
  742|      0|        const uint8_t *ref2 = (const uint8_t *) input + bpos2;
  743|      0|        memcpy(&buffercpy[l * 4], ref2, 4);
  744|      0|        memcpy(&buffercpy[m * 4], ref2 + 4, 4);
  745|       |
  746|      0|      } else {
  747|      0|        BLOSC_TRACE_ERROR("Invalid token: %u at cell [%d, %d]\n", token, ii[0], ii[1]);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  748|      0|        return BLOSC2_ERROR_FAILURE;
  749|      0|      }
  750|       |      // fill op with buffercpy
  751|      0|      uint32_t orig = ii[0] * 4 * blockshape[1] + ii[1] * 4;
  752|      0|      for (uint32_t i = 0; i < 4; i++) {
  ------------------
  |  Branch (752:28): [True: 0, False: 0]
  ------------------
  753|      0|        if (i < padding[0]) {
  ------------------
  |  Branch (753:13): [True: 0, False: 0]
  ------------------
  754|      0|          ind = orig + i * blockshape[1];
  755|      0|          memcpy(&op[ind], buffercpy, padding[1]);
  756|       |          // Only advance over rows we actually consume.  For a literal cell
  757|       |          // (token == 0) buffercpy points into the input and only holds
  758|       |          // padding[0] * padding[1] bytes; advancing unconditionally for the
  759|       |          // trailing padding rows would form an out-of-bounds pointer (UB)
  760|       |          // for the block's last cell.  The skipped rows are never read.
  761|      0|          buffercpy += padding[1];
  762|      0|        }
  763|      0|      }
  764|      0|      if (ind > (uint32_t) output_len) {
  ------------------
  |  Branch (764:11): [True: 0, False: 0]
  ------------------
  765|      0|        BLOSC_TRACE_ERROR("Exceeding output size");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  766|      0|        return BLOSC2_ERROR_FAILURE;
  767|      0|      }
  768|      0|    }
  769|      0|  }
  770|      0|  ind += padding[1];
  771|       |
  772|      0|  if ((int32_t)ind != (blockshape[0] * blockshape[1])) {
  ------------------
  |  Branch (772:7): [True: 0, False: 0]
  ------------------
  773|      0|    BLOSC_TRACE_ERROR("Output size is not compatible with embedded blockshape");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  774|      0|    return BLOSC2_ERROR_FAILURE;
  775|      0|  }
  776|      0|  if (ind > (uint32_t) output_len) {
  ------------------
  |  Branch (776:7): [True: 0, False: 0]
  ------------------
  777|      0|    BLOSC_TRACE_ERROR("Exceeding output size");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  778|      0|    return BLOSC2_ERROR_FAILURE;
  779|      0|  }
  780|       |
  781|      0|  return (int) ind;
  782|      0|#undef NDLZ4_CHECK_RANGE
  783|      0|}

ndlz8_compress:
   59|      1|                   uint8_t meta, blosc2_cparams *cparams) {
   60|      1|  BLOSC_UNUSED_PARAM(meta);
  ------------------
  |  |   28|      1|#define BLOSC_UNUSED_PARAM(x) ((void)(x))
  ------------------
   61|      1|  BLOSC_ERROR_NULL(cparams, BLOSC2_ERROR_NULL_POINTER);
  ------------------
  |  |  104|      1|    do {                                            \
  |  |  105|      1|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 1]
  |  |  ------------------
  |  |  106|      0|            BLOSC_TRACE_ERROR("Pointer is null");   \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  107|      0|            return (rc);                            \
  |  |  108|      0|        }                                           \
  |  |  109|      1|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 1]
  |  |  ------------------
  ------------------
   62|      1|  BLOSC_ERROR_NULL(cparams->schunk, BLOSC2_ERROR_NULL_POINTER);
  ------------------
  |  |  104|      1|    do {                                            \
  |  |  105|      1|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 1]
  |  |  ------------------
  |  |  106|      0|            BLOSC_TRACE_ERROR("Pointer is null");   \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  107|      0|            return (rc);                            \
  |  |  108|      0|        }                                           \
  |  |  109|      1|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 1]
  |  |  ------------------
  ------------------
   63|      1|  uint8_t *smeta;
   64|      1|  int32_t smeta_len;
   65|       |
   66|      1|  if (blosc2_meta_get(cparams->schunk, "b2nd", &smeta, &smeta_len) < 0) {
  ------------------
  |  Branch (66:7): [True: 0, False: 1]
  ------------------
   67|      0|    BLOSC_TRACE_ERROR("b2nd layer not found!");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
   68|      0|    return BLOSC2_ERROR_FAILURE;
   69|      0|  }
   70|       |
   71|      1|  const int cell_shape = 8;
   72|      1|  const int cell_size = 64;
   73|      1|  int8_t ndim;
   74|      1|  int64_t *shape = malloc(B2ND_MAX_DIM * sizeof(int64_t));
  ------------------
  |  |   50|      1|#define B2ND_MAX_DIM 16
  ------------------
   75|      1|  int32_t *chunkshape = malloc(B2ND_MAX_DIM * sizeof(int32_t));
  ------------------
  |  |   50|      1|#define B2ND_MAX_DIM 16
  ------------------
   76|      1|  int32_t *blockshape = malloc(B2ND_MAX_DIM * sizeof(int32_t));
  ------------------
  |  |   50|      1|#define B2ND_MAX_DIM 16
  ------------------
   77|      1|  int deserialize_rc = b2nd_deserialize_meta(smeta, smeta_len, &ndim, shape, chunkshape, blockshape, NULL, NULL);
   78|      1|  free(smeta);
   79|       |
   80|      1|  if (deserialize_rc < 0 || ndim != 2) {
  ------------------
  |  Branch (80:7): [True: 0, False: 1]
  |  Branch (80:29): [True: 0, False: 1]
  ------------------
   81|      0|    free(shape);
   82|      0|    free(chunkshape);
   83|      0|    free(blockshape);
   84|      0|    BLOSC_TRACE_ERROR("This codec only works for ndim = 2");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
   85|      0|    return BLOSC2_ERROR_FAILURE;
   86|      0|  }
   87|       |
   88|      1|  if (input_len != (blockshape[0] * blockshape[1])) {
  ------------------
  |  Branch (88:7): [True: 0, False: 1]
  ------------------
   89|      0|    free(shape);
   90|      0|    free(chunkshape);
   91|      0|    free(blockshape);
   92|      0|    BLOSC_TRACE_ERROR("Length not equal to blocksize");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
   93|      0|    return BLOSC2_ERROR_FAILURE;
   94|      0|  }
   95|       |
   96|      1|  if (NDLZ_UNEXPECT_CONDITIONAL(output_len < (int) (1 + ndim * sizeof(int32_t)))) {
  ------------------
  |  |   30|      1|#define NDLZ_UNEXPECT_CONDITIONAL(c)  (__builtin_expect((c), 0))
  |  |  ------------------
  |  |  |  Branch (30:39): [True: 0, False: 1]
  |  |  ------------------
  ------------------
   97|      0|    free(shape);
   98|      0|    free(chunkshape);
   99|      0|    free(blockshape);
  100|      0|    BLOSC_TRACE_ERROR("Output too small");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  101|      0|    return BLOSC2_ERROR_FAILURE;
  102|      0|  }
  103|       |
  104|      1|  uint8_t *ip = (uint8_t *) input;
  105|      1|  uint8_t *op = (uint8_t *) output;
  106|      1|  uint8_t *op_limit;
  107|      1|  uint32_t hval, hash_cell;
  108|      1|  uint32_t hash_triple[6] = {0};
  109|      1|  uint32_t hash_pair[7] = {0};
  110|      1|  uint8_t *bufarea = malloc(cell_size);
  111|      1|  uint8_t *buf_cell = bufarea;
  112|      1|  uint8_t *buf_aux;
  113|      1|  uint32_t tab_cell[1U << 12U] = {0};
  114|      1|  uint32_t tab_triple[1U << 12U] = {0};
  115|      1|  uint32_t tab_pair[1U << 12U] = {0};
  116|      1|  uint32_t update_triple[6] = {0};
  117|      1|  uint32_t update_pair[7] = {0};
  118|       |
  119|       |  // Minimum cratios before issuing and _early giveup_
  120|       |  // Remind that ndlz is not meant for cratios <= 2 (too costly to decompress)
  121|       |
  122|      1|  op_limit = op + output_len;
  123|       |
  124|       |  // Initialize the hash table to distances of 0
  125|  4.09k|  for (unsigned i = 0; i < (1U << 12U); i++) {
  ------------------
  |  Branch (125:24): [True: 4.09k, False: 1]
  ------------------
  126|  4.09k|    tab_cell[i] = 0;
  127|  4.09k|    tab_triple[i] = 0;
  128|  4.09k|    tab_pair[i] = 0;
  129|  4.09k|  }
  130|       |
  131|       |  /* input and output buffer cannot be less than 64 (cells are 8x8) */
  132|      1|  int overhead = 17 + (blockshape[0] * blockshape[1] / cell_size - 1) * 2;
  133|      1|  if (input_len < cell_size || output_len < overhead) {
  ------------------
  |  Branch (133:7): [True: 0, False: 1]
  |  Branch (133:32): [True: 0, False: 1]
  ------------------
  134|      0|    free(shape);
  135|      0|    free(chunkshape);
  136|      0|    free(blockshape);
  137|      0|    free(bufarea);
  138|      0|    BLOSC_TRACE_ERROR("Incorrect length or maxout");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  139|      0|    return 0;
  140|      0|  }
  141|       |
  142|      1|  uint8_t *obase = op;
  143|       |
  144|       |  /* we start with literal copy */
  145|      1|  *op++ = ndim;
  146|      1|  memcpy(op, &blockshape[0], 4);
  147|      1|  op += 4;
  148|      1|  memcpy(op, &blockshape[1], 4);
  149|      1|  op += 4;
  150|       |
  151|      1|  uint32_t i_stop[2];
  152|      3|  for (int i = 0; i < 2; ++i) {
  ------------------
  |  Branch (152:19): [True: 2, False: 1]
  ------------------
  153|      2|    i_stop[i] = (blockshape[i] + cell_shape - 1) / cell_shape;
  154|      2|  }
  155|       |
  156|       |
  157|       |  /* main loop */
  158|      1|  uint32_t padding[2];
  159|      1|  uint32_t ii[2];
  160|      1|  for (ii[0] = 0; ii[0] < i_stop[0]; ++ii[0]) {
  ------------------
  |  Branch (160:19): [True: 1, False: 0]
  ------------------
  161|      1|    for (ii[1] = 0; ii[1] < i_stop[1]; ++ii[1]) {      // for each cell
  ------------------
  |  Branch (161:21): [True: 1, False: 0]
  ------------------
  162|      8|      for (int h = 0; h < 7; h++) {         // new cell -> new possible references
  ------------------
  |  Branch (162:23): [True: 7, False: 1]
  ------------------
  163|      7|        update_pair[h] = 0;
  164|      7|        if (h != 6) {
  ------------------
  |  Branch (164:13): [True: 6, False: 1]
  ------------------
  165|      6|          update_triple[h] = 0;
  166|      6|        }
  167|      7|      }
  168|       |
  169|      1|      if (NDLZ_UNEXPECT_CONDITIONAL(op + cell_size + 1 > op_limit)) {
  ------------------
  |  |   30|      1|#define NDLZ_UNEXPECT_CONDITIONAL(c)  (__builtin_expect((c), 0))
  |  |  ------------------
  |  |  |  Branch (30:39): [True: 1, False: 0]
  |  |  ------------------
  ------------------
  170|      1|        free(shape);
  171|      1|        free(chunkshape);
  172|      1|        free(blockshape);
  173|      1|        free(bufarea);
  174|      1|        return 0;
  175|      1|      }
  176|       |
  177|      0|      uint32_t orig = ii[0] * cell_shape * blockshape[1] + ii[1] * cell_shape;
  178|      0|      if (((blockshape[0] % cell_shape != 0) && (ii[0] == i_stop[0] - 1)) ||
  ------------------
  |  Branch (178:12): [True: 0, False: 0]
  |  Branch (178:49): [True: 0, False: 0]
  ------------------
  179|      0|          ((blockshape[1] % cell_shape != 0) && (ii[1] == i_stop[1] - 1))) {
  ------------------
  |  Branch (179:12): [True: 0, False: 0]
  |  Branch (179:49): [True: 0, False: 0]
  ------------------
  180|      0|        uint8_t token = 0;                                   // padding -> literal copy
  181|      0|        *op++ = token;
  182|      0|        if (ii[0] == i_stop[0] - 1) {
  ------------------
  |  Branch (182:13): [True: 0, False: 0]
  ------------------
  183|      0|          padding[0] = (blockshape[0] % cell_shape == 0) ? cell_shape : blockshape[0] % cell_shape;
  ------------------
  |  Branch (183:24): [True: 0, False: 0]
  ------------------
  184|      0|        } else {
  185|      0|          padding[0] = cell_shape;
  186|      0|        }
  187|      0|        if (ii[1] == i_stop[1] - 1) {
  ------------------
  |  Branch (187:13): [True: 0, False: 0]
  ------------------
  188|      0|          padding[1] = (blockshape[1] % cell_shape == 0) ? cell_shape : blockshape[1] % cell_shape;
  ------------------
  |  Branch (188:24): [True: 0, False: 0]
  ------------------
  189|      0|        } else {
  190|      0|          padding[1] = cell_shape;
  191|      0|        }
  192|      0|        for (uint32_t i = 0; i < padding[0]; i++) {
  ------------------
  |  Branch (192:30): [True: 0, False: 0]
  ------------------
  193|      0|          memcpy(op, &ip[orig + i * blockshape[1]], padding[1]);
  194|      0|          op += padding[1];
  195|      0|        }
  196|      0|      } else {
  197|      0|        for (uint64_t i = 0; i < (uint64_t) cell_shape; i++) {           // fill cell buffer
  ------------------
  |  Branch (197:30): [True: 0, False: 0]
  ------------------
  198|      0|          uint64_t ind = orig + i * blockshape[1];
  199|      0|          memcpy(buf_cell, &ip[ind], cell_shape);
  200|      0|          buf_cell += cell_shape;
  201|      0|        }
  202|      0|        buf_cell -= cell_size;
  203|       |
  204|      0|        const uint8_t *ref;
  205|      0|        uint32_t distance;
  206|      0|        uint8_t *anchor = op;    /* comparison starting-point */
  207|       |
  208|       |        /* find potential match */
  209|      0|        hash_cell = XXH32(buf_cell, cell_size, 1);        // calculate cell hash
  ------------------
  |  |  392|      0|#  define XXH32 XXH_NAME2(XXH_NAMESPACE, XXH32)
  |  |  ------------------
  |  |  |  |  389|      0|#  define XXH_NAME2(A,B) XXH_CAT(A,B)
  |  |  |  |  ------------------
  |  |  |  |  |  |  388|      0|#  define XXH_CAT(A,B) A##B
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  210|      0|        hash_cell >>= 32U - 12U;
  211|      0|        ref = obase + tab_cell[hash_cell];
  212|       |
  213|       |        /* calculate distance to the match */
  214|      0|        if (tab_cell[hash_cell] == 0) {
  ------------------
  |  Branch (214:13): [True: 0, False: 0]
  ------------------
  215|      0|          distance = 0;
  216|      0|        } else {
  217|      0|          bool same = true;
  218|      0|          buf_aux = obase + tab_cell[hash_cell];
  219|      0|          for (int i = 0; i < cell_size; i++) {
  ------------------
  |  Branch (219:27): [True: 0, False: 0]
  ------------------
  220|      0|            if (buf_cell[i] != buf_aux[i]) {
  ------------------
  |  Branch (220:17): [True: 0, False: 0]
  ------------------
  221|      0|              same = false;
  222|      0|              break;
  223|      0|            }
  224|      0|          }
  225|      0|          if (same) {
  ------------------
  |  Branch (225:15): [True: 0, False: 0]
  ------------------
  226|      0|            distance = (int32_t) (anchor - ref);
  227|      0|          } else {
  228|      0|            distance = 0;
  229|      0|          }
  230|      0|        }
  231|       |
  232|      0|        bool alleq = true;
  233|      0|        for (int i = 1; i < cell_size; i++) {
  ------------------
  |  Branch (233:25): [True: 0, False: 0]
  ------------------
  234|      0|          if (buf_cell[i] != buf_cell[0]) {
  ------------------
  |  Branch (234:15): [True: 0, False: 0]
  ------------------
  235|      0|            alleq = false;
  236|      0|            break;
  237|      0|          }
  238|      0|        }
  239|      0|        if (alleq) {                              // all elements of the cell equal
  ------------------
  |  Branch (239:13): [True: 0, False: 0]
  ------------------
  240|      0|          uint8_t token = (uint8_t) (1U << 6U);
  241|      0|          *op++ = token;
  242|      0|          *op++ = buf_cell[0];
  243|       |
  244|      0|        } else if (distance == 0 || (distance >= MAX_DISTANCE)) {   // no cell match
  ------------------
  |  |   44|      0|#define MAX_DISTANCE 65535
  ------------------
  |  Branch (244:20): [True: 0, False: 0]
  |  Branch (244:37): [True: 0, False: 0]
  ------------------
  245|      0|          bool literal = true;
  246|       |
  247|       |          // rows triples matches
  248|      0|          for (int i = 0; i < 6; i++) {
  ------------------
  |  Branch (248:27): [True: 0, False: 0]
  ------------------
  249|      0|            int triple_start = i * cell_shape;
  250|      0|            hval = XXH32(&buf_cell[triple_start], 24, 1);        // calculate triple hash
  ------------------
  |  |  392|      0|#  define XXH32 XXH_NAME2(XXH_NAMESPACE, XXH32)
  |  |  ------------------
  |  |  |  |  389|      0|#  define XXH_NAME2(A,B) XXH_CAT(A,B)
  |  |  |  |  ------------------
  |  |  |  |  |  |  388|      0|#  define XXH_CAT(A,B) A##B
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  251|      0|            hval >>= 32U - 12U;
  252|       |            /* calculate distance to the match */
  253|      0|            bool same = true;
  254|      0|            uint16_t offset;
  255|      0|            if (tab_triple[hval] != 0) {
  ------------------
  |  Branch (255:17): [True: 0, False: 0]
  ------------------
  256|      0|              buf_aux = obase + tab_triple[hval];
  257|      0|              for (int l = 0; l < 24; l++) {
  ------------------
  |  Branch (257:31): [True: 0, False: 0]
  ------------------
  258|      0|                if (buf_cell[triple_start + l] != buf_aux[l]) {
  ------------------
  |  Branch (258:21): [True: 0, False: 0]
  ------------------
  259|      0|                  same = false;
  260|      0|                  break;
  261|      0|                }
  262|      0|              }
  263|      0|              offset = (uint16_t) (anchor - obase - tab_triple[hval]);
  264|      0|            } else {
  265|      0|              same = false;
  266|      0|              update_triple[i] = (uint32_t) (anchor + 1 + triple_start - obase);     /* update hash table */
  267|      0|              hash_triple[i] = hval;
  268|      0|            }
  269|      0|            ref = obase + tab_triple[hval];
  270|      0|            if (same) {
  ------------------
  |  Branch (270:17): [True: 0, False: 0]
  ------------------
  271|      0|              distance = (int32_t) (anchor + triple_start - ref);
  272|      0|            } else {
  273|      0|              distance = 0;
  274|      0|            }
  275|      0|            if ((distance != 0) && (distance < MAX_DISTANCE)) {     // 3 rows match
  ------------------
  |  |   44|      0|#define MAX_DISTANCE 65535
  ------------------
  |  Branch (275:17): [True: 0, False: 0]
  |  Branch (275:36): [True: 0, False: 0]
  ------------------
  276|      0|              literal = false;
  277|      0|              uint8_t token = (uint8_t) ((21 << 3U) | i);
  278|      0|              *op++ = token;
  279|      0|              memcpy(op, &offset, 2);
  280|      0|              op += 2;
  281|      0|              for (int l = 0; l < 8; l++) {
  ------------------
  |  Branch (281:31): [True: 0, False: 0]
  ------------------
  282|      0|                if ((l < i) || (l > i + 2)) {
  ------------------
  |  Branch (282:21): [True: 0, False: 0]
  |  Branch (282:32): [True: 0, False: 0]
  ------------------
  283|      0|                  memcpy(op, &buf_cell[l * cell_shape], cell_shape);
  284|      0|                  op += cell_shape;
  285|      0|                }
  286|      0|              }
  287|      0|              goto match;
  288|      0|            }
  289|      0|          }
  290|       |
  291|       |          // rows pairs matches
  292|      0|          for (int i = 0; i < 7; i++) {
  ------------------
  |  Branch (292:27): [True: 0, False: 0]
  ------------------
  293|      0|            int pair_start = i * cell_shape;
  294|      0|            hval = XXH32(&buf_cell[pair_start], 16, 1);        // calculate rows pair hash
  ------------------
  |  |  392|      0|#  define XXH32 XXH_NAME2(XXH_NAMESPACE, XXH32)
  |  |  ------------------
  |  |  |  |  389|      0|#  define XXH_NAME2(A,B) XXH_CAT(A,B)
  |  |  |  |  ------------------
  |  |  |  |  |  |  388|      0|#  define XXH_CAT(A,B) A##B
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  295|      0|            hval >>= 32U - 12U;
  296|      0|            ref = obase + tab_pair[hval];
  297|       |            /* calculate distance to the match */
  298|      0|            bool same = true;
  299|      0|            uint16_t offset;
  300|      0|            if (tab_pair[hval] != 0) {
  ------------------
  |  Branch (300:17): [True: 0, False: 0]
  ------------------
  301|      0|              buf_aux = obase + tab_pair[hval];
  302|      0|              for (int k = 0; k < 16; k++) {
  ------------------
  |  Branch (302:31): [True: 0, False: 0]
  ------------------
  303|      0|                if (buf_cell[pair_start + k] != buf_aux[k]) {
  ------------------
  |  Branch (303:21): [True: 0, False: 0]
  ------------------
  304|      0|                  same = false;
  305|      0|                  break;
  306|      0|                }
  307|      0|              }
  308|      0|              offset = (uint16_t) (anchor - obase - tab_pair[hval]);
  309|      0|            } else {
  310|      0|              same = false;
  311|      0|              update_pair[i] = (uint32_t) (anchor + 1 + pair_start - obase);     /* update hash table */
  312|      0|              hash_pair[i] = hval;
  313|      0|            }
  314|      0|            if (same) {
  ------------------
  |  Branch (314:17): [True: 0, False: 0]
  ------------------
  315|      0|              distance = (int32_t) (anchor + pair_start - ref);
  316|      0|            } else {
  317|      0|              distance = 0;
  318|      0|            }
  319|      0|            if ((distance != 0) && (distance < MAX_DISTANCE)) {     /* 1 rows pair match */
  ------------------
  |  |   44|      0|#define MAX_DISTANCE 65535
  ------------------
  |  Branch (319:17): [True: 0, False: 0]
  |  Branch (319:36): [True: 0, False: 0]
  ------------------
  320|      0|              literal = false;
  321|      0|              uint8_t token = (uint8_t) ((17 << 3U) | i);
  322|      0|              *op++ = token;
  323|      0|              offset = (uint16_t) (anchor - obase - tab_pair[hval]);
  324|      0|              memcpy(op, &offset, 2);
  325|      0|              op += 2;
  326|      0|              for (int l = 0; l < 8; l++) {
  ------------------
  |  Branch (326:31): [True: 0, False: 0]
  ------------------
  327|      0|                if ((l < i) || (l > i + 1)) {
  ------------------
  |  Branch (327:21): [True: 0, False: 0]
  |  Branch (327:32): [True: 0, False: 0]
  ------------------
  328|      0|                  memcpy(op, &buf_cell[l * cell_shape], cell_shape);
  329|      0|                  op += cell_shape;
  330|      0|                }
  331|      0|              }
  332|      0|              goto match;
  333|      0|            }
  334|      0|          }
  335|       |
  336|      0|          match:
  337|      0|          if (literal) {
  ------------------
  |  Branch (337:15): [True: 0, False: 0]
  ------------------
  338|      0|            tab_cell[hash_cell] = (uint32_t) (anchor + 1 - obase);     /* update hash tables */
  339|       |
  340|      0|            if (update_triple[0] != 0) {
  ------------------
  |  Branch (340:17): [True: 0, False: 0]
  ------------------
  341|      0|              for (int h = 0; h < 6; h++) {
  ------------------
  |  Branch (341:31): [True: 0, False: 0]
  ------------------
  342|      0|                tab_triple[hash_triple[h]] = update_triple[h];
  343|      0|              }
  344|      0|            }
  345|      0|            if (update_pair[0] != 0) {
  ------------------
  |  Branch (345:17): [True: 0, False: 0]
  ------------------
  346|      0|              for (int h = 0; h < 7; h++) {
  ------------------
  |  Branch (346:31): [True: 0, False: 0]
  ------------------
  347|      0|                tab_pair[hash_pair[h]] = update_pair[h];
  348|      0|              }
  349|      0|            }
  350|      0|            uint8_t token = 0;
  351|      0|            *op++ = token;
  352|      0|            memcpy(op, buf_cell, cell_size);
  353|      0|            op += cell_size;
  354|       |
  355|      0|          }
  356|       |
  357|      0|        } else {   // cell match
  358|      0|          uint8_t token = (uint8_t) ((1U << 7U) | (1U << 6U));
  359|      0|          *op++ = token;
  360|      0|          uint16_t offset = (uint16_t) (anchor - obase - tab_cell[hash_cell]);
  361|      0|          memcpy(op, &offset, 2);
  362|      0|          op += 2;
  363|       |
  364|      0|        }
  365|       |
  366|      0|      }
  367|      0|      if ((op - obase) > input_len) {
  ------------------
  |  Branch (367:11): [True: 0, False: 0]
  ------------------
  368|      0|        free(shape);
  369|      0|        free(chunkshape);
  370|      0|        free(blockshape);
  371|      0|        free(bufarea);
  372|      0|        BLOSC_TRACE_ERROR("Compressed data is bigger than input!");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  373|      0|        return 0;
  374|      0|      }
  375|      0|    }
  376|      1|  }
  377|       |
  378|      0|  free(shape);
  379|      0|  free(chunkshape);
  380|      0|  free(blockshape);
  381|      0|  free(bufarea);
  382|       |
  383|      0|  return (int) (op - obase);
  384|      1|}
ndlz8_decompress:
  444|      1|                     uint8_t meta, blosc2_dparams *dparams) {
  445|      1|  BLOSC_UNUSED_PARAM(meta);
  ------------------
  |  |   28|      1|#define BLOSC_UNUSED_PARAM(x) ((void)(x))
  ------------------
  446|      1|  BLOSC_UNUSED_PARAM(dparams);
  ------------------
  |  |   28|      1|#define BLOSC_UNUSED_PARAM(x) ((void)(x))
  ------------------
  447|      1|  BLOSC_ERROR_NULL(input, BLOSC2_ERROR_NULL_POINTER);
  ------------------
  |  |  104|      1|    do {                                            \
  |  |  105|      1|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 1]
  |  |  ------------------
  |  |  106|      0|            BLOSC_TRACE_ERROR("Pointer is null");   \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  107|      0|            return (rc);                            \
  |  |  108|      0|        }                                           \
  |  |  109|      1|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 1]
  |  |  ------------------
  ------------------
  448|      1|  BLOSC_ERROR_NULL(output, BLOSC2_ERROR_NULL_POINTER);
  ------------------
  |  |  104|      1|    do {                                            \
  |  |  105|      1|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 1]
  |  |  ------------------
  |  |  106|      0|            BLOSC_TRACE_ERROR("Pointer is null");   \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  107|      0|            return (rc);                            \
  |  |  108|      0|        }                                           \
  |  |  109|      1|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 1]
  |  |  ------------------
  ------------------
  449|       |
  450|      1|  const int cell_shape = 8;
  451|      1|  const int cell_size = 64;
  452|      1|  uint8_t *ip = (uint8_t *) input;
  453|      1|  uint8_t *op = (uint8_t *) output;
  454|      1|  uint8_t ndim;
  455|      1|  int32_t blockshape[2];
  456|      1|  int32_t eshape[2];
  457|      1|  uint8_t *buffercpy;
  458|      1|  uint8_t token;
  459|       |  // The fixed header is 1 (ndim) + 2 * int32 (blockshape) = 9 bytes.  Reject any
  460|       |  // input too short to hold it -- the previous `< 8` check let an 8-byte input
  461|       |  // through and the header parse below then read a 9th byte.  The cast keeps the
  462|       |  // comparison signed so a negative `input_len` is rejected here, before the
  463|       |  // `ip + input_len` pointer arithmetic (which would otherwise be UB) is reached.
  464|      1|  if (NDLZ_UNEXPECT_CONDITIONAL(input_len < (int32_t) (1 + 2 * sizeof(int32_t)))) {
  ------------------
  |  |   30|      1|#define NDLZ_UNEXPECT_CONDITIONAL(c)  (__builtin_expect((c), 0))
  |  |  ------------------
  |  |  |  Branch (30:39): [True: 1, False: 0]
  |  |  ------------------
  ------------------
  465|      1|    return 0;
  466|      1|  }
  467|      0|  uint8_t *ip_limit = ip + input_len;
  468|       |
  469|       |  /* we start with literal copy */
  470|      0|  ndim = *ip;
  471|      0|  ip++;
  472|      0|  if (ndim != 2) {
  ------------------
  |  Branch (472:7): [True: 0, False: 0]
  ------------------
  473|      0|    BLOSC_TRACE_ERROR("This codec only works for ndim = 2");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  474|      0|    return BLOSC2_ERROR_FAILURE;
  475|      0|  }
  476|      0|  memcpy(&blockshape[0], ip, 4);
  477|      0|  ip += 4;
  478|      0|  memcpy(&blockshape[1], ip, 4);
  479|      0|  ip += 4;
  480|       |
  481|       |  // Sanity check.  See https://www.cve.org/CVERecord?id=CVE-2024-3203
  482|      0|  if (output_len < 0 || blockshape[0] < 0 || blockshape[1] < 0) {
  ------------------
  |  Branch (482:7): [True: 0, False: 0]
  |  Branch (482:25): [True: 0, False: 0]
  |  Branch (482:46): [True: 0, False: 0]
  ------------------
  483|      0|    BLOSC_TRACE_ERROR("Output length or blockshape is negative");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  484|      0|    return BLOSC2_ERROR_FAILURE;
  485|      0|  }
  486|       |
  487|      0|  eshape[0] = ((blockshape[0] + 7) / cell_shape) * cell_shape;
  488|      0|  eshape[1] = ((blockshape[1] + 7) / cell_shape) * cell_shape;
  489|       |
  490|      0|  if (NDLZ_UNEXPECT_CONDITIONAL((int64_t)output_len < (int64_t)blockshape[0] * (int64_t)blockshape[1])) {
  ------------------
  |  |   30|      0|#define NDLZ_UNEXPECT_CONDITIONAL(c)  (__builtin_expect((c), 0))
  |  |  ------------------
  |  |  |  Branch (30:39): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  491|      0|    BLOSC_TRACE_ERROR("The blockshape is bigger than the output buffer");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  492|      0|    return 0;
  493|      0|  }
  494|      0|  memset(op, 0, blockshape[0] * blockshape[1]);
  495|       |
  496|      0|  int32_t i_stop[2];
  497|      0|  for (int i = 0; i < 2; ++i) {
  ------------------
  |  Branch (497:19): [True: 0, False: 0]
  ------------------
  498|      0|    i_stop[i] = eshape[i] / cell_shape;
  499|      0|  }
  500|       |
  501|       |  /* main loop */
  502|      0|  int32_t ii[2];
  503|      0|  int32_t padding[2] = {0};
  504|      0|  int32_t ind = 0;
  505|      0|  uint8_t *local_buffer = malloc(cell_size);
  506|      0|  uint8_t *cell_aux = malloc(cell_size);
  507|       |
  508|       |  // Validate that a read of `len` bytes starting at byte offset `pos` (measured
  509|       |  // from the start of `input`) lies fully within the compressed buffer.  A
  510|       |  // crafted token `offset` otherwise makes a back-reference point before
  511|       |  // `input`, and the cell-fill memcpy then leaks out-of-bounds heap memory into
  512|       |  // the (attacker-visible) output -- CWE-125.  The per-cell `ip > ip_limit`
  513|       |  // check is not enough because each cell reads a 2-byte offset and literal
  514|       |  // bytes past that point.  All arithmetic is done on integer offsets so we
  515|       |  // never form an out-of-bounds pointer (undefined behaviour in C, even when the
  516|       |  // pointer is only compared and not dereferenced).
  517|      0|#define NDLZ8_CHECK_RANGE(pos, len)                                              \
  518|      0|  do {                                                                           \
  519|      0|    int64_t _pos = (int64_t) (pos);                                              \
  520|      0|    int64_t _len = (int64_t) (len);                                              \
  521|      0|    if (_pos < 0 || _len < 0 || _pos > (int64_t) input_len - _len) {             \
  522|      0|      free(local_buffer);                                                        \
  523|      0|      free(cell_aux);                                                            \
  524|      0|      BLOSC_TRACE_ERROR("ndlz8: out-of-bounds reference in compressed stream");  \
  525|      0|      return BLOSC2_ERROR_FAILURE;                                               \
  526|      0|    }                                                                            \
  527|      0|  } while (0)
  528|       |
  529|      0|  for (ii[0] = 0; ii[0] < i_stop[0]; ++ii[0]) {
  ------------------
  |  Branch (529:19): [True: 0, False: 0]
  ------------------
  530|      0|    for (ii[1] = 0; ii[1] < i_stop[1]; ++ii[1]) {      // for each cell
  ------------------
  |  Branch (530:21): [True: 0, False: 0]
  ------------------
  531|      0|      if (NDLZ_UNEXPECT_CONDITIONAL(ip > ip_limit)) {
  ------------------
  |  |   30|      0|#define NDLZ_UNEXPECT_CONDITIONAL(c)  (__builtin_expect((c), 0))
  |  |  ------------------
  |  |  |  Branch (30:39): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  532|      0|        free(local_buffer);
  533|      0|        free(cell_aux);
  534|      0|        BLOSC_TRACE_ERROR("Exceeding input length");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  535|      0|        return BLOSC2_ERROR_FAILURE;
  536|      0|      }
  537|      0|      if (ii[0] == i_stop[0] - 1) {
  ------------------
  |  Branch (537:11): [True: 0, False: 0]
  ------------------
  538|      0|        padding[0] = (blockshape[0] % cell_shape == 0) ? cell_shape : blockshape[0] % cell_shape;
  ------------------
  |  Branch (538:22): [True: 0, False: 0]
  ------------------
  539|      0|      } else {
  540|      0|        padding[0] = cell_shape;
  541|      0|      }
  542|      0|      if (ii[1] == i_stop[1] - 1) {
  ------------------
  |  Branch (542:11): [True: 0, False: 0]
  ------------------
  543|      0|        padding[1] = (blockshape[1] % cell_shape == 0) ? cell_shape : blockshape[1] % cell_shape;
  ------------------
  |  Branch (543:22): [True: 0, False: 0]
  ------------------
  544|      0|      } else {
  545|      0|        padding[1] = cell_shape;
  546|      0|      }
  547|      0|      int64_t cur = ip - (const uint8_t *) input;   // in-range: ip is within [input, ip_limit]
  548|      0|      NDLZ8_CHECK_RANGE(cur, 1);
  ------------------
  |  |  518|      0|  do {                                                                           \
  |  |  519|      0|    int64_t _pos = (int64_t) (pos);                                              \
  |  |  520|      0|    int64_t _len = (int64_t) (len);                                              \
  |  |  521|      0|    if (_pos < 0 || _len < 0 || _pos > (int64_t) input_len - _len) {             \
  |  |  ------------------
  |  |  |  Branch (521:9): [True: 0, False: 0]
  |  |  |  Branch (521:21): [True: 0, False: 0]
  |  |  |  Branch (521:33): [True: 0, False: 0]
  |  |  ------------------
  |  |  522|      0|      free(local_buffer);                                                        \
  |  |  523|      0|      free(cell_aux);                                                            \
  |  |  524|      0|      BLOSC_TRACE_ERROR("ndlz8: out-of-bounds reference in compressed stream");  \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  525|      0|      return BLOSC2_ERROR_FAILURE;                                               \
  |  |  526|      0|    }                                                                            \
  |  |  527|      0|  } while (0)
  |  |  ------------------
  |  |  |  Branch (527:12): [Folded, False: 0]
  |  |  ------------------
  ------------------
  549|      0|      token = *ip++;
  550|      0|      uint8_t match_type = (token >> 3U);
  551|      0|      if (token == 0) {    // no match
  ------------------
  |  Branch (551:11): [True: 0, False: 0]
  ------------------
  552|      0|        NDLZ8_CHECK_RANGE(cur + 1, (int64_t) padding[0] * padding[1]);
  ------------------
  |  |  518|      0|  do {                                                                           \
  |  |  519|      0|    int64_t _pos = (int64_t) (pos);                                              \
  |  |  520|      0|    int64_t _len = (int64_t) (len);                                              \
  |  |  521|      0|    if (_pos < 0 || _len < 0 || _pos > (int64_t) input_len - _len) {             \
  |  |  ------------------
  |  |  |  Branch (521:9): [True: 0, False: 0]
  |  |  |  Branch (521:21): [True: 0, False: 0]
  |  |  |  Branch (521:33): [True: 0, False: 0]
  |  |  ------------------
  |  |  522|      0|      free(local_buffer);                                                        \
  |  |  523|      0|      free(cell_aux);                                                            \
  |  |  524|      0|      BLOSC_TRACE_ERROR("ndlz8: out-of-bounds reference in compressed stream");  \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  525|      0|      return BLOSC2_ERROR_FAILURE;                                               \
  |  |  526|      0|    }                                                                            \
  |  |  527|      0|  } while (0)
  |  |  ------------------
  |  |  |  Branch (527:12): [Folded, False: 0]
  |  |  ------------------
  ------------------
  553|      0|        buffercpy = ip;
  554|      0|        ip += padding[0] * padding[1];
  555|      0|      } else if (token == (uint8_t) ((1U << 7U) | (1U << 6U))) {  // cell match
  ------------------
  |  Branch (555:18): [True: 0, False: 0]
  ------------------
  556|      0|        NDLZ8_CHECK_RANGE(cur + 1, 2);
  ------------------
  |  |  518|      0|  do {                                                                           \
  |  |  519|      0|    int64_t _pos = (int64_t) (pos);                                              \
  |  |  520|      0|    int64_t _len = (int64_t) (len);                                              \
  |  |  521|      0|    if (_pos < 0 || _len < 0 || _pos > (int64_t) input_len - _len) {             \
  |  |  ------------------
  |  |  |  Branch (521:9): [True: 0, False: 0]
  |  |  |  Branch (521:21): [True: 0, False: 0]
  |  |  |  Branch (521:33): [True: 0, False: 0]
  |  |  ------------------
  |  |  522|      0|      free(local_buffer);                                                        \
  |  |  523|      0|      free(cell_aux);                                                            \
  |  |  524|      0|      BLOSC_TRACE_ERROR("ndlz8: out-of-bounds reference in compressed stream");  \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  525|      0|      return BLOSC2_ERROR_FAILURE;                                               \
  |  |  526|      0|    }                                                                            \
  |  |  527|      0|  } while (0)
  |  |  ------------------
  |  |  |  Branch (527:12): [Folded, False: 0]
  |  |  ------------------
  ------------------
  557|      0|        uint16_t offset;
  558|      0|        memcpy(&offset, ip, sizeof(offset));
  559|      0|        int64_t bpos = (cur + 1) - (int64_t) offset - 1;
  560|      0|        NDLZ8_CHECK_RANGE(bpos, (int64_t) padding[0] * padding[1]);
  ------------------
  |  |  518|      0|  do {                                                                           \
  |  |  519|      0|    int64_t _pos = (int64_t) (pos);                                              \
  |  |  520|      0|    int64_t _len = (int64_t) (len);                                              \
  |  |  521|      0|    if (_pos < 0 || _len < 0 || _pos > (int64_t) input_len - _len) {             \
  |  |  ------------------
  |  |  |  Branch (521:9): [True: 0, False: 0]
  |  |  |  Branch (521:21): [True: 0, False: 0]
  |  |  |  Branch (521:33): [True: 0, False: 0]
  |  |  ------------------
  |  |  522|      0|      free(local_buffer);                                                        \
  |  |  523|      0|      free(cell_aux);                                                            \
  |  |  524|      0|      BLOSC_TRACE_ERROR("ndlz8: out-of-bounds reference in compressed stream");  \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  525|      0|      return BLOSC2_ERROR_FAILURE;                                               \
  |  |  526|      0|    }                                                                            \
  |  |  527|      0|  } while (0)
  |  |  ------------------
  |  |  |  Branch (527:12): [Folded, False: 0]
  |  |  ------------------
  ------------------
  561|      0|        buffercpy = (uint8_t *) input + bpos;
  562|      0|        ip += 2;
  563|      0|      } else if (token == (uint8_t) (1U << 6U)) { // whole cell of same element
  ------------------
  |  Branch (563:18): [True: 0, False: 0]
  ------------------
  564|      0|        NDLZ8_CHECK_RANGE(cur + 1, 1);
  ------------------
  |  |  518|      0|  do {                                                                           \
  |  |  519|      0|    int64_t _pos = (int64_t) (pos);                                              \
  |  |  520|      0|    int64_t _len = (int64_t) (len);                                              \
  |  |  521|      0|    if (_pos < 0 || _len < 0 || _pos > (int64_t) input_len - _len) {             \
  |  |  ------------------
  |  |  |  Branch (521:9): [True: 0, False: 0]
  |  |  |  Branch (521:21): [True: 0, False: 0]
  |  |  |  Branch (521:33): [True: 0, False: 0]
  |  |  ------------------
  |  |  522|      0|      free(local_buffer);                                                        \
  |  |  523|      0|      free(cell_aux);                                                            \
  |  |  524|      0|      BLOSC_TRACE_ERROR("ndlz8: out-of-bounds reference in compressed stream");  \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  525|      0|      return BLOSC2_ERROR_FAILURE;                                               \
  |  |  526|      0|    }                                                                            \
  |  |  527|      0|  } while (0)
  |  |  ------------------
  |  |  |  Branch (527:12): [Folded, False: 0]
  |  |  ------------------
  ------------------
  565|      0|        buffercpy = cell_aux;
  566|      0|        memset(buffercpy, *ip, cell_size);
  567|      0|        ip++;
  568|      0|      } else if (match_type == 21) {    // triple match
  ------------------
  |  Branch (568:18): [True: 0, False: 0]
  ------------------
  569|      0|        buffercpy = local_buffer;
  570|      0|        int row = (int) (token & 7);
  571|      0|        if (row + 2 >= cell_shape) {
  ------------------
  |  Branch (571:13): [True: 0, False: 0]
  ------------------
  572|      0|          free(local_buffer);
  573|      0|          free(cell_aux);
  574|      0|          BLOSC_TRACE_ERROR("Triple match row out of bounds");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  575|      0|          return BLOSC2_ERROR_FAILURE;
  576|      0|        }
  577|      0|        NDLZ8_CHECK_RANGE(cur + 1, 2);
  ------------------
  |  |  518|      0|  do {                                                                           \
  |  |  519|      0|    int64_t _pos = (int64_t) (pos);                                              \
  |  |  520|      0|    int64_t _len = (int64_t) (len);                                              \
  |  |  521|      0|    if (_pos < 0 || _len < 0 || _pos > (int64_t) input_len - _len) {             \
  |  |  ------------------
  |  |  |  Branch (521:9): [True: 0, False: 0]
  |  |  |  Branch (521:21): [True: 0, False: 0]
  |  |  |  Branch (521:33): [True: 0, False: 0]
  |  |  ------------------
  |  |  522|      0|      free(local_buffer);                                                        \
  |  |  523|      0|      free(cell_aux);                                                            \
  |  |  524|      0|      BLOSC_TRACE_ERROR("ndlz8: out-of-bounds reference in compressed stream");  \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  525|      0|      return BLOSC2_ERROR_FAILURE;                                               \
  |  |  526|      0|    }                                                                            \
  |  |  527|      0|  } while (0)
  |  |  ------------------
  |  |  |  Branch (527:12): [Folded, False: 0]
  |  |  ------------------
  ------------------
  578|      0|        uint16_t offset;
  579|      0|        memcpy(&offset, ip, sizeof(offset));
  580|      0|        ip += 2;
  581|       |        // back-reference base == ip - sizeof(token) - sizeof(offset) - offset,
  582|       |        // i.e. (cur + 3) - 3 - offset == cur - offset, expressed as an offset.
  583|      0|        int64_t bpos = cur - (int64_t) offset;
  584|      0|        NDLZ8_CHECK_RANGE(bpos, 3 * cell_shape);
  ------------------
  |  |  518|      0|  do {                                                                           \
  |  |  519|      0|    int64_t _pos = (int64_t) (pos);                                              \
  |  |  520|      0|    int64_t _len = (int64_t) (len);                                              \
  |  |  521|      0|    if (_pos < 0 || _len < 0 || _pos > (int64_t) input_len - _len) {             \
  |  |  ------------------
  |  |  |  Branch (521:9): [True: 0, False: 0]
  |  |  |  Branch (521:21): [True: 0, False: 0]
  |  |  |  Branch (521:33): [True: 0, False: 0]
  |  |  ------------------
  |  |  522|      0|      free(local_buffer);                                                        \
  |  |  523|      0|      free(cell_aux);                                                            \
  |  |  524|      0|      BLOSC_TRACE_ERROR("ndlz8: out-of-bounds reference in compressed stream");  \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  525|      0|      return BLOSC2_ERROR_FAILURE;                                               \
  |  |  526|      0|    }                                                                            \
  |  |  527|      0|  } while (0)
  |  |  ------------------
  |  |  |  Branch (527:12): [Folded, False: 0]
  |  |  ------------------
  ------------------
  585|      0|        const uint8_t *ref = (const uint8_t *) input + bpos;
  586|      0|        for (int l = 0; l < 3; l++) {
  ------------------
  |  Branch (586:25): [True: 0, False: 0]
  ------------------
  587|      0|          memcpy(&buffercpy[(row + l) * cell_shape], ref + l * cell_shape, cell_shape);
  588|      0|        }
  589|      0|        for (int l = 0; l < cell_shape; l++) {
  ------------------
  |  Branch (589:25): [True: 0, False: 0]
  ------------------
  590|      0|          if ((l < row) || (l > row + 2)) {
  ------------------
  |  Branch (590:15): [True: 0, False: 0]
  |  Branch (590:28): [True: 0, False: 0]
  ------------------
  591|      0|            NDLZ8_CHECK_RANGE(ip - (const uint8_t *) input, cell_shape);
  ------------------
  |  |  518|      0|  do {                                                                           \
  |  |  519|      0|    int64_t _pos = (int64_t) (pos);                                              \
  |  |  520|      0|    int64_t _len = (int64_t) (len);                                              \
  |  |  521|      0|    if (_pos < 0 || _len < 0 || _pos > (int64_t) input_len - _len) {             \
  |  |  ------------------
  |  |  |  Branch (521:9): [True: 0, False: 0]
  |  |  |  Branch (521:21): [True: 0, False: 0]
  |  |  |  Branch (521:33): [True: 0, False: 0]
  |  |  ------------------
  |  |  522|      0|      free(local_buffer);                                                        \
  |  |  523|      0|      free(cell_aux);                                                            \
  |  |  524|      0|      BLOSC_TRACE_ERROR("ndlz8: out-of-bounds reference in compressed stream");  \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  525|      0|      return BLOSC2_ERROR_FAILURE;                                               \
  |  |  526|      0|    }                                                                            \
  |  |  527|      0|  } while (0)
  |  |  ------------------
  |  |  |  Branch (527:12): [Folded, False: 0]
  |  |  ------------------
  ------------------
  592|      0|            memcpy(&buffercpy[l * cell_shape], ip, cell_shape);
  593|      0|            ip += cell_shape;
  594|      0|          }
  595|      0|        }
  596|      0|      } else if (match_type == 17) {    // pair match
  ------------------
  |  Branch (596:18): [True: 0, False: 0]
  ------------------
  597|      0|        buffercpy = local_buffer;
  598|      0|        int row = (int) (token & 7);
  599|      0|        if (row + 1 >= cell_shape) {
  ------------------
  |  Branch (599:13): [True: 0, False: 0]
  ------------------
  600|      0|          free(local_buffer);
  601|      0|          free(cell_aux);
  602|      0|          BLOSC_TRACE_ERROR("Pair match row out of bounds");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  603|      0|          return BLOSC2_ERROR_FAILURE;
  604|      0|        }
  605|      0|        NDLZ8_CHECK_RANGE(cur + 1, 2);
  ------------------
  |  |  518|      0|  do {                                                                           \
  |  |  519|      0|    int64_t _pos = (int64_t) (pos);                                              \
  |  |  520|      0|    int64_t _len = (int64_t) (len);                                              \
  |  |  521|      0|    if (_pos < 0 || _len < 0 || _pos > (int64_t) input_len - _len) {             \
  |  |  ------------------
  |  |  |  Branch (521:9): [True: 0, False: 0]
  |  |  |  Branch (521:21): [True: 0, False: 0]
  |  |  |  Branch (521:33): [True: 0, False: 0]
  |  |  ------------------
  |  |  522|      0|      free(local_buffer);                                                        \
  |  |  523|      0|      free(cell_aux);                                                            \
  |  |  524|      0|      BLOSC_TRACE_ERROR("ndlz8: out-of-bounds reference in compressed stream");  \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  525|      0|      return BLOSC2_ERROR_FAILURE;                                               \
  |  |  526|      0|    }                                                                            \
  |  |  527|      0|  } while (0)
  |  |  ------------------
  |  |  |  Branch (527:12): [Folded, False: 0]
  |  |  ------------------
  ------------------
  606|      0|        uint16_t offset;
  607|      0|        memcpy(&offset, ip, sizeof(offset));
  608|      0|        ip += 2;
  609|       |        // back-reference base == cur - offset (see triple-match note above).
  610|      0|        int64_t bpos = cur - (int64_t) offset;
  611|      0|        NDLZ8_CHECK_RANGE(bpos, 2 * cell_shape);
  ------------------
  |  |  518|      0|  do {                                                                           \
  |  |  519|      0|    int64_t _pos = (int64_t) (pos);                                              \
  |  |  520|      0|    int64_t _len = (int64_t) (len);                                              \
  |  |  521|      0|    if (_pos < 0 || _len < 0 || _pos > (int64_t) input_len - _len) {             \
  |  |  ------------------
  |  |  |  Branch (521:9): [True: 0, False: 0]
  |  |  |  Branch (521:21): [True: 0, False: 0]
  |  |  |  Branch (521:33): [True: 0, False: 0]
  |  |  ------------------
  |  |  522|      0|      free(local_buffer);                                                        \
  |  |  523|      0|      free(cell_aux);                                                            \
  |  |  524|      0|      BLOSC_TRACE_ERROR("ndlz8: out-of-bounds reference in compressed stream");  \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  525|      0|      return BLOSC2_ERROR_FAILURE;                                               \
  |  |  526|      0|    }                                                                            \
  |  |  527|      0|  } while (0)
  |  |  ------------------
  |  |  |  Branch (527:12): [Folded, False: 0]
  |  |  ------------------
  ------------------
  612|      0|        const uint8_t *ref = (const uint8_t *) input + bpos;
  613|      0|        for (int l = 0; l < 2; l++) {
  ------------------
  |  Branch (613:25): [True: 0, False: 0]
  ------------------
  614|      0|          memcpy(&buffercpy[(row + l) * cell_shape], ref + l * cell_shape, cell_shape);
  615|      0|        }
  616|      0|        for (int l = 0; l < cell_shape; l++) {
  ------------------
  |  Branch (616:25): [True: 0, False: 0]
  ------------------
  617|      0|          if ((l < row) || (l > row + 1)) {
  ------------------
  |  Branch (617:15): [True: 0, False: 0]
  |  Branch (617:28): [True: 0, False: 0]
  ------------------
  618|      0|            NDLZ8_CHECK_RANGE(ip - (const uint8_t *) input, cell_shape);
  ------------------
  |  |  518|      0|  do {                                                                           \
  |  |  519|      0|    int64_t _pos = (int64_t) (pos);                                              \
  |  |  520|      0|    int64_t _len = (int64_t) (len);                                              \
  |  |  521|      0|    if (_pos < 0 || _len < 0 || _pos > (int64_t) input_len - _len) {             \
  |  |  ------------------
  |  |  |  Branch (521:9): [True: 0, False: 0]
  |  |  |  Branch (521:21): [True: 0, False: 0]
  |  |  |  Branch (521:33): [True: 0, False: 0]
  |  |  ------------------
  |  |  522|      0|      free(local_buffer);                                                        \
  |  |  523|      0|      free(cell_aux);                                                            \
  |  |  524|      0|      BLOSC_TRACE_ERROR("ndlz8: out-of-bounds reference in compressed stream");  \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  525|      0|      return BLOSC2_ERROR_FAILURE;                                               \
  |  |  526|      0|    }                                                                            \
  |  |  527|      0|  } while (0)
  |  |  ------------------
  |  |  |  Branch (527:12): [Folded, False: 0]
  |  |  ------------------
  ------------------
  619|      0|            memcpy(&buffercpy[l * cell_shape], ip, cell_shape);
  620|      0|            ip += cell_shape;
  621|      0|          }
  622|      0|        }
  623|      0|      } else {
  624|      0|        free(local_buffer);
  625|      0|        free(cell_aux);
  626|      0|        BLOSC_TRACE_ERROR("Invalid token: %u at cell [%d, %d]\n", token, ii[0], ii[1]);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  627|      0|        return BLOSC2_ERROR_FAILURE;
  628|      0|      }
  629|       |
  630|      0|      int32_t orig = ii[0] * cell_shape * blockshape[1] + ii[1] * cell_shape;
  631|      0|      for (int32_t i = 0; i < (int32_t) cell_shape; i++) {
  ------------------
  |  Branch (631:27): [True: 0, False: 0]
  ------------------
  632|      0|        if (i < padding[0]) {
  ------------------
  |  Branch (632:13): [True: 0, False: 0]
  ------------------
  633|      0|          ind = orig + i * blockshape[1];
  634|      0|          memcpy(&op[ind], buffercpy, padding[1]);
  635|       |          // Only advance over rows we actually consume.  For a literal cell
  636|       |          // (token == 0) buffercpy points into the input and only holds
  637|       |          // padding[0] * padding[1] bytes; advancing unconditionally for the
  638|       |          // trailing padding rows would form an out-of-bounds pointer (UB)
  639|       |          // for the block's last cell.  The skipped rows are never read.
  640|      0|          buffercpy += padding[1];
  641|      0|        }
  642|      0|      }
  643|      0|      if (ind > output_len) {
  ------------------
  |  Branch (643:11): [True: 0, False: 0]
  ------------------
  644|      0|        free(local_buffer);
  645|      0|        free(cell_aux);
  646|      0|        BLOSC_TRACE_ERROR("Exceeding output size");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  647|      0|        return BLOSC2_ERROR_FAILURE;
  648|      0|      }
  649|      0|    }
  650|      0|  }
  651|      0|  ind += padding[1];
  652|       |
  653|      0|  free(cell_aux);
  654|      0|  free(local_buffer);
  655|       |
  656|      0|  if (ind != (blockshape[0] * blockshape[1])) {
  ------------------
  |  Branch (656:7): [True: 0, False: 0]
  ------------------
  657|      0|    BLOSC_TRACE_ERROR("Output size is not compatible with embedded blockshape");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  658|      0|    return BLOSC2_ERROR_FAILURE;
  659|      0|  }
  660|      0|  if (ind > output_len) {
  ------------------
  |  Branch (660:7): [True: 0, False: 0]
  ------------------
  661|      0|    BLOSC_TRACE_ERROR("Exceeding output size");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  662|      0|    return BLOSC2_ERROR_FAILURE;
  663|      0|  }
  664|       |
  665|      0|  return (int) ind;
  666|      0|#undef NDLZ8_CHECK_RANGE
  667|      0|}

zfp_acc_compress:
  152|     14|                     int32_t output_len, uint8_t meta, blosc2_cparams *cparams, const void *chunk) {
  153|     14|  BLOSC_UNUSED_PARAM(chunk);
  ------------------
  |  |   28|     14|#define BLOSC_UNUSED_PARAM(x) ((void)(x))
  ------------------
  154|     14|  ZFP_ERROR_NULL(input);
  ------------------
  |  |   22|     14|  do {                          \
  |  |   23|     14|    if ((pointer) == NULL) {    \
  |  |  ------------------
  |  |  |  Branch (23:9): [True: 0, False: 14]
  |  |  ------------------
  |  |   24|      0|      return 0;                 \
  |  |   25|      0|    }                           \
  |  |   26|     14|  } while (0)
  |  |  ------------------
  |  |  |  Branch (26:12): [Folded, False: 14]
  |  |  ------------------
  ------------------
  155|     14|  ZFP_ERROR_NULL(output);
  ------------------
  |  |   22|     14|  do {                          \
  |  |   23|     14|    if ((pointer) == NULL) {    \
  |  |  ------------------
  |  |  |  Branch (23:9): [True: 0, False: 14]
  |  |  ------------------
  |  |   24|      0|      return 0;                 \
  |  |   25|      0|    }                           \
  |  |   26|     14|  } while (0)
  |  |  ------------------
  |  |  |  Branch (26:12): [Folded, False: 14]
  |  |  ------------------
  ------------------
  156|     14|  ZFP_ERROR_NULL(cparams);
  ------------------
  |  |   22|     14|  do {                          \
  |  |   23|     14|    if ((pointer) == NULL) {    \
  |  |  ------------------
  |  |  |  Branch (23:9): [True: 0, False: 14]
  |  |  ------------------
  |  |   24|      0|      return 0;                 \
  |  |   25|      0|    }                           \
  |  |   26|     14|  } while (0)
  |  |  ------------------
  |  |  |  Branch (26:12): [Folded, False: 14]
  |  |  ------------------
  ------------------
  157|     14|  ZFP_ERROR_NULL(cparams->schunk);
  ------------------
  |  |   22|     14|  do {                          \
  |  |   23|     14|    if ((pointer) == NULL) {    \
  |  |  ------------------
  |  |  |  Branch (23:9): [True: 0, False: 14]
  |  |  ------------------
  |  |   24|      0|      return 0;                 \
  |  |   25|      0|    }                           \
  |  |   26|     14|  } while (0)
  |  |  ------------------
  |  |  |  Branch (26:12): [Folded, False: 14]
  |  |  ------------------
  ------------------
  158|     14|  if (output_len <= 0) {
  ------------------
  |  Branch (158:7): [True: 0, False: 14]
  ------------------
  159|      0|    return 0;
  160|      0|  }
  161|       |
  162|     14|  double tol = (int8_t) meta;
  163|     14|  int8_t ndim;
  164|     14|  int64_t *shape = malloc(B2ND_MAX_DIM * sizeof(int64_t));
  ------------------
  |  |   50|     14|#define B2ND_MAX_DIM 16
  ------------------
  165|     14|  int32_t *chunkshape = malloc(B2ND_MAX_DIM * sizeof(int32_t));
  ------------------
  |  |   50|     14|#define B2ND_MAX_DIM 16
  ------------------
  166|     14|  int32_t *blockshape = malloc(B2ND_MAX_DIM * sizeof(int32_t));
  ------------------
  |  |   50|     14|#define B2ND_MAX_DIM 16
  ------------------
  167|     14|  uint8_t *smeta;
  168|     14|  int32_t smeta_len;
  169|     14|  if (blosc2_meta_get(cparams->schunk, "b2nd", &smeta, &smeta_len) < 0) {
  ------------------
  |  Branch (169:7): [True: 0, False: 14]
  ------------------
  170|      0|    free(shape);
  171|      0|    free(chunkshape);
  172|      0|    free(blockshape);
  173|      0|    BLOSC_TRACE_ERROR("b2nd layer not found!");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  174|      0|    return BLOSC2_ERROR_FAILURE;
  175|      0|  }
  176|     14|  int deserialize_rc = b2nd_deserialize_meta(smeta, smeta_len, &ndim, shape, chunkshape, blockshape, NULL, NULL);
  177|     14|  free(smeta);
  178|     14|  if (deserialize_rc < 0 || ndim <= 0 || ndim > ZFP_MAX_DIM) {
  ------------------
  |  |   16|     14|#define ZFP_MAX_DIM 4
  ------------------
  |  Branch (178:7): [True: 0, False: 14]
  |  Branch (178:29): [True: 0, False: 14]
  |  Branch (178:42): [True: 0, False: 14]
  ------------------
  179|      0|    free(shape);
  180|      0|    free(chunkshape);
  181|      0|    free(blockshape);
  182|      0|    BLOSC_TRACE_ERROR("Invalid b2nd meta info (ndim %d)", ndim);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  183|      0|    return BLOSC2_ERROR_FAILURE;
  184|      0|  }
  185|       |
  186|     56|  for(int i = 0; i < ndim; i++) {
  ------------------
  |  Branch (186:18): [True: 42, False: 14]
  ------------------
  187|     42|    if (blockshape[i] < 4) {
  ------------------
  |  Branch (187:9): [True: 0, False: 42]
  ------------------
  188|      0|      free(shape);
  189|      0|      free(chunkshape);
  190|      0|      free(blockshape);
  191|      0|      BLOSC_TRACE_ERROR("ZFP does not support blocks smaller than cells (4x...x4)");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  192|      0|      return BLOSC2_ERROR_FAILURE;
  193|      0|    }
  194|     42|  }
  195|       |
  196|       |  /* The b2nd blockshape determines the dataset fed to ZFP, so the input must be
  197|       |   * a complete block.  With split streams (e.g. SplitMode.ALWAYS_SPLIT) or any
  198|       |   * partial buffer, input_len is smaller than the block: compressing would
  199|       |   * overread the input, and the result would decompress to more bytes than the
  200|       |   * stream slot it came from.  Store uncompressed in that case. */
  201|     14|  {
  202|     14|    int64_t block_nbytes = cparams->typesize;
  203|     56|    for (int i = 0; i < ndim; i++) {
  ------------------
  |  Branch (203:21): [True: 42, False: 14]
  ------------------
  204|     42|      block_nbytes *= blockshape[i];
  205|     42|    }
  206|     14|    if ((int64_t) input_len != block_nbytes) {
  ------------------
  |  Branch (206:9): [True: 0, False: 14]
  ------------------
  207|      0|      free(shape);
  208|      0|      free(chunkshape);
  209|      0|      free(blockshape);
  210|      0|      return 0;
  211|      0|    }
  212|     14|  }
  213|       |
  214|     14|  zfp_type type;     /* array scalar type */
  215|     14|  zfp_field *field;  /* array meta data */
  216|     14|  zfp_stream *zfp;   /* stream containing the real output buffer */
  217|     14|  zfp_stream *zfp_aux;   /* auxiliary compressed stream */
  218|     14|  bitstream *stream; /* bit stream to write to or read from */
  219|     14|  bitstream *stream_aux; /* auxiliary bit stream to write to or read from */
  220|     14|  size_t zfpsize;    /* byte size of compressed stream */
  221|     14|  double tolerance = pow(10, tol);
  222|       |
  223|     14|  int32_t typesize = cparams->typesize;
  224|       |
  225|     14|  switch (typesize) {
  226|     14|    case sizeof(float):
  ------------------
  |  Branch (226:5): [True: 14, False: 0]
  ------------------
  227|     14|      type = zfp_type_float;
  228|     14|      break;
  229|      0|    case sizeof(double):
  ------------------
  |  Branch (229:5): [True: 0, False: 14]
  ------------------
  230|      0|      type = zfp_type_double;
  231|      0|      break;
  232|      0|    default:
  ------------------
  |  Branch (232:5): [True: 0, False: 14]
  ------------------
  233|      0|      free(shape);
  234|      0|      free(chunkshape);
  235|      0|      free(blockshape);
  236|      0|      BLOSC_TRACE_ERROR("ZFP is not available for typesize: %d", typesize);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  237|      0|      return BLOSC2_ERROR_FAILURE;
  238|     14|  }
  239|       |
  240|     14|  zfp = zfp_stream_open(NULL);
  241|     14|  zfp_stream_set_accuracy(zfp, tolerance);
  242|     14|  stream = stream_open(output, output_len);
  243|     14|  zfp_stream_set_bit_stream(zfp, stream);
  244|     14|  zfp_stream_rewind(zfp);
  245|       |
  246|     14|  switch (ndim) {
  247|      0|    case 1:
  ------------------
  |  Branch (247:5): [True: 0, False: 14]
  ------------------
  248|      0|      field = zfp_field_1d((void *) input, type, blockshape[0]);
  249|      0|      break;
  250|      0|    case 2:
  ------------------
  |  Branch (250:5): [True: 0, False: 14]
  ------------------
  251|      0|      field = zfp_field_2d((void *) input, type, blockshape[1], blockshape[0]);
  252|      0|      break;
  253|     14|    case 3:
  ------------------
  |  Branch (253:5): [True: 14, False: 0]
  ------------------
  254|     14|      field = zfp_field_3d((void *) input, type, blockshape[2], blockshape[1], blockshape[0]);
  255|     14|      break;
  256|      0|    case 4:
  ------------------
  |  Branch (256:5): [True: 0, False: 14]
  ------------------
  257|      0|      field = zfp_field_4d((void *) input, type, blockshape[3], blockshape[2], blockshape[1], blockshape[0]);
  258|      0|      break;
  259|      0|    default:
  ------------------
  |  Branch (259:5): [True: 0, False: 14]
  ------------------
  260|      0|      free(shape);
  261|      0|      free(chunkshape);
  262|      0|      free(blockshape);
  263|      0|      BLOSC_TRACE_ERROR("ZFP is not available for ndims: %d", ndim);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  264|      0|      return BLOSC2_ERROR_FAILURE;
  265|     14|  }
  266|       |
  267|     14|  int zfp_maxout = (int) zfp_stream_maximum_size(zfp, field);
  268|     14|  zfp_stream_close(zfp);
  269|     14|  stream_close(stream);
  270|     14|  uint8_t *aux_out = malloc(zfp_maxout);
  271|     14|  zfp_aux = zfp_stream_open(NULL);
  272|     14|  zfp_stream_set_accuracy(zfp_aux, tolerance);
  273|     14|  stream_aux = stream_open(aux_out, zfp_maxout);
  274|     14|  zfp_stream_set_bit_stream(zfp_aux, stream_aux);
  275|     14|  zfp_stream_rewind(zfp_aux);
  276|       |
  277|     14|  zfpsize = zfp_compress(zfp_aux, field);
  278|       |
  279|       |  /* clean up */
  280|     14|  zfp_field_free(field);
  281|     14|  zfp_stream_close(zfp_aux);
  282|     14|  stream_close(stream_aux);
  283|     14|  free(shape);
  284|     14|  free(chunkshape);
  285|     14|  free(blockshape);
  286|       |
  287|     14|  if (zfpsize == 0) {
  ------------------
  |  Branch (287:7): [True: 0, False: 14]
  ------------------
  288|      0|    BLOSC_TRACE_ERROR("\n ZFP: Compression failed\n");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  289|      0|    free(aux_out);
  290|      0|    return (int) zfpsize;
  291|      0|  }
  292|     14|  if (zfpsize >= (size_t) input_len || zfpsize > (size_t) output_len) {
  ------------------
  |  Branch (292:7): [True: 1, False: 13]
  |  Branch (292:40): [True: 0, False: 13]
  ------------------
  293|      1|    BLOSC_TRACE_ERROR("\n ZFP: Compressed data is bigger than input or output buffer! \n");
  ------------------
  |  |   93|      1|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      1|    do {                                            \
  |  |  |  |   98|      1|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      1|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 1, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      1|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  294|      1|    free(aux_out);
  295|      1|    return 0;
  296|      1|  }
  297|       |
  298|     13|  memcpy(output, aux_out, zfpsize);
  299|     13|  free(aux_out);
  300|       |
  301|     13|  return (int) zfpsize;
  302|     14|}
zfp_acc_decompress:
  305|     27|                       int32_t output_len, uint8_t meta, blosc2_dparams *dparams, const void *chunk) {
  306|     27|  ZFP_ERROR_NULL(input);
  ------------------
  |  |   22|     27|  do {                          \
  |  |   23|     27|    if ((pointer) == NULL) {    \
  |  |  ------------------
  |  |  |  Branch (23:9): [True: 0, False: 27]
  |  |  ------------------
  |  |   24|      0|      return 0;                 \
  |  |   25|      0|    }                           \
  |  |   26|     27|  } while (0)
  |  |  ------------------
  |  |  |  Branch (26:12): [Folded, False: 27]
  |  |  ------------------
  ------------------
  307|     27|  ZFP_ERROR_NULL(output);
  ------------------
  |  |   22|     27|  do {                          \
  |  |   23|     27|    if ((pointer) == NULL) {    \
  |  |  ------------------
  |  |  |  Branch (23:9): [True: 0, False: 27]
  |  |  ------------------
  |  |   24|      0|      return 0;                 \
  |  |   25|      0|    }                           \
  |  |   26|     27|  } while (0)
  |  |  ------------------
  |  |  |  Branch (26:12): [Folded, False: 27]
  |  |  ------------------
  ------------------
  308|     27|  ZFP_ERROR_NULL(dparams);
  ------------------
  |  |   22|     27|  do {                          \
  |  |   23|     27|    if ((pointer) == NULL) {    \
  |  |  ------------------
  |  |  |  Branch (23:9): [True: 0, False: 27]
  |  |  ------------------
  |  |   24|      0|      return 0;                 \
  |  |   25|      0|    }                           \
  |  |   26|     27|  } while (0)
  |  |  ------------------
  |  |  |  Branch (26:12): [Folded, False: 27]
  |  |  ------------------
  ------------------
  309|     27|  ZFP_ERROR_NULL(dparams->schunk);
  ------------------
  |  |   22|     27|  do {                          \
  |  |   23|     27|    if ((pointer) == NULL) {    \
  |  |  ------------------
  |  |  |  Branch (23:9): [True: 1, False: 26]
  |  |  ------------------
  |  |   24|      1|      return 0;                 \
  |  |   25|      1|    }                           \
  |  |   26|     27|  } while (0)
  |  |  ------------------
  |  |  |  Branch (26:12): [Folded, False: 26]
  |  |  ------------------
  ------------------
  310|     26|  BLOSC_UNUSED_PARAM(chunk);
  ------------------
  |  |   28|     26|#define BLOSC_UNUSED_PARAM(x) ((void)(x))
  ------------------
  311|       |
  312|     26|  blosc2_schunk *sc = dparams->schunk;
  313|     26|  int32_t typesize = sc->typesize;
  314|       |
  315|     26|  double tol = (int8_t) meta;
  316|     26|  int8_t ndim;
  317|     26|  int64_t *shape = malloc(B2ND_MAX_DIM * sizeof(int64_t));
  ------------------
  |  |   50|     26|#define B2ND_MAX_DIM 16
  ------------------
  318|     26|  int32_t *chunkshape = malloc(B2ND_MAX_DIM * sizeof(int32_t));
  ------------------
  |  |   50|     26|#define B2ND_MAX_DIM 16
  ------------------
  319|     26|  int32_t *blockshape = malloc(B2ND_MAX_DIM * sizeof(int32_t));
  ------------------
  |  |   50|     26|#define B2ND_MAX_DIM 16
  ------------------
  320|     26|  uint8_t *smeta;
  321|     26|  int32_t smeta_len;
  322|     26|  if (blosc2_meta_get(sc, "b2nd", &smeta, &smeta_len) < 0) {
  ------------------
  |  Branch (322:7): [True: 0, False: 26]
  ------------------
  323|      0|    BLOSC_TRACE_ERROR("Cannot access b2nd meta info");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  324|      0|    free(shape);
  325|      0|    free(chunkshape);
  326|      0|    free(blockshape);
  327|      0|    return BLOSC2_ERROR_FAILURE;
  328|      0|  }
  329|     26|  int deserialize_rc = b2nd_deserialize_meta(smeta, smeta_len, &ndim, shape, chunkshape, blockshape, NULL, NULL);
  330|     26|  free(smeta);
  331|       |
  332|     26|  if (zfp_check_output_size(deserialize_rc, ndim, blockshape, typesize, output_len) < 0) {
  ------------------
  |  Branch (332:7): [True: 0, False: 26]
  ------------------
  333|      0|    free(shape);
  334|      0|    free(chunkshape);
  335|      0|    free(blockshape);
  336|      0|    return BLOSC2_ERROR_FAILURE;
  337|      0|  }
  338|       |
  339|     26|  zfp_type type;     /* array scalar type */
  340|     26|  zfp_field *field;  /* array meta data */
  341|     26|  zfp_stream *zfp;   /* compressed stream */
  342|     26|  bitstream *stream = NULL; /* bit stream to write to or read from */
  343|     26|  uint8_t *padded_input = NULL;
  344|     26|  size_t zfpsize;    /* byte size of compressed stream */
  345|     26|  double tolerance = pow(10, tol);
  346|       |
  347|     26|  switch (typesize) {
  348|     26|    case sizeof(float):
  ------------------
  |  Branch (348:5): [True: 26, False: 0]
  ------------------
  349|     26|      type = zfp_type_float;
  350|     26|      break;
  351|      0|    case sizeof(double):
  ------------------
  |  Branch (351:5): [True: 0, False: 26]
  ------------------
  352|      0|      type = zfp_type_double;
  353|      0|      break;
  354|      0|    default:
  ------------------
  |  Branch (354:5): [True: 0, False: 26]
  ------------------
  355|      0|      free(shape);
  356|      0|      free(chunkshape);
  357|      0|      free(blockshape);
  358|      0|      BLOSC_TRACE_ERROR("ZFP is not available for typesize: %d", typesize);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  359|      0|      return BLOSC2_ERROR_FAILURE;
  360|     26|  }
  361|       |
  362|     26|  zfp = zfp_stream_open(NULL);
  363|     26|  zfp_stream_set_accuracy(zfp, tolerance);
  364|       |
  365|     26|  switch (ndim) {
  366|      0|    case 1:
  ------------------
  |  Branch (366:5): [True: 0, False: 26]
  ------------------
  367|      0|      field = zfp_field_1d((void *) output, type, blockshape[0]);
  368|      0|      break;
  369|      0|    case 2:
  ------------------
  |  Branch (369:5): [True: 0, False: 26]
  ------------------
  370|      0|      field = zfp_field_2d((void *) output, type, blockshape[1], blockshape[0]);
  371|      0|      break;
  372|     26|    case 3:
  ------------------
  |  Branch (372:5): [True: 26, False: 0]
  ------------------
  373|     26|      field = zfp_field_3d((void *) output, type, blockshape[2], blockshape[1], blockshape[0]);
  374|     26|      break;
  375|      0|    case 4:
  ------------------
  |  Branch (375:5): [True: 0, False: 26]
  ------------------
  376|      0|      field = zfp_field_4d((void *) output, type, blockshape[3], blockshape[2], blockshape[1], blockshape[0]);
  377|      0|      break;
  378|      0|    default:
  ------------------
  |  Branch (378:5): [True: 0, False: 26]
  ------------------
  379|      0|      free(shape);
  380|      0|      free(chunkshape);
  381|      0|      free(blockshape);
  382|      0|      BLOSC_TRACE_ERROR("ZFP is not available for ndims: %d", ndim);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  383|      0|      return BLOSC2_ERROR_FAILURE;
  384|     26|  }
  385|       |
  386|     26|  size_t blocks = zfp_field_blocks(field);
  387|     26|  size_t min_bytes = (blocks + CHAR_BIT - 1) / CHAR_BIT;
  388|     26|  if (min_bytes < 1) {
  ------------------
  |  Branch (388:7): [True: 0, False: 26]
  ------------------
  389|      0|    min_bytes = 1;
  390|      0|  }
  391|     26|  if (input_len < 0 || (size_t) input_len < min_bytes) {
  ------------------
  |  Branch (391:7): [True: 0, False: 26]
  |  Branch (391:24): [True: 0, False: 26]
  ------------------
  392|      0|    BLOSC_TRACE_ERROR("ZFP acc: input too small (%d bytes) for the required "
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  393|      0|                      "bitstream size (%zu bytes)", input_len, min_bytes);
  394|      0|    zfp_field_free(field);
  395|      0|    zfp_stream_close(zfp);
  396|      0|    free(shape);
  397|      0|    free(chunkshape);
  398|      0|    free(blockshape);
  399|      0|    return BLOSC2_ERROR_FAILURE;
  400|      0|  }
  401|       |
  402|     26|  if (zfp_open_padded_stream(input, input_len, zfp, field, &stream, &padded_input) != BLOSC2_ERROR_SUCCESS) {
  ------------------
  |  Branch (402:7): [True: 0, False: 26]
  ------------------
  403|      0|    zfp_field_free(field);
  404|      0|    zfp_stream_close(zfp);
  405|      0|    free(shape);
  406|      0|    free(chunkshape);
  407|      0|    free(blockshape);
  408|      0|    return BLOSC2_ERROR_FAILURE;
  409|      0|  }
  410|       |
  411|     26|  zfpsize = zfp_decompress(zfp, field);
  412|       |
  413|       |  /* clean up */
  414|     26|  zfp_field_free(field);
  415|     26|  zfp_stream_close(zfp);
  416|     26|  zfp_close_padded_stream(stream, padded_input);
  417|     26|  free(shape);
  418|     26|  free(chunkshape);
  419|     26|  free(blockshape);
  420|       |
  421|     26|  if (zfpsize == 0) {
  ------------------
  |  Branch (421:7): [True: 0, False: 26]
  ------------------
  422|      0|    BLOSC_TRACE_ERROR("\n ZFP: Decompression failed\n");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  423|      0|    return (int) zfpsize;
  424|      0|  }
  425|       |
  426|     26|  return (int) output_len;
  427|     26|}
zfp_prec_compress:
  430|     67|                      int32_t output_len, uint8_t meta, blosc2_cparams *cparams, const void *chunk) {
  431|     67|  BLOSC_UNUSED_PARAM(chunk);
  ------------------
  |  |   28|     67|#define BLOSC_UNUSED_PARAM(x) ((void)(x))
  ------------------
  432|     67|  ZFP_ERROR_NULL(input);
  ------------------
  |  |   22|     67|  do {                          \
  |  |   23|     67|    if ((pointer) == NULL) {    \
  |  |  ------------------
  |  |  |  Branch (23:9): [True: 0, False: 67]
  |  |  ------------------
  |  |   24|      0|      return 0;                 \
  |  |   25|      0|    }                           \
  |  |   26|     67|  } while (0)
  |  |  ------------------
  |  |  |  Branch (26:12): [Folded, False: 67]
  |  |  ------------------
  ------------------
  433|     67|  ZFP_ERROR_NULL(output);
  ------------------
  |  |   22|     67|  do {                          \
  |  |   23|     67|    if ((pointer) == NULL) {    \
  |  |  ------------------
  |  |  |  Branch (23:9): [True: 0, False: 67]
  |  |  ------------------
  |  |   24|      0|      return 0;                 \
  |  |   25|      0|    }                           \
  |  |   26|     67|  } while (0)
  |  |  ------------------
  |  |  |  Branch (26:12): [Folded, False: 67]
  |  |  ------------------
  ------------------
  434|     67|  ZFP_ERROR_NULL(cparams);
  ------------------
  |  |   22|     67|  do {                          \
  |  |   23|     67|    if ((pointer) == NULL) {    \
  |  |  ------------------
  |  |  |  Branch (23:9): [True: 0, False: 67]
  |  |  ------------------
  |  |   24|      0|      return 0;                 \
  |  |   25|      0|    }                           \
  |  |   26|     67|  } while (0)
  |  |  ------------------
  |  |  |  Branch (26:12): [Folded, False: 67]
  |  |  ------------------
  ------------------
  435|     67|  ZFP_ERROR_NULL(cparams->schunk);
  ------------------
  |  |   22|     67|  do {                          \
  |  |   23|     67|    if ((pointer) == NULL) {    \
  |  |  ------------------
  |  |  |  Branch (23:9): [True: 0, False: 67]
  |  |  ------------------
  |  |   24|      0|      return 0;                 \
  |  |   25|      0|    }                           \
  |  |   26|     67|  } while (0)
  |  |  ------------------
  |  |  |  Branch (26:12): [Folded, False: 67]
  |  |  ------------------
  ------------------
  436|     67|  if (output_len <= 0) {
  ------------------
  |  Branch (436:7): [True: 0, False: 67]
  ------------------
  437|      0|    return 0;
  438|      0|  }
  439|       |
  440|     67|  int8_t ndim;
  441|     67|  int64_t *shape = malloc(B2ND_MAX_DIM * sizeof(int64_t));
  ------------------
  |  |   50|     67|#define B2ND_MAX_DIM 16
  ------------------
  442|     67|  int32_t *chunkshape = malloc(B2ND_MAX_DIM * sizeof(int32_t));
  ------------------
  |  |   50|     67|#define B2ND_MAX_DIM 16
  ------------------
  443|     67|  int32_t *blockshape = malloc(B2ND_MAX_DIM * sizeof(int32_t));
  ------------------
  |  |   50|     67|#define B2ND_MAX_DIM 16
  ------------------
  444|     67|  uint8_t *smeta;
  445|     67|  int32_t smeta_len;
  446|     67|  if (blosc2_meta_get(cparams->schunk, "b2nd", &smeta, &smeta_len) < 0) {
  ------------------
  |  Branch (446:7): [True: 0, False: 67]
  ------------------
  447|      0|    free(shape);
  448|      0|    free(chunkshape);
  449|      0|    free(blockshape);
  450|      0|    BLOSC_TRACE_ERROR("b2nd layer not found!");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  451|      0|    return BLOSC2_ERROR_FAILURE;
  452|      0|  }
  453|     67|  int deserialize_rc = b2nd_deserialize_meta(smeta, smeta_len, &ndim, shape, chunkshape, blockshape, NULL, NULL);
  454|     67|  free(smeta);
  455|     67|  if (deserialize_rc < 0 || ndim <= 0 || ndim > ZFP_MAX_DIM) {
  ------------------
  |  |   16|     67|#define ZFP_MAX_DIM 4
  ------------------
  |  Branch (455:7): [True: 0, False: 67]
  |  Branch (455:29): [True: 0, False: 67]
  |  Branch (455:42): [True: 0, False: 67]
  ------------------
  456|      0|    free(shape);
  457|      0|    free(chunkshape);
  458|      0|    free(blockshape);
  459|      0|    BLOSC_TRACE_ERROR("Invalid b2nd meta info (ndim %d)", ndim);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  460|      0|    return BLOSC2_ERROR_FAILURE;
  461|      0|  }
  462|       |
  463|    309|  for(int i = 0; i < ndim; i++) {
  ------------------
  |  Branch (463:18): [True: 242, False: 67]
  ------------------
  464|    242|    if (blockshape[i] < 4) {
  ------------------
  |  Branch (464:9): [True: 0, False: 242]
  ------------------
  465|      0|      free(shape);
  466|      0|      free(chunkshape);
  467|      0|      free(blockshape);
  468|      0|      BLOSC_TRACE_ERROR("ZFP does not support blocks smaller than cells (4x...x4)");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  469|      0|      return BLOSC2_ERROR_FAILURE;
  470|      0|    }
  471|    242|  }
  472|       |
  473|       |  /* The b2nd blockshape determines the dataset fed to ZFP, so the input must be
  474|       |   * a complete block.  With split streams (e.g. SplitMode.ALWAYS_SPLIT) or any
  475|       |   * partial buffer, input_len is smaller than the block: compressing would
  476|       |   * overread the input, and the result would decompress to more bytes than the
  477|       |   * stream slot it came from.  Store uncompressed in that case. */
  478|     67|  {
  479|     67|    int64_t block_nbytes = cparams->typesize;
  480|    309|    for (int i = 0; i < ndim; i++) {
  ------------------
  |  Branch (480:21): [True: 242, False: 67]
  ------------------
  481|    242|      block_nbytes *= blockshape[i];
  482|    242|    }
  483|     67|    if ((int64_t) input_len != block_nbytes) {
  ------------------
  |  Branch (483:9): [True: 0, False: 67]
  ------------------
  484|      0|      free(shape);
  485|      0|      free(chunkshape);
  486|      0|      free(blockshape);
  487|      0|      return 0;
  488|      0|    }
  489|     67|  }
  490|       |
  491|     67|  zfp_type type;     /* array scalar type */
  492|     67|  zfp_field *field;  /* array meta data */
  493|     67|  zfp_stream *zfp;   /* stream containing the real output buffer */
  494|     67|  zfp_stream *zfp_aux;   /* auxiliary compressed stream */
  495|     67|  bitstream *stream; /* bit stream to write to or read from */
  496|     67|  bitstream *stream_aux; /* auxiliary bit stream to write to or read from */
  497|     67|  size_t zfpsize;    /* byte size of compressed stream */
  498|       |
  499|     67|  uint prec;
  500|     67|  switch (ndim) {
  501|      0|    case 1:
  ------------------
  |  Branch (501:5): [True: 0, False: 67]
  ------------------
  502|      0|      prec = meta + 5;
  503|      0|      break;
  504|      2|    case 2:
  ------------------
  |  Branch (504:5): [True: 2, False: 65]
  ------------------
  505|      2|      prec = meta + 7;
  506|      2|      break;
  507|     22|    case 3:
  ------------------
  |  Branch (507:5): [True: 22, False: 45]
  ------------------
  508|     22|      prec = meta + 9;
  509|     22|      break;
  510|     43|    case 4:
  ------------------
  |  Branch (510:5): [True: 43, False: 24]
  ------------------
  511|     43|      prec = meta + 11;
  512|     43|      break;
  513|      0|    default:
  ------------------
  |  Branch (513:5): [True: 0, False: 67]
  ------------------
  514|      0|      free(shape);
  515|      0|      free(chunkshape);
  516|      0|      free(blockshape);
  517|      0|      BLOSC_TRACE_ERROR("ZFP is not available for ndims: %d", ndim);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  518|      0|      return BLOSC2_ERROR_FAILURE;
  519|     67|  }
  520|       |
  521|     67|  if (prec > ZFP_MAX_PREC) {
  ------------------
  |  |   20|     67|#define ZFP_MAX_PREC    64 /* maximum precision supported */
  ------------------
  |  Branch (521:7): [True: 0, False: 67]
  ------------------
  522|      0|    BLOSC_TRACE_ERROR("Max precision for this codecs is %d", ZFP_MAX_PREC);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  522|      0|    BLOSC_TRACE_ERROR("Max precision for this codecs is %d", ZFP_MAX_PREC);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   20|      0|#define ZFP_MAX_PREC    64 /* maximum precision supported */
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  523|      0|    prec = ZFP_MAX_PREC;
  ------------------
  |  |   20|      0|#define ZFP_MAX_PREC    64 /* maximum precision supported */
  ------------------
  524|      0|  }
  525|       |
  526|     67|  int32_t typesize = cparams->typesize;
  527|     67|  switch (typesize) {
  528|     42|    case sizeof(float):
  ------------------
  |  Branch (528:5): [True: 42, False: 25]
  ------------------
  529|     42|      type = zfp_type_float;
  530|     42|      break;
  531|     25|    case sizeof(double):
  ------------------
  |  Branch (531:5): [True: 25, False: 42]
  ------------------
  532|     25|      type = zfp_type_double;
  533|     25|      break;
  534|      0|    default:
  ------------------
  |  Branch (534:5): [True: 0, False: 67]
  ------------------
  535|      0|      free(shape);
  536|      0|      free(chunkshape);
  537|      0|      free(blockshape);
  538|      0|      BLOSC_TRACE_ERROR("ZFP is not available for typesize: %d", typesize);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  539|      0|      return BLOSC2_ERROR_FAILURE;
  540|     67|  }
  541|       |
  542|     67|  zfp = zfp_stream_open(NULL);
  543|     67|  zfp_stream_set_precision(zfp, prec);
  544|     67|  stream = stream_open(output, output_len);
  545|     67|  zfp_stream_set_bit_stream(zfp, stream);
  546|     67|  zfp_stream_rewind(zfp);
  547|       |
  548|     67|  switch (ndim) {
  549|      0|    case 1:
  ------------------
  |  Branch (549:5): [True: 0, False: 67]
  ------------------
  550|      0|      field = zfp_field_1d((void *) input, type, blockshape[0]);
  551|      0|      break;
  552|      2|    case 2:
  ------------------
  |  Branch (552:5): [True: 2, False: 65]
  ------------------
  553|      2|      field = zfp_field_2d((void *) input, type, blockshape[1], blockshape[0]);
  554|      2|      break;
  555|     22|    case 3:
  ------------------
  |  Branch (555:5): [True: 22, False: 45]
  ------------------
  556|     22|      field = zfp_field_3d((void *) input, type, blockshape[2], blockshape[1], blockshape[0]);
  557|     22|      break;
  558|     43|    case 4:
  ------------------
  |  Branch (558:5): [True: 43, False: 24]
  ------------------
  559|     43|      field = zfp_field_4d((void *) input, type, blockshape[3], blockshape[2], blockshape[1], blockshape[0]);
  560|     43|      break;
  561|      0|    default:
  ------------------
  |  Branch (561:5): [True: 0, False: 67]
  ------------------
  562|      0|      free(shape);
  563|      0|      free(chunkshape);
  564|      0|      free(blockshape);
  565|      0|      BLOSC_TRACE_ERROR("ZFP is not available for ndims: %d", ndim);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  566|      0|      return BLOSC2_ERROR_FAILURE;
  567|     67|  }
  568|       |
  569|     67|  int zfp_maxout = (int) zfp_stream_maximum_size(zfp, field);
  570|     67|  zfp_stream_close(zfp);
  571|     67|  stream_close(stream);
  572|     67|  uint8_t *aux_out = malloc(zfp_maxout);
  573|     67|  zfp_aux = zfp_stream_open(NULL);
  574|     67|  zfp_stream_set_precision(zfp_aux, prec);
  575|     67|  stream_aux = stream_open(aux_out, zfp_maxout);
  576|     67|  zfp_stream_set_bit_stream(zfp_aux, stream_aux);
  577|     67|  zfp_stream_rewind(zfp_aux);
  578|       |
  579|     67|  zfpsize = zfp_compress(zfp_aux, field);
  580|       |
  581|       |  /* clean up */
  582|     67|  zfp_field_free(field);
  583|     67|  zfp_stream_close(zfp_aux);
  584|     67|  stream_close(stream_aux);
  585|     67|  free(shape);
  586|     67|  free(chunkshape);
  587|     67|  free(blockshape);
  588|       |
  589|     67|  if (zfpsize == 0) {
  ------------------
  |  Branch (589:7): [True: 0, False: 67]
  ------------------
  590|      0|    BLOSC_TRACE_ERROR("\n ZFP: Compression failed\n");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  591|      0|    free(aux_out);
  592|      0|    return (int) zfpsize;
  593|      0|  }
  594|     67|  if (zfpsize >= (size_t) input_len || zfpsize > (size_t) output_len) {
  ------------------
  |  Branch (594:7): [True: 0, False: 67]
  |  Branch (594:40): [True: 0, False: 67]
  ------------------
  595|      0|    BLOSC_TRACE_ERROR("\n ZFP: Compressed data is bigger than input or output buffer! \n");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  596|      0|    free(aux_out);
  597|      0|    return 0;
  598|      0|  }
  599|       |
  600|     67|  memcpy(output, aux_out, zfpsize);
  601|     67|  free(aux_out);
  602|       |
  603|     67|  return (int) zfpsize;
  604|     67|}
zfp_prec_decompress:
  607|    135|                        int32_t output_len, uint8_t meta, blosc2_dparams *dparams, const void *chunk) {
  608|    135|  ZFP_ERROR_NULL(input);
  ------------------
  |  |   22|    135|  do {                          \
  |  |   23|    135|    if ((pointer) == NULL) {    \
  |  |  ------------------
  |  |  |  Branch (23:9): [True: 0, False: 135]
  |  |  ------------------
  |  |   24|      0|      return 0;                 \
  |  |   25|      0|    }                           \
  |  |   26|    135|  } while (0)
  |  |  ------------------
  |  |  |  Branch (26:12): [Folded, False: 135]
  |  |  ------------------
  ------------------
  609|    135|  ZFP_ERROR_NULL(output);
  ------------------
  |  |   22|    135|  do {                          \
  |  |   23|    135|    if ((pointer) == NULL) {    \
  |  |  ------------------
  |  |  |  Branch (23:9): [True: 0, False: 135]
  |  |  ------------------
  |  |   24|      0|      return 0;                 \
  |  |   25|      0|    }                           \
  |  |   26|    135|  } while (0)
  |  |  ------------------
  |  |  |  Branch (26:12): [Folded, False: 135]
  |  |  ------------------
  ------------------
  610|    135|  ZFP_ERROR_NULL(dparams);
  ------------------
  |  |   22|    135|  do {                          \
  |  |   23|    135|    if ((pointer) == NULL) {    \
  |  |  ------------------
  |  |  |  Branch (23:9): [True: 0, False: 135]
  |  |  ------------------
  |  |   24|      0|      return 0;                 \
  |  |   25|      0|    }                           \
  |  |   26|    135|  } while (0)
  |  |  ------------------
  |  |  |  Branch (26:12): [Folded, False: 135]
  |  |  ------------------
  ------------------
  611|    135|  ZFP_ERROR_NULL(dparams->schunk);
  ------------------
  |  |   22|    135|  do {                          \
  |  |   23|    135|    if ((pointer) == NULL) {    \
  |  |  ------------------
  |  |  |  Branch (23:9): [True: 1, False: 134]
  |  |  ------------------
  |  |   24|      1|      return 0;                 \
  |  |   25|      1|    }                           \
  |  |   26|    135|  } while (0)
  |  |  ------------------
  |  |  |  Branch (26:12): [Folded, False: 134]
  |  |  ------------------
  ------------------
  612|    134|  BLOSC_UNUSED_PARAM(chunk);
  ------------------
  |  |   28|    134|#define BLOSC_UNUSED_PARAM(x) ((void)(x))
  ------------------
  613|       |
  614|    134|  blosc2_schunk *sc = dparams->schunk;
  615|    134|  int32_t typesize = sc->typesize;
  616|    134|  int8_t ndim;
  617|    134|  int64_t *shape = malloc(B2ND_MAX_DIM * sizeof(int64_t));
  ------------------
  |  |   50|    134|#define B2ND_MAX_DIM 16
  ------------------
  618|    134|  int32_t *chunkshape = malloc(B2ND_MAX_DIM * sizeof(int32_t));
  ------------------
  |  |   50|    134|#define B2ND_MAX_DIM 16
  ------------------
  619|    134|  int32_t *blockshape = malloc(B2ND_MAX_DIM * sizeof(int32_t));
  ------------------
  |  |   50|    134|#define B2ND_MAX_DIM 16
  ------------------
  620|    134|  uint8_t *smeta;
  621|    134|  int32_t smeta_len;
  622|    134|  if (blosc2_meta_get(sc, "b2nd", &smeta, &smeta_len) < 0) {
  ------------------
  |  Branch (622:7): [True: 0, False: 134]
  ------------------
  623|      0|    BLOSC_TRACE_ERROR("Cannot access b2nd meta info");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  624|      0|    free(shape);
  625|      0|    free(chunkshape);
  626|      0|    free(blockshape);
  627|      0|    return BLOSC2_ERROR_FAILURE;
  628|      0|  }
  629|    134|  int deserialize_rc = b2nd_deserialize_meta(smeta, smeta_len, &ndim, shape, chunkshape, blockshape, NULL, NULL);
  630|    134|  free(smeta);
  631|       |
  632|    134|  if (zfp_check_output_size(deserialize_rc, ndim, blockshape, typesize, output_len) < 0) {
  ------------------
  |  Branch (632:7): [True: 0, False: 134]
  ------------------
  633|      0|    free(shape);
  634|      0|    free(chunkshape);
  635|      0|    free(blockshape);
  636|      0|    return BLOSC2_ERROR_FAILURE;
  637|      0|  }
  638|       |
  639|    134|  zfp_type type;     /* array scalar type */
  640|    134|  zfp_field *field;  /* array meta data */
  641|    134|  zfp_stream *zfp;   /* compressed stream */
  642|    134|  bitstream *stream = NULL; /* bit stream to write to or read from */
  643|    134|  uint8_t *padded_input = NULL;
  644|    134|  size_t zfpsize;    /* byte size of compressed stream */
  645|       |
  646|    134|  uint prec;
  647|    134|  switch (ndim) {
  648|      0|    case 1:
  ------------------
  |  Branch (648:5): [True: 0, False: 134]
  ------------------
  649|      0|      prec = meta + 5;
  650|      0|      break;
  651|      4|    case 2:
  ------------------
  |  Branch (651:5): [True: 4, False: 130]
  ------------------
  652|      4|      prec = meta + 7;
  653|      4|      break;
  654|     44|    case 3:
  ------------------
  |  Branch (654:5): [True: 44, False: 90]
  ------------------
  655|     44|      prec = meta + 9;
  656|     44|      break;
  657|     86|    case 4:
  ------------------
  |  Branch (657:5): [True: 86, False: 48]
  ------------------
  658|     86|      prec = meta + 11;
  659|     86|      break;
  660|      0|    default:
  ------------------
  |  Branch (660:5): [True: 0, False: 134]
  ------------------
  661|      0|      free(shape);
  662|      0|      free(chunkshape);
  663|      0|      free(blockshape);
  664|      0|      BLOSC_TRACE_ERROR("ZFP is not available for ndims: %d", ndim);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  665|      0|      return BLOSC2_ERROR_FAILURE;
  666|    134|  }
  667|       |
  668|    134|  if (prec > ZFP_MAX_PREC) {
  ------------------
  |  |   20|    134|#define ZFP_MAX_PREC    64 /* maximum precision supported */
  ------------------
  |  Branch (668:7): [True: 0, False: 134]
  ------------------
  669|      0|    BLOSC_TRACE_ERROR("Max precision for this codecs is %d", ZFP_MAX_PREC);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  669|      0|    BLOSC_TRACE_ERROR("Max precision for this codecs is %d", ZFP_MAX_PREC);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   20|      0|#define ZFP_MAX_PREC    64 /* maximum precision supported */
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  670|      0|    prec = ZFP_MAX_PREC;
  ------------------
  |  |   20|      0|#define ZFP_MAX_PREC    64 /* maximum precision supported */
  ------------------
  671|      0|  }
  672|       |
  673|    134|  switch (typesize) {
  674|     84|    case sizeof(float):
  ------------------
  |  Branch (674:5): [True: 84, False: 50]
  ------------------
  675|     84|      type = zfp_type_float;
  676|     84|      break;
  677|     50|    case sizeof(double):
  ------------------
  |  Branch (677:5): [True: 50, False: 84]
  ------------------
  678|     50|      type = zfp_type_double;
  679|     50|      break;
  680|      0|    default:
  ------------------
  |  Branch (680:5): [True: 0, False: 134]
  ------------------
  681|      0|      free(shape);
  682|      0|      free(chunkshape);
  683|      0|      free(blockshape);
  684|      0|      BLOSC_TRACE_ERROR("ZFP is not available for typesize: %d", typesize);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  685|      0|      return BLOSC2_ERROR_FAILURE;
  686|    134|  }
  687|       |
  688|    134|  zfp = zfp_stream_open(NULL);
  689|    134|  zfp_stream_set_precision(zfp, prec);
  690|       |
  691|    134|  switch (ndim) {
  692|      0|    case 1:
  ------------------
  |  Branch (692:5): [True: 0, False: 134]
  ------------------
  693|      0|      field = zfp_field_1d((void *) output, type, blockshape[0]);
  694|      0|      break;
  695|      4|    case 2:
  ------------------
  |  Branch (695:5): [True: 4, False: 130]
  ------------------
  696|      4|      field = zfp_field_2d((void *) output, type, blockshape[1], blockshape[0]);
  697|      4|      break;
  698|     44|    case 3:
  ------------------
  |  Branch (698:5): [True: 44, False: 90]
  ------------------
  699|     44|      field = zfp_field_3d((void *) output, type, blockshape[2], blockshape[1], blockshape[0]);
  700|     44|      break;
  701|     86|    case 4:
  ------------------
  |  Branch (701:5): [True: 86, False: 48]
  ------------------
  702|     86|      field = zfp_field_4d((void *) output, type, blockshape[3], blockshape[2], blockshape[1], blockshape[0]);
  703|     86|      break;
  704|      0|    default:
  ------------------
  |  Branch (704:5): [True: 0, False: 134]
  ------------------
  705|      0|      free(shape);
  706|      0|      free(chunkshape);
  707|      0|      free(blockshape);
  708|      0|      BLOSC_TRACE_ERROR("ZFP is not available for ndims: %d", ndim);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  709|      0|      return BLOSC2_ERROR_FAILURE;
  710|    134|  }
  711|       |
  712|    134|  size_t blocks = zfp_field_blocks(field);
  713|    134|  size_t min_bytes = (blocks + CHAR_BIT - 1) / CHAR_BIT;
  714|    134|  if (min_bytes < 1) {
  ------------------
  |  Branch (714:7): [True: 0, False: 134]
  ------------------
  715|      0|    min_bytes = 1;
  716|      0|  }
  717|    134|  if (input_len < 0 || (size_t) input_len < min_bytes) {
  ------------------
  |  Branch (717:7): [True: 0, False: 134]
  |  Branch (717:24): [True: 0, False: 134]
  ------------------
  718|      0|    BLOSC_TRACE_ERROR("ZFP prec: input too small (%d bytes) for the required "
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  719|      0|                      "bitstream size (%zu bytes)", input_len, min_bytes);
  720|      0|    zfp_field_free(field);
  721|      0|    zfp_stream_close(zfp);
  722|      0|    free(shape);
  723|      0|    free(chunkshape);
  724|      0|    free(blockshape);
  725|      0|    return BLOSC2_ERROR_FAILURE;
  726|      0|  }
  727|       |
  728|    134|  if (zfp_open_padded_stream(input, input_len, zfp, field, &stream, &padded_input) != BLOSC2_ERROR_SUCCESS) {
  ------------------
  |  Branch (728:7): [True: 0, False: 134]
  ------------------
  729|      0|    zfp_field_free(field);
  730|      0|    zfp_stream_close(zfp);
  731|      0|    free(shape);
  732|      0|    free(chunkshape);
  733|      0|    free(blockshape);
  734|      0|    return BLOSC2_ERROR_FAILURE;
  735|      0|  }
  736|       |
  737|    134|  zfpsize = zfp_decompress(zfp, field);
  738|       |
  739|       |  /* clean up */
  740|    134|  zfp_field_free(field);
  741|    134|  zfp_stream_close(zfp);
  742|    134|  zfp_close_padded_stream(stream, padded_input);
  743|    134|  free(shape);
  744|    134|  free(chunkshape);
  745|    134|  free(blockshape);
  746|       |
  747|    134|  if (zfpsize == 0) {
  ------------------
  |  Branch (747:7): [True: 0, False: 134]
  ------------------
  748|      0|    BLOSC_TRACE_ERROR("\n ZFP: Decompression failed\n");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  749|      0|    return (int) zfpsize;
  750|      0|  }
  751|       |
  752|    134|  return (int) output_len;
  753|    134|}
zfp_rate_compress:
  756|     49|                      int32_t output_len, uint8_t meta, blosc2_cparams *cparams, const void *chunk) {
  757|     49|  BLOSC_UNUSED_PARAM(chunk);
  ------------------
  |  |   28|     49|#define BLOSC_UNUSED_PARAM(x) ((void)(x))
  ------------------
  758|     49|  ZFP_ERROR_NULL(input);
  ------------------
  |  |   22|     49|  do {                          \
  |  |   23|     49|    if ((pointer) == NULL) {    \
  |  |  ------------------
  |  |  |  Branch (23:9): [True: 0, False: 49]
  |  |  ------------------
  |  |   24|      0|      return 0;                 \
  |  |   25|      0|    }                           \
  |  |   26|     49|  } while (0)
  |  |  ------------------
  |  |  |  Branch (26:12): [Folded, False: 49]
  |  |  ------------------
  ------------------
  759|     49|  ZFP_ERROR_NULL(output);
  ------------------
  |  |   22|     49|  do {                          \
  |  |   23|     49|    if ((pointer) == NULL) {    \
  |  |  ------------------
  |  |  |  Branch (23:9): [True: 0, False: 49]
  |  |  ------------------
  |  |   24|      0|      return 0;                 \
  |  |   25|      0|    }                           \
  |  |   26|     49|  } while (0)
  |  |  ------------------
  |  |  |  Branch (26:12): [Folded, False: 49]
  |  |  ------------------
  ------------------
  760|     49|  ZFP_ERROR_NULL(cparams);
  ------------------
  |  |   22|     49|  do {                          \
  |  |   23|     49|    if ((pointer) == NULL) {    \
  |  |  ------------------
  |  |  |  Branch (23:9): [True: 0, False: 49]
  |  |  ------------------
  |  |   24|      0|      return 0;                 \
  |  |   25|      0|    }                           \
  |  |   26|     49|  } while (0)
  |  |  ------------------
  |  |  |  Branch (26:12): [Folded, False: 49]
  |  |  ------------------
  ------------------
  761|     49|  ZFP_ERROR_NULL(cparams->schunk);
  ------------------
  |  |   22|     49|  do {                          \
  |  |   23|     49|    if ((pointer) == NULL) {    \
  |  |  ------------------
  |  |  |  Branch (23:9): [True: 0, False: 49]
  |  |  ------------------
  |  |   24|      0|      return 0;                 \
  |  |   25|      0|    }                           \
  |  |   26|     49|  } while (0)
  |  |  ------------------
  |  |  |  Branch (26:12): [Folded, False: 49]
  |  |  ------------------
  ------------------
  762|     49|  if (output_len <= 0) {
  ------------------
  |  Branch (762:7): [True: 0, False: 49]
  ------------------
  763|      0|    return 0;
  764|      0|  }
  765|       |
  766|     49|  double ratio = (double) meta / 100.0;
  767|     49|  int8_t ndim;
  768|     49|  int64_t *shape = malloc(B2ND_MAX_DIM * sizeof(int64_t));
  ------------------
  |  |   50|     49|#define B2ND_MAX_DIM 16
  ------------------
  769|     49|  int32_t *chunkshape = malloc(B2ND_MAX_DIM * sizeof(int32_t));
  ------------------
  |  |   50|     49|#define B2ND_MAX_DIM 16
  ------------------
  770|     49|  int32_t *blockshape = malloc(B2ND_MAX_DIM * sizeof(int32_t));
  ------------------
  |  |   50|     49|#define B2ND_MAX_DIM 16
  ------------------
  771|     49|  uint8_t *smeta;
  772|     49|  int32_t smeta_len;
  773|     49|  if (blosc2_meta_get(cparams->schunk, "b2nd", &smeta, &smeta_len) < 0) {
  ------------------
  |  Branch (773:7): [True: 0, False: 49]
  ------------------
  774|      0|    free(shape);
  775|      0|    free(chunkshape);
  776|      0|    free(blockshape);
  777|      0|    BLOSC_TRACE_ERROR("b2nd layer not found!");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  778|      0|    return BLOSC2_ERROR_FAILURE;
  779|      0|  }
  780|     49|  int deserialize_rc = b2nd_deserialize_meta(smeta, smeta_len, &ndim, shape, chunkshape, blockshape, NULL, NULL);
  781|     49|  free(smeta);
  782|     49|  if (deserialize_rc < 0 || ndim <= 0 || ndim > ZFP_MAX_DIM) {
  ------------------
  |  |   16|     49|#define ZFP_MAX_DIM 4
  ------------------
  |  Branch (782:7): [True: 0, False: 49]
  |  Branch (782:29): [True: 0, False: 49]
  |  Branch (782:42): [True: 0, False: 49]
  ------------------
  783|      0|    free(shape);
  784|      0|    free(chunkshape);
  785|      0|    free(blockshape);
  786|      0|    BLOSC_TRACE_ERROR("Invalid b2nd meta info (ndim %d)", ndim);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  787|      0|    return BLOSC2_ERROR_FAILURE;
  788|      0|  }
  789|       |
  790|    220|  for(int i = 0; i < ndim; i++) {
  ------------------
  |  Branch (790:18): [True: 171, False: 49]
  ------------------
  791|    171|    if (blockshape[i] < 4) {
  ------------------
  |  Branch (791:9): [True: 0, False: 171]
  ------------------
  792|      0|      free(shape);
  793|      0|      free(chunkshape);
  794|      0|      free(blockshape);
  795|      0|      BLOSC_TRACE_ERROR("ZFP does not support blocks smaller than cells (4x...x4)");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  796|      0|      return BLOSC2_ERROR_FAILURE;
  797|      0|    }
  798|    171|  }
  799|       |
  800|       |  /* The b2nd blockshape determines the dataset fed to ZFP, so the input must be
  801|       |   * a complete block.  With split streams (e.g. SplitMode.ALWAYS_SPLIT) or any
  802|       |   * partial buffer, input_len is smaller than the block: compressing would
  803|       |   * overread the input, and the result would decompress to more bytes than the
  804|       |   * stream slot it came from.  Store uncompressed in that case. */
  805|     49|  {
  806|     49|    int64_t block_nbytes = cparams->typesize;
  807|    220|    for (int i = 0; i < ndim; i++) {
  ------------------
  |  Branch (807:21): [True: 171, False: 49]
  ------------------
  808|    171|      block_nbytes *= blockshape[i];
  809|    171|    }
  810|     49|    if ((int64_t) input_len != block_nbytes) {
  ------------------
  |  Branch (810:9): [True: 0, False: 49]
  ------------------
  811|      0|      free(shape);
  812|      0|      free(chunkshape);
  813|      0|      free(blockshape);
  814|      0|      return 0;
  815|      0|    }
  816|     49|  }
  817|       |
  818|     49|  zfp_type type;     /* array scalar type */
  819|     49|  zfp_field *field;  /* array meta data */
  820|     49|  zfp_stream *zfp;   /* stream containing the real output buffer */
  821|     49|  zfp_stream *zfp_aux;   /* auxiliary compressed stream */
  822|     49|  bitstream *stream; /* bit stream to write to or read from */
  823|     49|  bitstream *stream_aux; /* auxiliary bit stream to write to or read from */
  824|     49|  size_t zfpsize;    /* byte size of compressed stream */
  825|       |
  826|     49|  int32_t typesize = cparams->typesize;
  827|       |
  828|     49|  switch (typesize) {
  829|     33|    case sizeof(float):
  ------------------
  |  Branch (829:5): [True: 33, False: 16]
  ------------------
  830|     33|      type = zfp_type_float;
  831|     33|      break;
  832|     16|    case sizeof(double):
  ------------------
  |  Branch (832:5): [True: 16, False: 33]
  ------------------
  833|     16|      type = zfp_type_double;
  834|     16|      break;
  835|      0|    default:
  ------------------
  |  Branch (835:5): [True: 0, False: 49]
  ------------------
  836|      0|      BLOSC_TRACE_ERROR("ZFP is not available for typesize: %d", typesize);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  837|      0|      return BLOSC2_ERROR_FAILURE;
  838|     49|  }
  839|     49|  double rate = ratio * typesize * 8;     // convert from output size / input size to output bits per input value
  840|     49|  uint cellsize = 1u << (2 * ndim);
  841|     49|  double min_rate;
  842|     49|  if (type == zfp_type_float) {
  ------------------
  |  Branch (842:7): [True: 33, False: 16]
  ------------------
  843|     33|    min_rate = (double) (1 + 8u) / cellsize;
  844|     33|    if (rate < min_rate) {
  ------------------
  |  Branch (844:9): [True: 0, False: 33]
  ------------------
  845|      0|      BLOSC_TRACE_ERROR("ZFP minimum rate for this item type is %f. Compression will be done using this one.\n",
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  846|      0|                        min_rate);
  847|      0|    }
  848|     33|  }
  849|     16|  else {
  850|     16|    min_rate = (double) (1 + 11u) / cellsize;
  851|     16|    if (rate < min_rate) {
  ------------------
  |  Branch (851:9): [True: 0, False: 16]
  ------------------
  852|      0|      BLOSC_TRACE_ERROR("ZFP minimum rate for this item type is %f. Compression will be done using this one.\n",
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  853|      0|                        min_rate);
  854|      0|    }
  855|     16|  }
  856|     49|  zfp = zfp_stream_open(NULL);
  857|     49|  stream = stream_open(output, output_len);
  858|     49|  zfp_stream_set_bit_stream(zfp, stream);
  859|     49|  zfp_stream_rewind(zfp);
  860|       |
  861|     49|  switch (ndim) {
  862|      0|    case 1:
  ------------------
  |  Branch (862:5): [True: 0, False: 49]
  ------------------
  863|      0|      field = zfp_field_1d((void *) input, type, blockshape[0]);
  864|      0|      break;
  865|      0|    case 2:
  ------------------
  |  Branch (865:5): [True: 0, False: 49]
  ------------------
  866|      0|      field = zfp_field_2d((void *) input, type, blockshape[1], blockshape[0]);
  867|      0|      break;
  868|     25|    case 3:
  ------------------
  |  Branch (868:5): [True: 25, False: 24]
  ------------------
  869|     25|      field = zfp_field_3d((void *) input, type, blockshape[2], blockshape[1], blockshape[0]);
  870|     25|      break;
  871|     24|    case 4:
  ------------------
  |  Branch (871:5): [True: 24, False: 25]
  ------------------
  872|     24|      field = zfp_field_4d((void *) input, type, blockshape[3], blockshape[2], blockshape[1], blockshape[0]);
  873|     24|      break;
  874|      0|    default:
  ------------------
  |  Branch (874:5): [True: 0, False: 49]
  ------------------
  875|      0|      free(shape);
  876|      0|      free(chunkshape);
  877|      0|      free(blockshape);
  878|      0|      BLOSC_TRACE_ERROR("ZFP is not available for ndims: %d", ndim);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  879|      0|      return BLOSC2_ERROR_FAILURE;
  880|     49|  }
  881|       |
  882|     49|  int zfp_maxout = (int) zfp_stream_maximum_size(zfp, field);
  883|     49|  zfp_stream_close(zfp);
  884|     49|  stream_close(stream);
  885|     49|  uint8_t *aux_out = malloc(zfp_maxout);
  886|     49|  zfp_aux = zfp_stream_open(NULL);
  887|     49|  stream_aux = stream_open(aux_out, zfp_maxout);
  888|     49|  zfp_stream_set_bit_stream(zfp_aux, stream_aux);
  889|     49|  zfp_stream_rewind(zfp_aux);
  890|     49|  zfp_stream_set_rate(zfp_aux, rate, type, ndim, zfp_false);
  891|       |
  892|     49|  zfpsize = zfp_compress(zfp_aux, field);
  893|       |
  894|       |  /* clean up */
  895|     49|  zfp_field_free(field);
  896|     49|  zfp_stream_close(zfp_aux);
  897|     49|  stream_close(stream_aux);
  898|     49|  free(shape);
  899|     49|  free(chunkshape);
  900|     49|  free(blockshape);
  901|       |
  902|     49|  if (zfpsize == 0) {
  ------------------
  |  Branch (902:7): [True: 0, False: 49]
  ------------------
  903|      0|    BLOSC_TRACE_ERROR("\n ZFP: Compression failed\n");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  904|      0|    free(aux_out);
  905|      0|    return (int) zfpsize;
  906|      0|  }
  907|     49|  if (zfpsize >= (size_t) input_len || zfpsize > (size_t) output_len) {
  ------------------
  |  Branch (907:7): [True: 0, False: 49]
  |  Branch (907:40): [True: 0, False: 49]
  ------------------
  908|      0|    BLOSC_TRACE_ERROR("\n ZFP: Compressed data is bigger than input or output buffer! \n");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  909|      0|    free(aux_out);
  910|      0|    return 0;
  911|      0|  }
  912|       |
  913|     49|  memcpy(output, aux_out, zfpsize);
  914|     49|  free(aux_out);
  915|       |
  916|     49|  return (int) zfpsize;
  917|     49|}
zfp_rate_decompress:
  920|     99|                        int32_t output_len, uint8_t meta, blosc2_dparams *dparams, const void *chunk) {
  921|     99|  ZFP_ERROR_NULL(input);
  ------------------
  |  |   22|     99|  do {                          \
  |  |   23|     99|    if ((pointer) == NULL) {    \
  |  |  ------------------
  |  |  |  Branch (23:9): [True: 0, False: 99]
  |  |  ------------------
  |  |   24|      0|      return 0;                 \
  |  |   25|      0|    }                           \
  |  |   26|     99|  } while (0)
  |  |  ------------------
  |  |  |  Branch (26:12): [Folded, False: 99]
  |  |  ------------------
  ------------------
  922|     99|  ZFP_ERROR_NULL(output);
  ------------------
  |  |   22|     99|  do {                          \
  |  |   23|     99|    if ((pointer) == NULL) {    \
  |  |  ------------------
  |  |  |  Branch (23:9): [True: 0, False: 99]
  |  |  ------------------
  |  |   24|      0|      return 0;                 \
  |  |   25|      0|    }                           \
  |  |   26|     99|  } while (0)
  |  |  ------------------
  |  |  |  Branch (26:12): [Folded, False: 99]
  |  |  ------------------
  ------------------
  923|     99|  ZFP_ERROR_NULL(dparams);
  ------------------
  |  |   22|     99|  do {                          \
  |  |   23|     99|    if ((pointer) == NULL) {    \
  |  |  ------------------
  |  |  |  Branch (23:9): [True: 0, False: 99]
  |  |  ------------------
  |  |   24|      0|      return 0;                 \
  |  |   25|      0|    }                           \
  |  |   26|     99|  } while (0)
  |  |  ------------------
  |  |  |  Branch (26:12): [Folded, False: 99]
  |  |  ------------------
  ------------------
  924|     99|  ZFP_ERROR_NULL(dparams->schunk);
  ------------------
  |  |   22|     99|  do {                          \
  |  |   23|     99|    if ((pointer) == NULL) {    \
  |  |  ------------------
  |  |  |  Branch (23:9): [True: 1, False: 98]
  |  |  ------------------
  |  |   24|      1|      return 0;                 \
  |  |   25|      1|    }                           \
  |  |   26|     99|  } while (0)
  |  |  ------------------
  |  |  |  Branch (26:12): [Folded, False: 98]
  |  |  ------------------
  ------------------
  925|     98|  BLOSC_UNUSED_PARAM(chunk);
  ------------------
  |  |   28|     98|#define BLOSC_UNUSED_PARAM(x) ((void)(x))
  ------------------
  926|       |
  927|     98|  blosc2_schunk *sc = dparams->schunk;
  928|     98|  int32_t typesize = sc->typesize;
  929|       |
  930|     98|  double ratio = (double) meta / 100.0;
  931|     98|  int8_t ndim;
  932|     98|  int64_t *shape = malloc(B2ND_MAX_DIM * sizeof(int64_t));
  ------------------
  |  |   50|     98|#define B2ND_MAX_DIM 16
  ------------------
  933|     98|  int32_t *chunkshape = malloc(B2ND_MAX_DIM * sizeof(int32_t));
  ------------------
  |  |   50|     98|#define B2ND_MAX_DIM 16
  ------------------
  934|     98|  int32_t *blockshape = malloc(B2ND_MAX_DIM * sizeof(int32_t));
  ------------------
  |  |   50|     98|#define B2ND_MAX_DIM 16
  ------------------
  935|     98|  uint8_t *smeta;
  936|     98|  int32_t smeta_len;
  937|     98|  if (blosc2_meta_get(sc, "b2nd", &smeta, &smeta_len) < 0) {
  ------------------
  |  Branch (937:7): [True: 0, False: 98]
  ------------------
  938|      0|    BLOSC_TRACE_ERROR("Cannot access b2nd meta info");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  939|      0|    free(shape);
  940|      0|    free(chunkshape);
  941|      0|    free(blockshape);
  942|      0|    return BLOSC2_ERROR_FAILURE;
  943|      0|  }
  944|     98|  int deserialize_rc = b2nd_deserialize_meta(smeta, smeta_len, &ndim, shape, chunkshape, blockshape, NULL, NULL);
  945|     98|  free(smeta);
  946|       |
  947|     98|  if (zfp_check_output_size(deserialize_rc, ndim, blockshape, typesize, output_len) < 0) {
  ------------------
  |  Branch (947:7): [True: 0, False: 98]
  ------------------
  948|      0|    free(shape);
  949|      0|    free(chunkshape);
  950|      0|    free(blockshape);
  951|      0|    return BLOSC2_ERROR_FAILURE;
  952|      0|  }
  953|       |
  954|     98|  zfp_type type;     /* array scalar type */
  955|     98|  zfp_field *field;  /* array meta data */
  956|     98|  zfp_stream *zfp;   /* compressed stream */
  957|     98|  bitstream *stream = NULL; /* bit stream to write to or read from */
  958|     98|  uint8_t *padded_input = NULL;
  959|     98|  size_t zfpsize;    /* byte size of compressed stream */
  960|       |
  961|     98|  switch (typesize) {
  962|     66|    case sizeof(float):
  ------------------
  |  Branch (962:5): [True: 66, False: 32]
  ------------------
  963|     66|      type = zfp_type_float;
  964|     66|      break;
  965|     32|    case sizeof(double):
  ------------------
  |  Branch (965:5): [True: 32, False: 66]
  ------------------
  966|     32|      type = zfp_type_double;
  967|     32|      break;
  968|      0|    default:
  ------------------
  |  Branch (968:5): [True: 0, False: 98]
  ------------------
  969|      0|      free(shape);
  970|      0|      free(chunkshape);
  971|      0|      free(blockshape);
  972|      0|      BLOSC_TRACE_ERROR("ZFP is not available for typesize: %d", typesize);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  973|      0|      return BLOSC2_ERROR_FAILURE;
  974|     98|  }
  975|     98|  double rate =
  976|     98|      ratio * (double) typesize * 8;     // convert from output size / input size to output bits per input value
  977|     98|  zfp = zfp_stream_open(NULL);
  978|     98|  zfp_stream_set_rate(zfp, rate, type, ndim, zfp_false);
  979|       |
  980|     98|  switch (ndim) {
  981|      0|    case 1:
  ------------------
  |  Branch (981:5): [True: 0, False: 98]
  ------------------
  982|      0|      field = zfp_field_1d((void *) output, type, blockshape[0]);
  983|      0|      break;
  984|      0|    case 2:
  ------------------
  |  Branch (984:5): [True: 0, False: 98]
  ------------------
  985|      0|      field = zfp_field_2d((void *) output, type, blockshape[1], blockshape[0]);
  986|      0|      break;
  987|     50|    case 3:
  ------------------
  |  Branch (987:5): [True: 50, False: 48]
  ------------------
  988|     50|      field = zfp_field_3d((void *) output, type, blockshape[2], blockshape[1], blockshape[0]);
  989|     50|      break;
  990|     48|    case 4:
  ------------------
  |  Branch (990:5): [True: 48, False: 50]
  ------------------
  991|     48|      field = zfp_field_4d((void *) output, type, blockshape[3], blockshape[2], blockshape[1], blockshape[0]);
  992|     48|      break;
  993|      0|    default:
  ------------------
  |  Branch (993:5): [True: 0, False: 98]
  ------------------
  994|      0|      free(shape);
  995|      0|      free(chunkshape);
  996|      0|      free(blockshape);
  997|      0|      BLOSC_TRACE_ERROR("ZFP is not available for ndims: %d", ndim);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  998|      0|      return BLOSC2_ERROR_FAILURE;
  999|     98|  }
 1000|       |
 1001|     98|  size_t blocks = zfp_field_blocks(field);
 1002|     98|  uint n = 1u << (2 * ndim);
 1003|     98|  uint bits = (uint) floor(n * rate + 0.5);
 1004|     98|  switch (type) {
 1005|     66|    case zfp_type_float:
  ------------------
  |  Branch (1005:5): [True: 66, False: 32]
  ------------------
 1006|     66|      if (bits < 1 + 8u) {
  ------------------
  |  Branch (1006:11): [True: 0, False: 66]
  ------------------
 1007|      0|        bits = 1 + 8u;
 1008|      0|      }
 1009|     66|      break;
 1010|     32|    case zfp_type_double:
  ------------------
  |  Branch (1010:5): [True: 32, False: 66]
  ------------------
 1011|     32|      if (bits < 1 + 11u) {
  ------------------
  |  Branch (1011:11): [True: 0, False: 32]
  ------------------
 1012|      0|        bits = 1 + 11u;
 1013|      0|      }
 1014|     32|      break;
 1015|      0|    default:
  ------------------
  |  Branch (1015:5): [True: 0, False: 98]
  ------------------
 1016|      0|      break;
 1017|     98|  }
 1018|     98|  if (bits > 0 && blocks > SIZE_MAX / bits) {
  ------------------
  |  Branch (1018:7): [True: 98, False: 0]
  |  Branch (1018:19): [True: 0, False: 98]
  ------------------
 1019|      0|    BLOSC_TRACE_ERROR("ZFP rate: required bits overflow size_t");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1020|      0|    zfp_field_free(field);
 1021|      0|    zfp_stream_close(zfp);
 1022|      0|    free(shape);
 1023|      0|    free(chunkshape);
 1024|      0|    free(blockshape);
 1025|      0|    return BLOSC2_ERROR_FAILURE;
 1026|      0|  }
 1027|     98|  size_t required_bits = blocks * (size_t) bits;
 1028|     98|  size_t required_bytes = (required_bits + CHAR_BIT - 1) / CHAR_BIT;
 1029|     98|  if (required_bytes < 1) {
  ------------------
  |  Branch (1029:7): [True: 0, False: 98]
  ------------------
 1030|      0|    required_bytes = 1;
 1031|      0|  }
 1032|     98|  if (input_len < 0 || (size_t) input_len < required_bytes) {
  ------------------
  |  Branch (1032:7): [True: 0, False: 98]
  |  Branch (1032:24): [True: 0, False: 98]
  ------------------
 1033|      0|    BLOSC_TRACE_ERROR("ZFP rate: input too small (%d bytes) for the required "
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1034|      0|                      "bitstream size (%zu bytes)", input_len, required_bytes);
 1035|      0|    zfp_field_free(field);
 1036|      0|    zfp_stream_close(zfp);
 1037|      0|    free(shape);
 1038|      0|    free(chunkshape);
 1039|      0|    free(blockshape);
 1040|      0|    return BLOSC2_ERROR_FAILURE;
 1041|      0|  }
 1042|       |
 1043|     98|  if (zfp_open_padded_stream(input, input_len, zfp, field, &stream, &padded_input) != BLOSC2_ERROR_SUCCESS) {
  ------------------
  |  Branch (1043:7): [True: 0, False: 98]
  ------------------
 1044|      0|    zfp_field_free(field);
 1045|      0|    zfp_stream_close(zfp);
 1046|      0|    free(shape);
 1047|      0|    free(chunkshape);
 1048|      0|    free(blockshape);
 1049|      0|    return BLOSC2_ERROR_FAILURE;
 1050|      0|  }
 1051|       |
 1052|     98|  zfpsize = zfp_decompress(zfp, field);
 1053|       |
 1054|       |  /* clean up */
 1055|     98|  zfp_field_free(field);
 1056|     98|  zfp_stream_close(zfp);
 1057|     98|  zfp_close_padded_stream(stream, padded_input);
 1058|     98|  free(shape);
 1059|     98|  free(chunkshape);
 1060|     98|  free(blockshape);
 1061|       |
 1062|     98|  if (zfpsize == 0) {
  ------------------
  |  Branch (1062:7): [True: 0, False: 98]
  ------------------
 1063|      0|    BLOSC_TRACE_ERROR("\n ZFP: Decompression failed\n");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1064|      0|    return (int) zfpsize;
 1065|      0|  }
 1066|       |
 1067|     98|  return (int) output_len;
 1068|     98|}
blosc2-zfp.c:zfp_check_output_size:
   39|    258|                                 int32_t typesize, int32_t output_len) {
   40|    258|  if (deserialize_rc < 0) {
  ------------------
  |  Branch (40:7): [True: 0, False: 258]
  ------------------
   41|      0|    BLOSC_TRACE_ERROR("Cannot deserialize b2nd meta info");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
   42|      0|    return BLOSC2_ERROR_FAILURE;
   43|      0|  }
   44|    258|  if (ndim <= 0 || ndim > ZFP_MAX_DIM) {
  ------------------
  |  |   16|    258|#define ZFP_MAX_DIM 4
  ------------------
  |  Branch (44:7): [True: 0, False: 258]
  |  Branch (44:20): [True: 0, False: 258]
  ------------------
   45|      0|    BLOSC_TRACE_ERROR("ndim %d is out of range for ZFP", ndim);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
   46|      0|    return BLOSC2_ERROR_FAILURE;
   47|      0|  }
   48|    258|  if (typesize <= 0) {
  ------------------
  |  Branch (48:7): [True: 0, False: 258]
  ------------------
   49|      0|    BLOSC_TRACE_ERROR("Invalid typesize %d", typesize);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
   50|      0|    return BLOSC2_ERROR_FAILURE;
   51|      0|  }
   52|    258|  if (output_len < 0) {
  ------------------
  |  Branch (52:7): [True: 0, False: 258]
  ------------------
   53|      0|    BLOSC_TRACE_ERROR("Negative output length");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
   54|      0|    return BLOSC2_ERROR_FAILURE;
   55|      0|  }
   56|       |  /* Compute prod(blockshape) * typesize and compare against output_len without
   57|       |   * ever overflowing int64_t: keep nbytes bounded by `cap` at every step, so a
   58|       |   * crafted (large) blockshape cannot wrap the product past the guard. */
   59|    258|  const int64_t cap = (int64_t) output_len;
   60|    258|  int64_t nbytes = (int64_t) typesize;
   61|  1.16k|  for (int i = 0; i < ndim; i++) {
  ------------------
  |  Branch (61:19): [True: 904, False: 258]
  ------------------
   62|    904|    int32_t dim = blockshape[i];
   63|    904|    if (dim <= 0) {
  ------------------
  |  Branch (63:9): [True: 0, False: 904]
  ------------------
   64|       |      /* A zero or negative block dimension is malformed input; reject it rather
   65|       |       * than letting a 0 dim slip past the size guard and into zfp_field_*. */
   66|      0|      BLOSC_TRACE_ERROR("Invalid blockshape dimension %d", dim);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
   67|      0|      return BLOSC2_ERROR_FAILURE;
   68|      0|    }
   69|    904|    if (nbytes > cap / dim) {
  ------------------
  |  Branch (69:9): [True: 0, False: 904]
  ------------------
   70|      0|      BLOSC_TRACE_ERROR("Decompressed block size exceeds the output buffer (%d bytes)", output_len);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
   71|      0|      return BLOSC2_ERROR_FAILURE;
   72|      0|    }
   73|    904|    nbytes *= dim;
   74|    904|  }
   75|    258|  if (nbytes > cap) {
  ------------------
  |  Branch (75:7): [True: 0, False: 258]
  ------------------
   76|      0|    BLOSC_TRACE_ERROR("Decompressed size (%lld bytes) is bigger than the output buffer (%d bytes)",
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
   77|      0|                      (long long) nbytes, output_len);
   78|      0|    return BLOSC2_ERROR_FAILURE;
   79|      0|  }
   80|    258|  return BLOSC2_ERROR_SUCCESS;
   81|    258|}
blosc2-zfp.c:zfp_open_padded_stream:
   87|    258|                                  bitstream **stream_out, uint8_t **padded_buf_out) {
   88|    258|  *stream_out = NULL;
   89|    258|  *padded_buf_out = NULL;
   90|       |
   91|    258|  if (input_len < 0) {
  ------------------
  |  Branch (91:7): [True: 0, False: 258]
  ------------------
   92|      0|    BLOSC_TRACE_ERROR("ZFP: invalid negative input length %d", input_len);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
   93|      0|    return BLOSC2_ERROR_FAILURE;
   94|      0|  }
   95|       |
   96|       |  /* zfp's bitstream reader fetches whole stream words (up to 64 bits) with no
   97|       |   * bounds checking (see stream_read_word() in zfp's bitstream.inl: "buffer
   98|       |   * overruns are not caught"), so the decoder can touch bytes past the
   99|       |   * validated input_len whenever the consumed bit count is not a whole
  100|       |   * number of words (fixed-rate), or is data-dependent (fixed-accuracy /
  101|       |   * fixed-precision).  Decompress from a zero-padded copy sized to
  102|       |   * zfp_stream_maximum_size() -- zfp's own word-rounded upper bound for
  103|       |   * this stream configuration -- so those reads stay inside the
  104|       |   * allocation.  This cannot reject legitimate streams: it only widens
  105|       |   * the buffer the decoder sees. */
  106|    258|  size_t zfp_maxin = zfp_stream_maximum_size(zfp, field);
  107|    258|  if (zfp_maxin == 0) {
  ------------------
  |  Branch (107:7): [True: 0, False: 258]
  ------------------
  108|      0|    BLOSC_TRACE_ERROR("ZFP: cannot determine maximum bitstream size");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  109|      0|    return BLOSC2_ERROR_FAILURE;
  110|      0|  }
  111|    258|  size_t padded_len = zfp_maxin;
  112|    258|  if (padded_len < (size_t) input_len) {
  ------------------
  |  Branch (112:7): [True: 0, False: 258]
  ------------------
  113|      0|    padded_len = (size_t) input_len;
  114|      0|  }
  115|    258|  if (padded_len > SIZE_MAX - (sizeof(uint64_t) - 1)) {
  ------------------
  |  Branch (115:7): [True: 0, False: 258]
  ------------------
  116|      0|    BLOSC_TRACE_ERROR("ZFP: padded input buffer size overflow");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  117|      0|    return BLOSC2_ERROR_FAILURE;
  118|      0|  }
  119|       |  /* round up to whole 64-bit words */
  120|    258|  padded_len = (padded_len + sizeof(uint64_t) - 1) & ~(sizeof(uint64_t) - 1);
  121|    258|  uint8_t *padded_input = malloc(padded_len);
  122|    258|  if (padded_input == NULL) {
  ------------------
  |  Branch (122:7): [True: 0, False: 258]
  ------------------
  123|      0|    BLOSC_TRACE_ERROR("ZFP: cannot allocate padded input buffer (%zu bytes)", padded_len);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  124|      0|    return BLOSC2_ERROR_FAILURE;
  125|      0|  }
  126|    258|  memcpy(padded_input, input, (size_t) input_len);
  127|    258|  memset(padded_input + input_len, 0, padded_len - (size_t) input_len);
  128|    258|  bitstream *stream = stream_open(padded_input, padded_len);
  129|    258|  if (stream == NULL) {
  ------------------
  |  Branch (129:7): [True: 0, False: 258]
  ------------------
  130|      0|    BLOSC_TRACE_ERROR("ZFP: cannot open padded bitstream");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  131|      0|    free(padded_input);
  132|      0|    return BLOSC2_ERROR_FAILURE;
  133|      0|  }
  134|    258|  zfp_stream_set_bit_stream(zfp, stream);
  135|    258|  zfp_stream_rewind(zfp);
  136|       |
  137|    258|  *stream_out = stream;
  138|    258|  *padded_buf_out = padded_input;
  139|    258|  return BLOSC2_ERROR_SUCCESS;
  140|    258|}
blosc2-zfp.c:zfp_close_padded_stream:
  142|    258|static void zfp_close_padded_stream(bitstream *stream, uint8_t *padded_buf) {
  143|    258|  if (stream != NULL) {
  ------------------
  |  Branch (143:7): [True: 258, False: 0]
  ------------------
  144|    258|    stream_close(stream);
  145|    258|  }
  146|    258|  free(padded_buf);
  147|    258|}

simd_load:
   34|  49.0M|bytes16 simd_load(const void* ptr) { return _mm_loadu_si128((const __m128i*)ptr); }
simd_store:
   35|  49.0M|void simd_store(void* ptr, bytes16 x) { _mm_storeu_si128((__m128i*)ptr, x); }
simd_concat:
   37|    256|bytes16 simd_concat(bytes16 hi, bytes16 lo) { return _mm_alignr_epi8(hi, lo, 15); }
simd_add:
   38|  49.0M|bytes16 simd_add(bytes16 a, bytes16 b) { return _mm_add_epi8(a, b); }
simd_sub:
   39|    256|bytes16 simd_sub(bytes16 a, bytes16 b) { return _mm_sub_epi8(a, b); }
simd_duplane15:
   40|  49.0M|bytes16 simd_duplane15(bytes16 x) { return _mm_shuffle_epi8(x, _mm_set1_epi8(15)); }
simd_prefix_sum:
   43|  49.0M|{
   44|       |  // Sklansky-style sum from https://gist.github.com/rygorous/4212be0cd009584e4184e641ca210528
   45|  49.0M|  x = _mm_add_epi8(x, _mm_slli_epi64(x, 8));
   46|  49.0M|  x = _mm_add_epi8(x, _mm_slli_epi64(x, 16));
   47|  49.0M|  x = _mm_add_epi8(x, _mm_slli_epi64(x, 32));
   48|  49.0M|  x = _mm_add_epi8(x, _mm_shuffle_epi8(x, _mm_setr_epi8(-1,-1,-1,-1,-1,-1,-1,-1,7,7,7,7,7,7,7,7)));
   49|  49.0M|  return x;
   50|  49.0M|}
simd_get_last:
   52|  4.27k|uint8_t simd_get_last(bytes16 x) { return (_mm_extract_epi16(x, 7) >> 8) & 0xFF; }
bytedelta_forward:
  463|      8|                      blosc2_cparams *cparams, uint8_t id) {
  464|      8|  BLOSC_UNUSED_PARAM(id);
  ------------------
  |  |   28|      8|#define BLOSC_UNUSED_PARAM(x) ((void)(x))
  ------------------
  465|       |
  466|      8|  int typesize = meta;
  467|      8|  if (typesize == 0) {
  ------------------
  |  Branch (467:7): [True: 0, False: 8]
  ------------------
  468|      0|    if (cparams->schunk == NULL) {
  ------------------
  |  Branch (468:9): [True: 0, False: 0]
  ------------------
  469|      0|      BLOSC_TRACE_ERROR("When meta is 0, you need to be on a schunk!");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  470|      0|      BLOSC_ERROR(BLOSC2_ERROR_FAILURE);
  ------------------
  |  |  111|      0|    do {                                            \
  |  |  112|      0|        int rc_ = (rc);                             \
  |  |  113|      0|        if (rc_ < BLOSC2_ERROR_SUCCESS) {           \
  |  |  ------------------
  |  |  |  Branch (113:13): [True: 0, False: 0]
  |  |  ------------------
  |  |  114|      0|            char *error_msg = print_error(rc_);     \
  |  |  115|      0|            BLOSC_TRACE_ERROR("%s", error_msg);     \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  116|      0|            return rc_;                             \
  |  |  117|      0|        }                                           \
  |  |  118|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (118:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  471|      0|    }
  472|      0|    blosc2_schunk* schunk = (blosc2_schunk*)(cparams->schunk);
  473|      0|    typesize = schunk->typesize;
  474|      0|  }
  475|       |
  476|      8|  const int stream_len = length / typesize;
  477|     72|  for (int ich = 0; ich < typesize; ++ich) {
  ------------------
  |  Branch (477:21): [True: 64, False: 8]
  ------------------
  478|     64|    int ip = 0;
  479|     64|    uint8_t _v2 = 0;
  480|       |    // SIMD delta within each channel, store
  481|     64|#if defined(CPU_HAS_SIMD)
  482|     64|    bytes16 v2 = {0};
  483|    320|    for (; ip < stream_len - 15; ip += 16) {
  ------------------
  |  Branch (483:12): [True: 256, False: 64]
  ------------------
  484|    256|      bytes16 v = simd_load(input);
  485|    256|      input += 16;
  486|    256|      bytes16 delta = simd_sub(v, simd_concat(v, v2));
  487|    256|      simd_store(output, delta);
  488|    256|      output += 16;
  489|    256|      v2 = v;
  490|    256|    }
  491|     64|    if (stream_len > 15) {
  ------------------
  |  Branch (491:9): [True: 64, False: 0]
  ------------------
  492|     64|      _v2 = simd_get_last(v2);
  493|     64|    }
  494|     64|#endif // #if defined(CPU_HAS_SIMD)
  495|       |    // scalar leftover
  496|     64|    for (; ip < stream_len ; ip++) {
  ------------------
  |  Branch (496:12): [True: 0, False: 64]
  ------------------
  497|      0|      uint8_t v = *input;
  498|      0|      input++;
  499|      0|      *output = v - _v2;
  500|      0|      output++;
  501|      0|      _v2 = v;
  502|      0|    }
  503|     64|  }
  504|       |
  505|       |  // When length is not a multiple of typesize, the trailing length % typesize
  506|       |  // bytes do not belong to any channel (shuffle leaves them in place too).
  507|       |  // Pass them through verbatim, or they would be left uninitialized in output.
  508|      8|  memcpy(output, input, (size_t)(length - stream_len * typesize));
  509|       |
  510|      8|  return BLOSC2_ERROR_SUCCESS;
  511|      8|}
bytedelta_backward:
  515|    139|                       blosc2_dparams *dparams, uint8_t id) {
  516|    139|  BLOSC_UNUSED_PARAM(id);
  ------------------
  |  |   28|    139|#define BLOSC_UNUSED_PARAM(x) ((void)(x))
  ------------------
  517|       |
  518|    139|  int typesize = meta;
  519|    139|  if (typesize == 0) {
  ------------------
  |  Branch (519:7): [True: 6, False: 133]
  ------------------
  520|      6|    if (dparams->schunk == NULL) {
  ------------------
  |  Branch (520:9): [True: 6, False: 0]
  ------------------
  521|      6|      BLOSC_TRACE_ERROR("When meta is 0, you need to be on a schunk!");
  ------------------
  |  |   93|      6|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      6|    do {                                            \
  |  |  |  |   98|      6|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      6|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 6, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      6|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  522|      6|      BLOSC_ERROR(BLOSC2_ERROR_FAILURE);
  ------------------
  |  |  111|      6|    do {                                            \
  |  |  112|      6|        int rc_ = (rc);                             \
  |  |  113|      6|        if (rc_ < BLOSC2_ERROR_SUCCESS) {           \
  |  |  ------------------
  |  |  |  Branch (113:13): [True: 6, False: 0]
  |  |  ------------------
  |  |  114|      6|            char *error_msg = print_error(rc_);     \
  |  |  115|      6|            BLOSC_TRACE_ERROR("%s", error_msg);     \
  |  |  ------------------
  |  |  |  |   93|      6|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      6|    do {                                            \
  |  |  |  |  |  |   98|      6|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      6|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 6, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      6|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  116|      6|            return rc_;                             \
  |  |  117|      6|        }                                           \
  |  |  118|      6|    } while (0)
  |  |  ------------------
  |  |  |  Branch (118:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  523|      6|    }
  524|      0|    blosc2_schunk* schunk = (blosc2_schunk*)(dparams->schunk);
  525|      0|    typesize = schunk->typesize;
  526|      0|  }
  527|       |
  528|    133|  const int stream_len = length / typesize;
  529|  10.6k|  for (int ich = 0; ich < typesize; ++ich) {
  ------------------
  |  Branch (529:21): [True: 10.5k, False: 133]
  ------------------
  530|  10.5k|    int ip = 0;
  531|  10.5k|    uint8_t _v2 = 0;
  532|       |    // SIMD fetch 16 bytes from each channel, prefix-sum un-delta
  533|  10.5k|#if defined(CPU_HAS_SIMD)
  534|  10.5k|    bytes16 v2 = {0};
  535|  24.3M|    for (; ip < stream_len - 15; ip += 16) {
  ------------------
  |  Branch (535:12): [True: 24.3M, False: 10.5k]
  ------------------
  536|  24.3M|      bytes16 v = simd_load(input);
  537|  24.3M|      input += 16;
  538|       |      // un-delta via prefix sum
  539|  24.3M|      v2 = simd_add(simd_prefix_sum(v), simd_duplane15(v2));
  540|  24.3M|      simd_store(output, v2);
  541|  24.3M|      output += 16;
  542|  24.3M|    }
  543|  10.5k|    if (stream_len > 15) {
  ------------------
  |  Branch (543:9): [True: 4.21k, False: 6.28k]
  ------------------
  544|  4.21k|      _v2 = simd_get_last(v2);
  545|  4.21k|    }
  546|  10.5k|#endif // #if defined(CPU_HAS_SIMD)
  547|       |    // scalar leftover
  548|  60.7k|    for (; ip < stream_len; ip++) {
  ------------------
  |  Branch (548:12): [True: 50.2k, False: 10.5k]
  ------------------
  549|  50.2k|      uint8_t v = *input + _v2;
  550|  50.2k|      input++;
  551|  50.2k|      *output = v;
  552|  50.2k|      output++;
  553|  50.2k|      _v2 = v;
  554|  50.2k|    }
  555|  10.5k|  }
  556|       |
  557|       |  // Mirror of the forward pass: restore the trailing bytes verbatim.
  558|    133|  memcpy(output, input, (size_t)(length - stream_len * typesize));
  559|       |
  560|    133|  return BLOSC2_ERROR_SUCCESS;
  561|    139|}
bytedelta_backward_buggy:
  611|    179|                             uint8_t meta, blosc2_dparams *dparams, uint8_t id) {
  612|    179|  BLOSC_UNUSED_PARAM(id);
  ------------------
  |  |   28|    179|#define BLOSC_UNUSED_PARAM(x) ((void)(x))
  ------------------
  613|       |
  614|    179|  int typesize = meta;
  615|    179|  if (typesize == 0) {
  ------------------
  |  Branch (615:7): [True: 4, False: 175]
  ------------------
  616|      4|    if (dparams->schunk == NULL) {
  ------------------
  |  Branch (616:9): [True: 4, False: 0]
  ------------------
  617|      4|      BLOSC_TRACE_ERROR("When meta is 0, you need to be on a schunk!");
  ------------------
  |  |   93|      4|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      4|    do {                                            \
  |  |  |  |   98|      4|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      4|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 4, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      4|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  618|      4|      BLOSC_ERROR(BLOSC2_ERROR_FAILURE);
  ------------------
  |  |  111|      4|    do {                                            \
  |  |  112|      4|        int rc_ = (rc);                             \
  |  |  113|      4|        if (rc_ < BLOSC2_ERROR_SUCCESS) {           \
  |  |  ------------------
  |  |  |  Branch (113:13): [True: 4, False: 0]
  |  |  ------------------
  |  |  114|      4|            char *error_msg = print_error(rc_);     \
  |  |  115|      4|            BLOSC_TRACE_ERROR("%s", error_msg);     \
  |  |  ------------------
  |  |  |  |   93|      4|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      4|    do {                                            \
  |  |  |  |  |  |   98|      4|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      4|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 4, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      4|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  116|      4|            return rc_;                             \
  |  |  117|      4|        }                                           \
  |  |  118|      4|    } while (0)
  |  |  ------------------
  |  |  |  Branch (118:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  619|      4|    }
  620|      0|    blosc2_schunk* schunk = (blosc2_schunk*)(dparams->schunk);
  621|      0|    typesize = schunk->typesize;
  622|      0|  }
  623|       |
  624|    175|  const int stream_len = length / typesize;
  625|  16.9k|  for (int ich = 0; ich < typesize; ++ich) {
  ------------------
  |  Branch (625:21): [True: 16.7k, False: 175]
  ------------------
  626|  16.7k|    int ip = 0;
  627|       |    // SIMD fetch 16 bytes from each channel, prefix-sum un-delta
  628|  16.7k|#if defined(CPU_HAS_SIMD)
  629|  16.7k|    bytes16 v2 = {0};
  630|  24.6M|    for (; ip < stream_len - 15; ip += 16) {
  ------------------
  |  Branch (630:12): [True: 24.6M, False: 16.7k]
  ------------------
  631|  24.6M|      bytes16 v = simd_load(input);
  632|  24.6M|      input += 16;
  633|       |      // un-delta via prefix sum
  634|  24.6M|      v2 = simd_add(simd_prefix_sum(v), simd_duplane15(v2));
  635|  24.6M|      simd_store(output, v2);
  636|  24.6M|      output += 16;
  637|  24.6M|    }
  638|  16.7k|#endif // #if defined(CPU_HAS_SIMD)
  639|       |    // scalar leftover
  640|  16.7k|    uint8_t _v2 = 0;
  641|  70.6k|    for (; ip < stream_len; ip++) {
  ------------------
  |  Branch (641:12): [True: 53.8k, False: 16.7k]
  ------------------
  642|  53.8k|      uint8_t v = *input + _v2;
  643|  53.8k|      input++;
  644|  53.8k|      *output = v;
  645|  53.8k|      output++;
  646|  53.8k|      _v2 = v;
  647|  53.8k|    }
  648|  16.7k|  }
  649|       |
  650|    175|  return BLOSC2_ERROR_SUCCESS;
  651|    179|}

register_filters:
   15|  1.96k|void register_filters(void) {
   16|       |
   17|  1.96k|  blosc2_filter ndcell;
   18|  1.96k|  ndcell.id = BLOSC_FILTER_NDCELL;
   19|  1.96k|  ndcell.name = "ndcell";
   20|  1.96k|  ndcell.version = 1;
   21|  1.96k|  ndcell.forward = &ndcell_forward;
   22|  1.96k|  ndcell.backward = &ndcell_backward;
   23|  1.96k|  register_filter_private(&ndcell);
   24|       |
   25|  1.96k|  blosc2_filter ndmean;
   26|  1.96k|  ndmean.id = BLOSC_FILTER_NDMEAN;
   27|  1.96k|  ndmean.name = "ndmean";
   28|  1.96k|  ndmean.version = 1;
   29|  1.96k|  ndmean.forward = &ndmean_forward;
   30|  1.96k|  ndmean.backward = &ndmean_backward;
   31|  1.96k|  register_filter_private(&ndmean);
   32|       |
   33|       |  // Buggy version. See #524
   34|  1.96k|  blosc2_filter bytedelta_buggy;
   35|  1.96k|  bytedelta_buggy.id = BLOSC_FILTER_BYTEDELTA_BUGGY;
   36|  1.96k|  bytedelta_buggy.name = "bytedelta_buggy";
   37|  1.96k|  bytedelta_buggy.version = 1;
   38|  1.96k|  bytedelta_buggy.forward = &bytedelta_forward_buggy;
   39|  1.96k|  bytedelta_buggy.backward = &bytedelta_backward_buggy;
   40|  1.96k|  register_filter_private(&bytedelta_buggy);
   41|       |
   42|       |  // Fixed version. See #524
   43|  1.96k|  blosc2_filter bytedelta;
   44|  1.96k|  bytedelta.id = BLOSC_FILTER_BYTEDELTA;
   45|  1.96k|  bytedelta.name = "bytedelta";
   46|  1.96k|  bytedelta.version = 1;
   47|  1.96k|  bytedelta.forward = &bytedelta_forward;
   48|  1.96k|  bytedelta.backward = &bytedelta_backward;
   49|  1.96k|  register_filter_private(&bytedelta);
   50|       |
   51|  1.96k|  blosc2_filter int_trunc;
   52|  1.96k|  int_trunc.id = BLOSC_FILTER_INT_TRUNC;
   53|  1.96k|  int_trunc.name = "int_trunc";
   54|  1.96k|  int_trunc.version = 1;
   55|  1.96k|  int_trunc.forward = &int_trunc_forward;
   56|  1.96k|  int_trunc.backward = &int_trunc_backward;
   57|  1.96k|  register_filter_private(&int_trunc);
   58|       |
   59|  1.96k|}

truncate_uint8:
   19|    257|                   const uint8_t *src, uint8_t *dest) {
   20|    257|  uint8_t max_prec_bits = (uint8_t) sizeof(uint8_t) * 8;
   21|    257|  uint8_t zeroed_bits = (prec_bits >= 0) ? max_prec_bits - prec_bits : -prec_bits;
  ------------------
  |  Branch (21:25): [True: 257, False: 0]
  ------------------
   22|    257|  if (zeroed_bits >= max_prec_bits) {
  ------------------
  |  Branch (22:7): [True: 0, False: 257]
  ------------------
   23|      0|    BLOSC_TRACE_ERROR("The reduction in precision cannot be larger or equal than %d bits"
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
   24|      0|                      " (asking for %d bits)",  max_prec_bits, prec_bits);
   25|      0|    return -1;
   26|      0|  }
   27|    257|  uint8_t mask = ~((1 << zeroed_bits) - 1);
   28|  4.41k|  for (int i = 0; i < nelems; i++) {
  ------------------
  |  Branch (28:19): [True: 4.16k, False: 257]
  ------------------
   29|  4.16k|    dest[i] = src[i] & mask;
   30|  4.16k|  }
   31|    257|  return BLOSC2_ERROR_SUCCESS;
   32|    257|}
truncate_uint16:
   36|    256|                    const uint16_t *src, uint16_t *dest) {
   37|    256|  uint8_t max_prec_bits = (uint8_t) sizeof(uint16_t) * 8;
   38|    256|  uint8_t zeroed_bits = (prec_bits >= 0) ? max_prec_bits - prec_bits : -prec_bits;
  ------------------
  |  Branch (38:25): [True: 256, False: 0]
  ------------------
   39|    256|  if (zeroed_bits >= max_prec_bits) {
  ------------------
  |  Branch (39:7): [True: 0, False: 256]
  ------------------
   40|      0|    BLOSC_TRACE_ERROR("The reduction in precision cannot be larger or equal than %d bits"
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
   41|      0|                      " (asking for %d bits)",  max_prec_bits, prec_bits);
   42|      0|    return -1;
   43|      0|  }
   44|    256|  uint16_t mask = ~((1 << zeroed_bits) - 1);
   45|  4.35k|  for (int i = 0; i < nelems; i++) {
  ------------------
  |  Branch (45:19): [True: 4.09k, False: 256]
  ------------------
   46|  4.09k|    dest[i] = src[i] & mask;
   47|  4.09k|  }
   48|    256|  return BLOSC2_ERROR_SUCCESS;
   49|    256|}
truncate_uint32:
   53|    256|                    const uint32_t *src, uint32_t *dest) {
   54|    256|  uint8_t max_prec_bits = (uint8_t) sizeof(uint32_t) * 8;
   55|    256|  uint8_t zeroed_bits = (prec_bits >= 0) ? max_prec_bits - prec_bits : -prec_bits;
  ------------------
  |  Branch (55:25): [True: 256, False: 0]
  ------------------
   56|    256|  if (zeroed_bits >= max_prec_bits) {
  ------------------
  |  Branch (56:7): [True: 0, False: 256]
  ------------------
   57|      0|    BLOSC_TRACE_ERROR("The reduction in precision cannot be larger or equal than %d bits"
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
   58|      0|                      " (asking for %d bits)",  max_prec_bits, prec_bits);
   59|      0|    return -1;
   60|      0|  }
   61|    256|  uint32_t mask = ~((1 << zeroed_bits) - 1);
   62|  4.35k|  for (int i = 0; i < nelems; i++) {
  ------------------
  |  Branch (62:19): [True: 4.09k, False: 256]
  ------------------
   63|  4.09k|    dest[i] = src[i] & mask;
   64|  4.09k|  }
   65|    256|  return BLOSC2_ERROR_SUCCESS;
   66|    256|}
truncate_uint64:
   70|    272|                    const uint64_t *src, uint64_t *dest) {
   71|    272|  uint8_t max_prec_bits = (uint8_t) sizeof(uint64_t) * 8;
   72|    272|  uint8_t zeroed_bits = (prec_bits >= 0) ? max_prec_bits - prec_bits : -prec_bits;
  ------------------
  |  Branch (72:25): [True: 272, False: 0]
  ------------------
   73|    272|  if (zeroed_bits >= max_prec_bits) {
  ------------------
  |  Branch (73:7): [True: 0, False: 272]
  ------------------
   74|      0|    BLOSC_TRACE_ERROR("The reduction in precision cannot be larger or equal than %d bits"
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
   75|      0|                      " (asking for %d bits)",  max_prec_bits, prec_bits);
   76|      0|    return -1;
   77|      0|  }
   78|    272|  uint64_t mask = ~((1ULL << zeroed_bits) - 1ULL);
   79|  8.46k|  for (int i = 0; i < nelems; i++) {
  ------------------
  |  Branch (79:19): [True: 8.19k, False: 272]
  ------------------
   80|  8.19k|    dest[i] = src[i] & mask;
   81|  8.19k|  }
   82|    272|  return BLOSC2_ERROR_SUCCESS;
   83|    272|}
int_trunc_forward:
   87|  1.04k|                      blosc2_cparams* cparams, uint8_t id) {
   88|  1.04k|  BLOSC_UNUSED_PARAM(id);
  ------------------
  |  |   28|  1.04k|#define BLOSC_UNUSED_PARAM(x) ((void)(x))
  ------------------
   89|  1.04k|  int32_t typesize = cparams->typesize;
   90|  1.04k|  int32_t nelems = length / typesize;
   91|  1.04k|  int8_t prec_bits = (int8_t)meta;
   92|       |
   93|       |  // Positive values of prec_bits will set absolute precision bits, whereas negative
   94|       |  // values will reduce the precision bits (similar to Python slicing convention).
   95|  1.04k|  switch (typesize) {
   96|    257|    case 1:
  ------------------
  |  Branch (96:5): [True: 257, False: 784]
  ------------------
   97|    257|      return truncate_uint8(prec_bits, nelems,
   98|    257|                            (uint8_t *)input, (uint8_t *)output);
   99|    256|    case 2:
  ------------------
  |  Branch (99:5): [True: 256, False: 785]
  ------------------
  100|    256|      return truncate_uint16(prec_bits, nelems,
  101|    256|                             (uint16_t *)input, (uint16_t *)output);
  102|    256|    case 4:
  ------------------
  |  Branch (102:5): [True: 256, False: 785]
  ------------------
  103|    256|      return truncate_uint32(prec_bits, nelems,
  104|    256|                             (uint32_t *)input, (uint32_t *)output);
  105|    272|    case 8:
  ------------------
  |  Branch (105:5): [True: 272, False: 769]
  ------------------
  106|    272|      return truncate_uint64(prec_bits, nelems,
  107|    272|                             (uint64_t *)input, (uint64_t *)output);
  108|      0|    default:
  ------------------
  |  Branch (108:5): [True: 0, False: 1.04k]
  ------------------
  109|       |      BLOSC_TRACE_ERROR("Error in BLOSC_FILTER_INT_TRUNC filter: "
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  110|      0|                        "Precision for typesize %d not handled",
  111|      0|                        (int)typesize);
  112|      0|      return -1;
  113|  1.04k|  }
  114|  1.04k|}
int_trunc_backward:
  117|  1.33k|                       blosc2_dparams *dparams, uint8_t id) {
  118|  1.33k|  BLOSC_UNUSED_PARAM(id);
  ------------------
  |  |   28|  1.33k|#define BLOSC_UNUSED_PARAM(x) ((void)(x))
  ------------------
  119|  1.33k|  BLOSC_UNUSED_PARAM(dparams);
  ------------------
  |  |   28|  1.33k|#define BLOSC_UNUSED_PARAM(x) ((void)(x))
  ------------------
  120|  1.33k|  BLOSC_UNUSED_PARAM(meta);
  ------------------
  |  |   28|  1.33k|#define BLOSC_UNUSED_PARAM(x) ((void)(x))
  ------------------
  121|       |
  122|       |  // Do a copy of the input buffer (truncation is lossy and cannot be reversed)
  123|  1.33k|  memcpy(output, input, length);
  124|  1.33k|  return BLOSC2_ERROR_SUCCESS;
  125|  1.33k|}

ndcell_forward:
   22|    371|                   uint8_t id) {
   23|    371|  BLOSC_UNUSED_PARAM(id);
  ------------------
  |  |   28|    371|#define BLOSC_UNUSED_PARAM(x) ((void)(x))
  ------------------
   24|    371|  uint8_t *smeta;
   25|    371|  int32_t smeta_len;
   26|    371|  if (blosc2_meta_get(cparams->schunk, "b2nd", &smeta, &smeta_len) < 0) {
  ------------------
  |  Branch (26:7): [True: 0, False: 371]
  ------------------
   27|      0|    BLOSC_TRACE_ERROR("b2nd layer not found!");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
   28|      0|    return BLOSC2_ERROR_FAILURE;
   29|      0|  }
   30|    371|  int8_t ndim;
   31|    371|  int64_t *shape = malloc(B2ND_MAX_DIM * sizeof(int64_t));
  ------------------
  |  |   50|    371|#define B2ND_MAX_DIM 16
  ------------------
   32|    371|  int32_t *chunkshape = malloc(B2ND_MAX_DIM * sizeof(int32_t));
  ------------------
  |  |   50|    371|#define B2ND_MAX_DIM 16
  ------------------
   33|    371|  int32_t *blockshape = malloc(B2ND_MAX_DIM * sizeof(int32_t));
  ------------------
  |  |   50|    371|#define B2ND_MAX_DIM 16
  ------------------
   34|    371|  if (b2nd_deserialize_meta(smeta, smeta_len, &ndim, shape, chunkshape, blockshape, NULL, NULL) < 0) {
  ------------------
  |  Branch (34:7): [True: 0, False: 371]
  ------------------
   35|      0|    free(smeta);
   36|      0|    free(shape);
   37|      0|    free(chunkshape);
   38|      0|    free(blockshape);
   39|      0|    return BLOSC2_ERROR_FAILURE;
   40|      0|  }
   41|    371|  free(smeta);
   42|    371|  if (ndim <= 0 || ndim > NDCELL_MAX_DIM) {
  ------------------
  |  |   16|    371|#define NDCELL_MAX_DIM 8
  ------------------
  |  Branch (42:7): [True: 0, False: 371]
  |  Branch (42:20): [True: 0, False: 371]
  ------------------
   43|      0|    free(shape);
   44|      0|    free(chunkshape);
   45|      0|    free(blockshape);
   46|      0|    BLOSC_TRACE_ERROR("ndim %d is out of range", ndim);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
   47|      0|    return BLOSC2_ERROR_FAILURE;
   48|      0|  }
   49|    371|  int typesize = cparams->typesize;
   50|       |
   51|       |  // `meta` is the cell side length and comes from the chunk header (uint8_t,
   52|       |  // 0..255).  Interpret it as unsigned and reject 0: an (int8_t) cast would turn
   53|       |  // 128..255 into negative values and 0 would later divide by zero in
   54|       |  // `(blockshape[i] + cell_shape - 1) / cell_shape`.
   55|    371|  int cell_shape = (int) meta;
   56|    371|  if (cell_shape <= 0) {
  ------------------
  |  Branch (56:7): [True: 0, False: 371]
  ------------------
   57|      0|    free(shape);
   58|      0|    free(chunkshape);
   59|      0|    free(blockshape);
   60|      0|    BLOSC_TRACE_ERROR("Invalid cell_shape %d", cell_shape);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
   61|      0|    return BLOSC2_ERROR_FAILURE;
   62|      0|  }
   63|       |  // cell_size is cell_shape^ndim (elements per cell).  Compute it with checked
   64|       |  // 64-bit multiplication: an (int) pow() can overflow / lose precision, and
   65|       |  // casting an out-of-range double back to int is undefined behaviour that could
   66|       |  // bypass the "buffer smaller than cell" check further down.
   67|    371|  int64_t cell_size = 1;
   68|  1.84k|  for (int i = 0; i < ndim; i++) {
  ------------------
  |  Branch (68:19): [True: 1.47k, False: 371]
  ------------------
   69|  1.47k|    if (cell_size > INT64_MAX / cell_shape) {
  ------------------
  |  Branch (69:9): [True: 0, False: 1.47k]
  ------------------
   70|      0|      free(shape);
   71|      0|      free(chunkshape);
   72|      0|      free(blockshape);
   73|      0|      BLOSC_TRACE_ERROR("cell_shape %d too large for ndim %d", cell_shape, ndim);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
   74|      0|      return BLOSC2_ERROR_FAILURE;
   75|      0|    }
   76|  1.47k|    cell_size *= cell_shape;
   77|  1.47k|  }
   78|       |
   79|    371|  if (typesize <= 0) {
  ------------------
  |  Branch (79:7): [True: 0, False: 371]
  ------------------
   80|      0|    free(shape);
   81|      0|    free(chunkshape);
   82|      0|    free(blockshape);
   83|      0|    BLOSC_TRACE_ERROR("Invalid typesize %d", typesize);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
   84|      0|    return BLOSC2_ERROR_FAILURE;
   85|      0|  }
   86|       |  // See ndcell_backward(): validate the b2nd block geometry in 64-bit so a
   87|       |  // crafted blockshape cannot wrap a 32-bit product back onto `length` and make
   88|       |  // the index arithmetic below read past the `length`-sized input buffer.
   89|    371|  int64_t blocksize = (int64_t) typesize;
   90|  1.84k|  for (int i = 0; i < ndim; i++) {
  ------------------
  |  Branch (90:19): [True: 1.47k, False: 371]
  ------------------
   91|  1.47k|    if (blockshape[i] <= 0) {
  ------------------
  |  Branch (91:9): [True: 0, False: 1.47k]
  ------------------
   92|      0|      free(shape);
   93|      0|      free(chunkshape);
   94|      0|      free(blockshape);
   95|      0|      BLOSC_TRACE_ERROR("Invalid blockshape[%d] = %d", i, blockshape[i]);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
   96|      0|      return BLOSC2_ERROR_FAILURE;
   97|      0|    }
   98|  1.47k|    blocksize *= blockshape[i];
   99|  1.47k|    if (blocksize > (int64_t) length) {
  ------------------
  |  Branch (99:9): [True: 0, False: 1.47k]
  ------------------
  100|      0|      free(shape);
  101|      0|      free(chunkshape);
  102|      0|      free(blockshape);
  103|      0|      BLOSC_TRACE_ERROR("blockshape too large for block of %d bytes", length);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  104|      0|      return BLOSC2_ERROR_FAILURE;
  105|      0|    }
  106|  1.47k|  }
  107|       |
  108|    371|  if ((int64_t) length != blocksize) {
  ------------------
  |  Branch (108:7): [True: 0, False: 371]
  ------------------
  109|      0|    free(shape);
  110|      0|    free(chunkshape);
  111|      0|    free(blockshape);
  112|      0|    BLOSC_TRACE_ERROR("Length not equal to blocksize %d %lld \n", length, (long long) blocksize);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  113|      0|    return BLOSC2_ERROR_FAILURE;
  114|      0|  }
  115|       |
  116|    371|  uint8_t *ip = (uint8_t *) input;
  117|    371|  uint8_t *op = (uint8_t *) output;
  118|    371|  uint8_t *op_limit = op + length;
  119|       |
  120|       |  // length is a multiple of typesize here (length == blocksize, checked above),
  121|       |  // so the division is exact; phrasing the check this way avoids overflowing the
  122|       |  // cell_size * typesize product.
  123|    371|  if (cell_size > (int64_t) length / typesize) {
  ------------------
  |  Branch (123:7): [True: 0, False: 371]
  ------------------
  124|      0|    free(shape);
  125|      0|    free(chunkshape);
  126|      0|    free(blockshape);
  127|      0|    BLOSC_TRACE_ERROR("input or output buffer cannot be smaller than cell size");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  128|      0|    return BLOSC2_ERROR_FAILURE;
  129|      0|  }
  130|       |
  131|    371|  uint8_t *obase = op;
  132|       |
  133|    371|  int64_t i_shape[NDCELL_MAX_DIM];
  134|  1.84k|  for (int i = 0; i < ndim; ++i) {
  ------------------
  |  Branch (134:19): [True: 1.47k, False: 371]
  ------------------
  135|  1.47k|    i_shape[i] = (blockshape[i] + cell_shape - 1) / cell_shape;
  136|  1.47k|  }
  137|       |
  138|    371|  int64_t ncells = 1;
  139|  1.84k|  for (int i = 0; i < ndim; ++i) {
  ------------------
  |  Branch (139:19): [True: 1.47k, False: 371]
  ------------------
  140|  1.47k|    ncells *= i_shape[i];
  141|  1.47k|  }
  142|       |
  143|       |  /* main loop */
  144|    371|  int64_t pad_shape[NDCELL_MAX_DIM];
  145|    371|  int64_t ii[NDCELL_MAX_DIM];
  146|  1.24k|  for (int cell_ind = 0; cell_ind < ncells; cell_ind++) {      // for each cell
  ------------------
  |  Branch (146:26): [True: 875, False: 371]
  ------------------
  147|    875|    blosc2_unidim_to_multidim(ndim, i_shape, cell_ind, ii);
  148|    875|    uint32_t orig = 0;
  149|    875|    int64_t nd_aux = (int64_t) cell_shape;
  150|  3.86k|    for (int i = ndim - 1; i >= 0; i--) {
  ------------------
  |  Branch (150:28): [True: 2.98k, False: 875]
  ------------------
  151|  2.98k|      orig += ii[i] * nd_aux;
  152|  2.98k|      nd_aux *= blockshape[i];
  153|  2.98k|    }
  154|       |
  155|  3.86k|    for (int dim_ind = 0; dim_ind < ndim; dim_ind++) {
  ------------------
  |  Branch (155:27): [True: 2.98k, False: 875]
  ------------------
  156|  2.98k|      if ((blockshape[dim_ind] % cell_shape != 0) && (ii[dim_ind] == i_shape[dim_ind] - 1)) {
  ------------------
  |  Branch (156:11): [True: 0, False: 2.98k]
  |  Branch (156:54): [True: 0, False: 0]
  ------------------
  157|      0|        pad_shape[dim_ind] = blockshape[dim_ind] % cell_shape;
  158|  2.98k|      } else {
  159|  2.98k|        pad_shape[dim_ind] = (int64_t) cell_shape;
  160|  2.98k|      }
  161|  2.98k|    }
  162|    875|    int64_t ncopies = 1;
  163|  2.98k|    for (int i = 0; i < ndim - 1; ++i) {
  ------------------
  |  Branch (163:21): [True: 2.11k, False: 875]
  ------------------
  164|  2.11k|      ncopies *= pad_shape[i];
  165|  2.11k|    }
  166|    875|    int64_t kk[NDCELL_MAX_DIM];
  167|  4.29k|    for (int copy_ind = 0; copy_ind < ncopies; ++copy_ind) {
  ------------------
  |  Branch (167:28): [True: 3.41k, False: 875]
  ------------------
  168|  3.41k|      blosc2_unidim_to_multidim(ndim - 1, pad_shape, copy_ind, kk);
  169|  3.41k|      nd_aux = blockshape[ndim - 1];
  170|  3.41k|      int64_t ind = orig;
  171|  13.1k|      for (int i = ndim - 2; i >= 0; i--) {
  ------------------
  |  Branch (171:30): [True: 9.73k, False: 3.41k]
  ------------------
  172|  9.73k|        ind += kk[i] * nd_aux;
  173|  9.73k|        nd_aux *= blockshape[i];
  174|  9.73k|      }
  175|  3.41k|      memcpy(op, &ip[ind * typesize], pad_shape[ndim - 1] * typesize);
  176|  3.41k|      op += pad_shape[ndim - 1] * typesize;
  177|  3.41k|    }
  178|       |
  179|    875|    if (op > op_limit) {
  ------------------
  |  Branch (179:9): [True: 0, False: 875]
  ------------------
  180|      0|      free(shape);
  181|      0|      free(chunkshape);
  182|      0|      free(blockshape);
  183|      0|      BLOSC_TRACE_ERROR("Exceeding output buffer limits!");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  184|      0|      return BLOSC2_ERROR_FAILURE;
  185|      0|    }
  186|    875|  }
  187|       |
  188|    371|  if ((op - obase) != length) {
  ------------------
  |  Branch (188:7): [True: 0, False: 371]
  ------------------
  189|      0|    free(shape);
  190|      0|    free(chunkshape);
  191|      0|    free(blockshape);
  192|      0|    BLOSC_TRACE_ERROR("Output size must be equal to input size");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  193|      0|    return BLOSC2_ERROR_FAILURE;
  194|      0|  }
  195|       |
  196|    371|  free(shape);
  197|    371|  free(chunkshape);
  198|    371|  free(blockshape);
  199|       |
  200|    371|  return BLOSC2_ERROR_SUCCESS;
  201|    371|}
ndcell_backward:
  205|    602|                   uint8_t id) {
  206|    602|  BLOSC_UNUSED_PARAM(id);
  ------------------
  |  |   28|    602|#define BLOSC_UNUSED_PARAM(x) ((void)(x))
  ------------------
  207|    602|  blosc2_schunk *schunk = dparams->schunk;
  208|    602|  int8_t ndim;
  209|    602|  int64_t *shape = malloc(B2ND_MAX_DIM * sizeof(int64_t));
  ------------------
  |  |   50|    602|#define B2ND_MAX_DIM 16
  ------------------
  210|    602|  int32_t *chunkshape = malloc(B2ND_MAX_DIM * sizeof(int32_t));
  ------------------
  |  |   50|    602|#define B2ND_MAX_DIM 16
  ------------------
  211|    602|  int32_t *blockshape = malloc(B2ND_MAX_DIM * sizeof(int32_t));
  ------------------
  |  |   50|    602|#define B2ND_MAX_DIM 16
  ------------------
  212|    602|  uint8_t *smeta;
  213|    602|  int32_t smeta_len;
  214|    602|  if (blosc2_meta_get(schunk, "b2nd", &smeta, &smeta_len) < 0) {
  ------------------
  |  Branch (214:7): [True: 2, False: 600]
  ------------------
  215|      2|    free(shape);
  216|      2|    free(chunkshape);
  217|      2|    free(blockshape);
  218|      2|    BLOSC_TRACE_ERROR("b2nd layer not found!");
  ------------------
  |  |   93|      2|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      2|    do {                                            \
  |  |  |  |   98|      2|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      2|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 2, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      2|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  219|      2|    return BLOSC2_ERROR_FAILURE;
  220|      2|  }
  221|    600|  if (b2nd_deserialize_meta(smeta, smeta_len, &ndim, shape, chunkshape, blockshape, NULL, NULL) < 0) {
  ------------------
  |  Branch (221:7): [True: 0, False: 600]
  ------------------
  222|      0|    free(smeta);
  223|      0|    free(shape);
  224|      0|    free(chunkshape);
  225|      0|    free(blockshape);
  226|      0|    return BLOSC2_ERROR_FAILURE;
  227|      0|  }
  228|    600|  free(smeta);
  229|    600|  if (ndim <= 0 || ndim > NDCELL_MAX_DIM) {
  ------------------
  |  |   16|    600|#define NDCELL_MAX_DIM 8
  ------------------
  |  Branch (229:7): [True: 0, False: 600]
  |  Branch (229:20): [True: 0, False: 600]
  ------------------
  230|      0|    free(shape);
  231|      0|    free(chunkshape);
  232|      0|    free(blockshape);
  233|      0|    BLOSC_TRACE_ERROR("ndim %d is out of range", ndim);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  234|      0|    return BLOSC2_ERROR_FAILURE;
  235|      0|  }
  236|       |
  237|       |  // `meta` is attacker-controlled in a crafted frame.  Interpret it as unsigned
  238|       |  // and reject 0: an (int8_t) cast would turn 128..255 into negative values and
  239|       |  // 0 would later divide by zero in `(blockshape[i] + cell_shape - 1) / cell_shape`.
  240|    600|  int cell_shape = (int) meta;
  241|    600|  if (cell_shape <= 0) {
  ------------------
  |  Branch (241:7): [True: 0, False: 600]
  ------------------
  242|      0|    free(shape);
  243|      0|    free(chunkshape);
  244|      0|    free(blockshape);
  245|      0|    BLOSC_TRACE_ERROR("Invalid cell_shape %d", cell_shape);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  246|      0|    return BLOSC2_ERROR_FAILURE;
  247|      0|  }
  248|       |  // See ndcell_forward(): compute cell_shape^ndim with checked 64-bit
  249|       |  // multiplication so an overflowing (int) pow() cannot bypass the
  250|       |  // "buffer smaller than cell" check below.
  251|    600|  int64_t cell_size = 1;
  252|  2.98k|  for (int i = 0; i < ndim; i++) {
  ------------------
  |  Branch (252:19): [True: 2.38k, False: 600]
  ------------------
  253|  2.38k|    if (cell_size > INT64_MAX / cell_shape) {
  ------------------
  |  Branch (253:9): [True: 0, False: 2.38k]
  ------------------
  254|      0|      free(shape);
  255|      0|      free(chunkshape);
  256|      0|      free(blockshape);
  257|      0|      BLOSC_TRACE_ERROR("cell_shape %d too large for ndim %d", cell_shape, ndim);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  258|      0|      return BLOSC2_ERROR_FAILURE;
  259|      0|    }
  260|  2.38k|    cell_size *= cell_shape;
  261|  2.38k|  }
  262|    600|  int32_t typesize = schunk->typesize;
  263|    600|  uint8_t *ip = (uint8_t *) input;
  264|    600|  uint8_t *ip_limit = ip + length;
  265|    600|  uint8_t *op = (uint8_t *) output;
  266|    600|  if (typesize <= 0) {
  ------------------
  |  Branch (266:7): [True: 0, False: 600]
  ------------------
  267|      0|    free(shape);
  268|      0|    free(chunkshape);
  269|      0|    free(blockshape);
  270|      0|    BLOSC_TRACE_ERROR("Invalid typesize %d", typesize);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  271|      0|    return BLOSC2_ERROR_FAILURE;
  272|      0|  }
  273|       |  // The block geometry (blockshape) comes from the attacker-controlled "b2nd"
  274|       |  // metalayer and is NOT validated by b2nd_deserialize_meta().  Compute the
  275|       |  // block size in 64-bit and reject non-positive dimensions.  Otherwise a
  276|       |  // crafted blockshape whose 32-bit product wraps back onto `length` would pass
  277|       |  // the check below, while the scatter-write index arithmetic further down uses
  278|       |  // the true (huge) dimensions, writing past the `length`-sized output buffer
  279|       |  // (heap overflow).  Bailing as soon as the running product exceeds `length`
  280|       |  // also keeps the 64-bit multiply from overflowing (it stays
  281|       |  // <= length * INT32_MAX < INT64_MAX).
  282|    600|  int64_t blocksize = (int64_t) typesize;
  283|  2.98k|  for (int i = 0; i < ndim; i++) {
  ------------------
  |  Branch (283:19): [True: 2.38k, False: 600]
  ------------------
  284|  2.38k|    if (blockshape[i] <= 0) {
  ------------------
  |  Branch (284:9): [True: 0, False: 2.38k]
  ------------------
  285|      0|      free(shape);
  286|      0|      free(chunkshape);
  287|      0|      free(blockshape);
  288|      0|      BLOSC_TRACE_ERROR("Invalid blockshape[%d] = %d", i, blockshape[i]);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  289|      0|      return BLOSC2_ERROR_FAILURE;
  290|      0|    }
  291|  2.38k|    blocksize *= blockshape[i];
  292|  2.38k|    if (blocksize > (int64_t) length) {
  ------------------
  |  Branch (292:9): [True: 0, False: 2.38k]
  ------------------
  293|      0|      free(shape);
  294|      0|      free(chunkshape);
  295|      0|      free(blockshape);
  296|      0|      BLOSC_TRACE_ERROR("blockshape too large for block of %d bytes", length);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  297|      0|      return BLOSC2_ERROR_FAILURE;
  298|      0|    }
  299|  2.38k|  }
  300|       |
  301|    600|  if ((int64_t) length != blocksize) {
  ------------------
  |  Branch (301:7): [True: 0, False: 600]
  ------------------
  302|      0|    free(shape);
  303|      0|    free(chunkshape);
  304|      0|    free(blockshape);
  305|      0|    BLOSC_TRACE_ERROR("Length not equal to blocksize %d %lld", length, (long long) blocksize);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  306|      0|    return BLOSC2_ERROR_FAILURE;
  307|      0|  }
  308|       |
  309|       |  // length is a multiple of typesize here (length == blocksize, checked above),
  310|       |  // so the division is exact; phrasing the check this way avoids overflowing the
  311|       |  // cell_size * typesize product.
  312|    600|  if (cell_size > (int64_t) length / typesize) {
  ------------------
  |  Branch (312:7): [True: 0, False: 600]
  ------------------
  313|      0|    free(shape);
  314|      0|    free(chunkshape);
  315|      0|    free(blockshape);
  316|      0|    BLOSC_TRACE_ERROR("input and output buffer cannot be smaller than cell size");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  317|      0|    return BLOSC2_ERROR_FAILURE;
  318|      0|  }
  319|       |
  320|    600|  int64_t i_shape[NDCELL_MAX_DIM];
  321|  2.98k|  for (int i = 0; i < ndim; ++i) {
  ------------------
  |  Branch (321:19): [True: 2.38k, False: 600]
  ------------------
  322|  2.38k|    i_shape[i] = (blockshape[i] + cell_shape - 1) / cell_shape;
  323|  2.38k|  }
  324|       |
  325|    600|  int64_t ncells = 1;
  326|  2.98k|  for (int i = 0; i < ndim; ++i) {
  ------------------
  |  Branch (326:19): [True: 2.38k, False: 600]
  ------------------
  327|  2.38k|    ncells *= i_shape[i];
  328|  2.38k|  }
  329|       |
  330|       |  /* main loop */
  331|    600|  int64_t pad_shape[NDCELL_MAX_DIM] = {0};
  332|    600|  int64_t ii[NDCELL_MAX_DIM];
  333|    600|  int32_t ind = 0;
  334|  2.20k|  for (int cell_ind = 0; cell_ind < ncells; cell_ind++) {      // for each cell
  ------------------
  |  Branch (334:26): [True: 1.60k, False: 600]
  ------------------
  335|       |
  336|  1.60k|    if (ip > ip_limit) {
  ------------------
  |  Branch (336:9): [True: 0, False: 1.60k]
  ------------------
  337|      0|      free(shape);
  338|      0|      free(chunkshape);
  339|      0|      free(blockshape);
  340|      0|      BLOSC_TRACE_ERROR("Exceeding input length!");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  341|      0|      return BLOSC2_ERROR_FAILURE;
  342|      0|    }
  343|  1.60k|    blosc2_unidim_to_multidim(ndim, i_shape, cell_ind, ii);
  344|  1.60k|    uint32_t orig = 0;
  345|  1.60k|    int64_t nd_aux = (int64_t) cell_shape;
  346|  7.01k|    for (int i = ndim - 1; i >= 0; i--) {
  ------------------
  |  Branch (346:28): [True: 5.40k, False: 1.60k]
  ------------------
  347|  5.40k|      orig += ii[i] * nd_aux;
  348|  5.40k|      nd_aux *= blockshape[i];
  349|  5.40k|    }
  350|       |
  351|  7.01k|    for (int dim_ind = 0; dim_ind < ndim; dim_ind++) {
  ------------------
  |  Branch (351:27): [True: 5.40k, False: 1.60k]
  ------------------
  352|  5.40k|      if ((blockshape[dim_ind] % cell_shape != 0) && (ii[dim_ind] == i_shape[dim_ind] - 1)) {
  ------------------
  |  Branch (352:11): [True: 0, False: 5.40k]
  |  Branch (352:54): [True: 0, False: 0]
  ------------------
  353|      0|        pad_shape[dim_ind] = blockshape[dim_ind] % cell_shape;
  354|  5.40k|      } else {
  355|  5.40k|        pad_shape[dim_ind] = (int64_t) cell_shape;
  356|  5.40k|      }
  357|  5.40k|    }
  358|       |
  359|  1.60k|    int64_t ncopies = 1;
  360|  5.40k|    for (int i = 0; i < ndim - 1; ++i) {
  ------------------
  |  Branch (360:21): [True: 3.80k, False: 1.60k]
  ------------------
  361|  3.80k|      ncopies *= pad_shape[i];
  362|  3.80k|    }
  363|  1.60k|    int64_t kk[NDCELL_MAX_DIM];
  364|  7.30k|    for (int copy_ind = 0; copy_ind < ncopies; ++copy_ind) {
  ------------------
  |  Branch (364:28): [True: 5.69k, False: 1.60k]
  ------------------
  365|  5.69k|      blosc2_unidim_to_multidim(ndim - 1, pad_shape, copy_ind, kk);
  366|  5.69k|      nd_aux = blockshape[ndim - 1];
  367|  5.69k|      ind = (int32_t) orig;
  368|  21.7k|      for (int i = ndim - 2; i >= 0; i--) {
  ------------------
  |  Branch (368:30): [True: 16.0k, False: 5.69k]
  ------------------
  369|  16.0k|        ind += (int32_t) (kk[i] * nd_aux);
  370|  16.0k|        nd_aux *= blockshape[i];
  371|  16.0k|      }
  372|  5.69k|      memcpy(&op[ind * typesize], ip, pad_shape[ndim - 1] * typesize);
  373|  5.69k|      ip += pad_shape[ndim - 1] * typesize;
  374|  5.69k|    }
  375|  1.60k|  }
  376|    600|  ind += (int32_t) pad_shape[ndim - 1];
  377|       |
  378|       |
  379|    600|  if (ind != (int32_t) (blocksize / typesize)) {
  ------------------
  |  Branch (379:7): [True: 0, False: 600]
  ------------------
  380|      0|    free(shape);
  381|      0|    free(chunkshape);
  382|      0|    free(blockshape);
  383|      0|    BLOSC_TRACE_ERROR("Output size is not compatible with embedded blockshape ind %d %lld \n",
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  384|      0|                      ind, (long long) (blocksize / typesize));
  385|      0|    return BLOSC2_ERROR_FAILURE;
  386|      0|  }
  387|       |
  388|    600|  free(shape);
  389|    600|  free(chunkshape);
  390|    600|  free(blockshape);
  391|       |
  392|    600|  return BLOSC2_ERROR_SUCCESS;
  393|    600|}

ndmean_forward:
   17|     16|                   uint8_t id) {
   18|     16|  BLOSC_UNUSED_PARAM(id);
  ------------------
  |  |   28|     16|#define BLOSC_UNUSED_PARAM(x) ((void)(x))
  ------------------
   19|     16|  int8_t ndim;
   20|       |  // b2nd_deserialize_meta() writes up to B2ND_MAX_DIM entries (it only validates
   21|       |  // ndim <= B2ND_MAX_DIM), so the destination buffers must be sized accordingly,
   22|       |  // not for NDMEAN_MAX_DIM.  Otherwise a crafted b2nd metalayer with
   23|       |  // NDMEAN_MAX_DIM < ndim <= B2ND_MAX_DIM overflows these allocations.
   24|     16|  int64_t *shape = malloc(B2ND_MAX_DIM * sizeof(int64_t));
  ------------------
  |  |   50|     16|#define B2ND_MAX_DIM 16
  ------------------
   25|     16|  int32_t *chunkshape = malloc(B2ND_MAX_DIM * sizeof(int32_t));
  ------------------
  |  |   50|     16|#define B2ND_MAX_DIM 16
  ------------------
   26|     16|  int32_t *blockshape = malloc(B2ND_MAX_DIM * sizeof(int32_t));
  ------------------
  |  |   50|     16|#define B2ND_MAX_DIM 16
  ------------------
   27|     16|  uint8_t *smeta;
   28|     16|  int32_t smeta_len;
   29|     16|  if (blosc2_meta_get(cparams->schunk, "b2nd", &smeta, &smeta_len) < 0) {
  ------------------
  |  Branch (29:7): [True: 0, False: 16]
  ------------------
   30|      0|    free(shape);
   31|      0|    free(chunkshape);
   32|      0|    free(blockshape);
   33|      0|    BLOSC_TRACE_ERROR("b2nd layer not found!");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
   34|      0|    return BLOSC2_ERROR_FAILURE;
   35|      0|  }
   36|     16|  if (b2nd_deserialize_meta(smeta, smeta_len, &ndim, shape, chunkshape, blockshape, NULL, NULL) < 0) {
  ------------------
  |  Branch (36:7): [True: 0, False: 16]
  ------------------
   37|      0|    free(smeta);
   38|      0|    free(shape);
   39|      0|    free(chunkshape);
   40|      0|    free(blockshape);
   41|      0|    BLOSC_TRACE_ERROR("Cannot deserialize b2nd metalayer");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
   42|      0|    return BLOSC2_ERROR_FAILURE;
   43|      0|  }
   44|     16|  free(smeta);
   45|       |  // Guard the fixed-size (NDMEAN_MAX_DIM) stack arrays used below.
   46|     16|  if (ndim <= 0 || ndim > NDMEAN_MAX_DIM) {
  ------------------
  |  |   16|     16|#define NDMEAN_MAX_DIM 8
  ------------------
  |  Branch (46:7): [True: 0, False: 16]
  |  Branch (46:20): [True: 0, False: 16]
  ------------------
   47|      0|    free(shape);
   48|      0|    free(chunkshape);
   49|      0|    free(blockshape);
   50|      0|    BLOSC_TRACE_ERROR("ndim %d is out of range", ndim);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
   51|      0|    return BLOSC2_ERROR_FAILURE;
   52|      0|  }
   53|     16|  int typesize = cparams->typesize;
   54|       |
   55|     16|  if ((typesize != 4) && (typesize != 8)) {
  ------------------
  |  Branch (55:7): [True: 0, False: 16]
  |  Branch (55:26): [True: 0, False: 0]
  ------------------
   56|      0|    free(shape);
   57|      0|    free(chunkshape);
   58|      0|    free(blockshape);
   59|      0|    BLOSC_TRACE_ERROR("This filter only works for float or double");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
   60|      0|    return BLOSC2_ERROR_FAILURE;
   61|      0|  }
   62|       |
   63|       |  // `meta` carries the NDMEAN cell shape and is attacker-controlled (it is the
   64|       |  // chunk-header filters_meta byte).  It is cast to int8_t and used as the
   65|       |  // divisor when building i_shape[] below, so a value of 0 (divide-by-zero) or
   66|       |  // one that becomes negative after the cast (meta > INT8_MAX) would crash or
   67|       |  // produce bogus, out-of-range geometry.  Require a positive cell shape.
   68|     16|  if ((int8_t) meta <= 0) {
  ------------------
  |  Branch (68:7): [True: 0, False: 16]
  ------------------
   69|      0|    free(shape);
   70|      0|    free(chunkshape);
   71|      0|    free(blockshape);
   72|      0|    BLOSC_TRACE_ERROR("Invalid cell shape (meta) %d", (int) meta);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
   73|      0|    return BLOSC2_ERROR_FAILURE;
   74|      0|  }
   75|       |
   76|     16|  int8_t cellshape[8];
   77|     16|  int64_t cell_size = 1;  // 64-bit: prod(cellshape) can reach 127^ndim, which overflows int
   78|    144|  for (int i = 0; i < 8; ++i) {
  ------------------
  |  Branch (78:19): [True: 128, False: 16]
  ------------------
   79|    128|    if (i < ndim) {
  ------------------
  |  Branch (79:9): [True: 64, False: 64]
  ------------------
   80|     64|      cellshape[i] = (int8_t) meta;
   81|     64|      if (cellshape[i] > blockshape[i]) {
  ------------------
  |  Branch (81:11): [True: 0, False: 64]
  ------------------
   82|      0|        cellshape[i] = (int8_t) blockshape[i];
   83|      0|      }
   84|     64|      cell_size *= cellshape[i];
   85|     64|    } else {
   86|     64|      cellshape[i] = 1;
   87|     64|    }
   88|    128|  }
   89|       |  // See ndmean_backward(): validate the b2nd block geometry in 64-bit so a
   90|       |  // crafted blockshape cannot wrap a 32-bit product back onto `length` and make
   91|       |  // the index arithmetic below stray outside the `length`-sized buffers.
   92|     16|  int64_t blocksize = (int64_t) typesize;
   93|     80|  for (int i = 0; i < ndim; i++) {
  ------------------
  |  Branch (93:19): [True: 64, False: 16]
  ------------------
   94|     64|    if (blockshape[i] <= 0) {
  ------------------
  |  Branch (94:9): [True: 0, False: 64]
  ------------------
   95|      0|      free(shape);
   96|      0|      free(chunkshape);
   97|      0|      free(blockshape);
   98|      0|      BLOSC_TRACE_ERROR("Invalid blockshape[%d] = %d", i, blockshape[i]);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
   99|      0|      return BLOSC2_ERROR_FAILURE;
  100|      0|    }
  101|     64|    blocksize *= blockshape[i];
  102|     64|    if (blocksize > (int64_t) length) {
  ------------------
  |  Branch (102:9): [True: 0, False: 64]
  ------------------
  103|      0|      free(shape);
  104|      0|      free(chunkshape);
  105|      0|      free(blockshape);
  106|      0|      BLOSC_TRACE_ERROR("blockshape too large for block of %d bytes", length);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  107|      0|      return BLOSC2_ERROR_FAILURE;
  108|      0|    }
  109|     64|  }
  110|       |
  111|     16|  if ((int64_t) length != blocksize) {
  ------------------
  |  Branch (111:7): [True: 0, False: 16]
  ------------------
  112|      0|    free(shape);
  113|      0|    free(chunkshape);
  114|      0|    free(blockshape);
  115|      0|    BLOSC_TRACE_ERROR("Length not equal to blocksize %d %lld \n", length, (long long) blocksize);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  116|      0|    return BLOSC2_ERROR_FAILURE;
  117|      0|  }
  118|       |
  119|     16|  uint8_t *ip = (uint8_t *) input;
  120|     16|  float *ip_float = (float *) ip;
  121|     16|  double *ip_double = (double *) ip;
  122|     16|  uint8_t *op = (uint8_t *) output;
  123|     16|  uint8_t *op_limit = op + length;
  124|     16|  int64_t cell_length;
  125|     16|  float mean_float = 0;
  126|     16|  double mean_double = 0;
  127|       |
  128|       |
  129|     16|  if (length < cell_size * typesize) {
  ------------------
  |  Branch (129:7): [True: 0, False: 16]
  ------------------
  130|      0|    free(shape);
  131|      0|    free(chunkshape);
  132|      0|    free(blockshape);
  133|      0|    BLOSC_TRACE_ERROR("input and output buffer cannot be smaller than cell size");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  134|      0|    return BLOSC2_ERROR_FAILURE;
  135|      0|  }
  136|       |
  137|     16|  uint8_t *obase = op;
  138|       |
  139|     16|  int64_t i_shape[NDMEAN_MAX_DIM];
  140|     80|  for (int i = 0; i < ndim; ++i) {
  ------------------
  |  Branch (140:19): [True: 64, False: 16]
  ------------------
  141|     64|    i_shape[i] = (blockshape[i] + cellshape[i] - 1) / cellshape[i];
  142|     64|  }
  143|       |
  144|     16|  int64_t ncells = 1;
  145|     80|  for (int i = 0; i < ndim; ++i) {
  ------------------
  |  Branch (145:19): [True: 64, False: 16]
  ------------------
  146|     64|    ncells *= i_shape[i];
  147|     64|  }
  148|       |
  149|       |  /* main loop */
  150|     16|  int64_t pad_shape[NDMEAN_MAX_DIM];
  151|     16|  int64_t ii[NDMEAN_MAX_DIM];
  152|    272|  for (int cell_ind = 0; cell_ind < ncells; cell_ind++) {      // for each cell
  ------------------
  |  Branch (152:26): [True: 256, False: 16]
  ------------------
  153|    256|    blosc2_unidim_to_multidim(ndim, i_shape, cell_ind, ii);
  154|    256|    uint32_t orig = 0;
  155|    256|    int64_t nd_aux = (int64_t) (cellshape[0]);
  156|  1.28k|    for (int i = ndim - 1; i >= 0; i--) {
  ------------------
  |  Branch (156:28): [True: 1.02k, False: 256]
  ------------------
  157|  1.02k|      orig += ii[i] * nd_aux;
  158|  1.02k|      nd_aux *= blockshape[i];
  159|  1.02k|    }
  160|       |
  161|  1.28k|    for (int dim_ind = 0; dim_ind < ndim; dim_ind++) {
  ------------------
  |  Branch (161:27): [True: 1.02k, False: 256]
  ------------------
  162|  1.02k|      if ((blockshape[dim_ind] % cellshape[dim_ind] != 0) && (ii[dim_ind] == i_shape[dim_ind] - 1)) {
  ------------------
  |  Branch (162:11): [True: 0, False: 1.02k]
  |  Branch (162:62): [True: 0, False: 0]
  ------------------
  163|      0|        pad_shape[dim_ind] = blockshape[dim_ind] % cellshape[dim_ind];
  164|  1.02k|      } else {
  165|  1.02k|        pad_shape[dim_ind] = (int32_t) cellshape[dim_ind];
  166|  1.02k|      }
  167|  1.02k|    }
  168|    256|    int64_t ncopies = 1;
  169|  1.02k|    for (int i = 0; i < ndim - 1; ++i) {
  ------------------
  |  Branch (169:21): [True: 768, False: 256]
  ------------------
  170|    768|      ncopies *= pad_shape[i];
  171|    768|    }
  172|    256|    int64_t kk[8];
  173|    256|    mean_float = 0;
  174|    256|    mean_double = 0;
  175|  2.30k|    for (int copy_ind = 0; copy_ind < ncopies; ++copy_ind) {
  ------------------
  |  Branch (175:28): [True: 2.04k, False: 256]
  ------------------
  176|  2.04k|      blosc2_unidim_to_multidim((int8_t) (ndim - 1), pad_shape, copy_ind, kk);
  177|  2.04k|      nd_aux = blockshape[ndim - 1];
  178|  2.04k|      int64_t ind = orig;
  179|  8.19k|      for (int i = ndim - 2; i >= 0; i--) {
  ------------------
  |  Branch (179:30): [True: 6.14k, False: 2.04k]
  ------------------
  180|  6.14k|        ind += kk[i] * nd_aux;
  181|  6.14k|        nd_aux *= blockshape[i];
  182|  6.14k|      }
  183|       |
  184|  2.04k|      switch (typesize) {
  185|  2.04k|        case 4:
  ------------------
  |  Branch (185:9): [True: 2.04k, False: 0]
  ------------------
  186|  6.14k|          for (int i = 0; i < pad_shape[ndim - 1]; i++) {
  ------------------
  |  Branch (186:27): [True: 4.09k, False: 2.04k]
  ------------------
  187|  4.09k|            mean_float += ip_float[ind + i];
  188|  4.09k|          }
  189|  2.04k|          break;
  190|      0|        case 8:
  ------------------
  |  Branch (190:9): [True: 0, False: 2.04k]
  ------------------
  191|      0|          for (int i = 0; i < pad_shape[ndim - 1]; i++) {
  ------------------
  |  Branch (191:27): [True: 0, False: 0]
  ------------------
  192|      0|            mean_double += ip_double[ind + i];
  193|      0|          }
  194|      0|          break;
  195|      0|        default :
  ------------------
  |  Branch (195:9): [True: 0, False: 2.04k]
  ------------------
  196|      0|          break;
  197|  2.04k|      }
  198|       |
  199|  2.04k|    }
  200|    256|    cell_length = ncopies * pad_shape[ndim - 1];
  201|       |
  202|    256|    switch (typesize) {
  203|    256|      case 4:
  ------------------
  |  Branch (203:7): [True: 256, False: 0]
  ------------------
  204|    256|        mean_float /= (float) cell_length;
  205|  4.35k|        for (int i = 0; i < cell_length; i++) {
  ------------------
  |  Branch (205:25): [True: 4.09k, False: 256]
  ------------------
  206|  4.09k|          memcpy(op, &mean_float, typesize);
  207|  4.09k|          op += typesize;
  208|  4.09k|        }
  209|    256|        break;
  210|      0|      case 8:
  ------------------
  |  Branch (210:7): [True: 0, False: 256]
  ------------------
  211|      0|        mean_double /= (double) cell_length;
  212|      0|        for (int i = 0; i < cell_length; i++) {
  ------------------
  |  Branch (212:25): [True: 0, False: 0]
  ------------------
  213|      0|          memcpy(op, &mean_double, typesize);
  214|      0|          op += typesize;
  215|      0|        }
  216|      0|        break;
  217|      0|      default :
  ------------------
  |  Branch (217:7): [True: 0, False: 256]
  ------------------
  218|      0|        break;
  219|    256|    }
  220|       |
  221|    256|    if (op > op_limit) {
  ------------------
  |  Branch (221:9): [True: 0, False: 256]
  ------------------
  222|      0|      free(shape);
  223|      0|      free(chunkshape);
  224|      0|      free(blockshape);
  225|      0|      BLOSC_TRACE_ERROR("Exceeding output buffer limits!");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  226|      0|      return BLOSC2_ERROR_FAILURE;
  227|      0|    }
  228|    256|  }
  229|       |
  230|     16|  free(shape);
  231|     16|  free(chunkshape);
  232|     16|  free(blockshape);
  233|     16|  if ((op - obase) != length) {
  ------------------
  |  Branch (233:7): [True: 0, False: 16]
  ------------------
  234|      0|    BLOSC_TRACE_ERROR("Output size must be equal to input size");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  235|      0|    return BLOSC2_ERROR_FAILURE;
  236|      0|  }
  237|       |
  238|     16|  return BLOSC2_ERROR_SUCCESS;
  239|     16|}
ndmean_backward:
  243|     35|                   uint8_t id) {
  244|     35|  BLOSC_UNUSED_PARAM(id);
  ------------------
  |  |   28|     35|#define BLOSC_UNUSED_PARAM(x) ((void)(x))
  ------------------
  245|     35|  blosc2_schunk *schunk = dparams->schunk;
  246|     35|  int8_t ndim;
  247|       |  // b2nd_deserialize_meta() writes up to B2ND_MAX_DIM entries (it only validates
  248|       |  // ndim <= B2ND_MAX_DIM), so the destination buffers must be sized accordingly,
  249|       |  // not for NDMEAN_MAX_DIM.  Otherwise a crafted b2nd metalayer with
  250|       |  // NDMEAN_MAX_DIM < ndim <= B2ND_MAX_DIM overflows these allocations.
  251|     35|  int64_t *shape = malloc(B2ND_MAX_DIM * sizeof(int64_t));
  ------------------
  |  |   50|     35|#define B2ND_MAX_DIM 16
  ------------------
  252|     35|  int32_t *chunkshape = malloc(B2ND_MAX_DIM * sizeof(int32_t));
  ------------------
  |  |   50|     35|#define B2ND_MAX_DIM 16
  ------------------
  253|     35|  int32_t *blockshape = malloc(B2ND_MAX_DIM * sizeof(int32_t));
  ------------------
  |  |   50|     35|#define B2ND_MAX_DIM 16
  ------------------
  254|     35|  uint8_t *smeta;
  255|     35|  int32_t smeta_len;
  256|     35|  if (blosc2_meta_get(schunk, "b2nd", &smeta, &smeta_len) < 0) {
  ------------------
  |  Branch (256:7): [True: 3, False: 32]
  ------------------
  257|      3|    free(shape);
  258|      3|    free(chunkshape);
  259|      3|    free(blockshape);
  260|      3|    BLOSC_TRACE_ERROR("b2nd layer not found!");
  ------------------
  |  |   93|      3|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      3|    do {                                            \
  |  |  |  |   98|      3|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      3|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 3, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      3|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  261|      3|    return BLOSC2_ERROR_FAILURE;
  262|      3|  }
  263|     32|  if (b2nd_deserialize_meta(smeta, smeta_len, &ndim, shape, chunkshape, blockshape, NULL, NULL) < 0) {
  ------------------
  |  Branch (263:7): [True: 0, False: 32]
  ------------------
  264|      0|    free(smeta);
  265|      0|    free(shape);
  266|      0|    free(chunkshape);
  267|      0|    free(blockshape);
  268|      0|    BLOSC_TRACE_ERROR("Cannot deserialize b2nd metalayer");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  269|      0|    return BLOSC2_ERROR_FAILURE;
  270|      0|  }
  271|     32|  free(smeta);
  272|       |  // Guard the fixed-size (NDMEAN_MAX_DIM) stack arrays used below.
  273|     32|  if (ndim <= 0 || ndim > NDMEAN_MAX_DIM) {
  ------------------
  |  |   16|     32|#define NDMEAN_MAX_DIM 8
  ------------------
  |  Branch (273:7): [True: 0, False: 32]
  |  Branch (273:20): [True: 0, False: 32]
  ------------------
  274|      0|    free(shape);
  275|      0|    free(chunkshape);
  276|      0|    free(blockshape);
  277|      0|    BLOSC_TRACE_ERROR("ndim %d is out of range", ndim);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  278|      0|    return BLOSC2_ERROR_FAILURE;
  279|      0|  }
  280|       |
  281|       |  // `meta` carries the NDMEAN cell shape and is attacker-controlled (it is the
  282|       |  // chunk-header filters_meta byte).  It is cast to int8_t and used as the
  283|       |  // divisor when building i_shape[] below, so a value of 0 (divide-by-zero) or
  284|       |  // one that becomes negative after the cast (meta > INT8_MAX) would crash or
  285|       |  // produce bogus, out-of-range geometry (e.g. a negative pad_shape feeding a
  286|       |  // huge memcpy).  Require a positive cell shape.
  287|     32|  if ((int8_t) meta <= 0) {
  ------------------
  |  Branch (287:7): [True: 0, False: 32]
  ------------------
  288|      0|    free(shape);
  289|      0|    free(chunkshape);
  290|      0|    free(blockshape);
  291|      0|    BLOSC_TRACE_ERROR("Invalid cell shape (meta) %d", (int) meta);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  292|      0|    return BLOSC2_ERROR_FAILURE;
  293|      0|  }
  294|       |
  295|     32|  int8_t cellshape[8];
  296|     32|  int64_t cell_size = 1;  // 64-bit: prod(cellshape) can reach 127^ndim, which overflows int
  297|    288|  for (int i = 0; i < 8; ++i) {
  ------------------
  |  Branch (297:19): [True: 256, False: 32]
  ------------------
  298|    256|    if (i < ndim) {
  ------------------
  |  Branch (298:9): [True: 128, False: 128]
  ------------------
  299|    128|      cellshape[i] = (int8_t) meta;
  300|    128|      if (cellshape[i] > blockshape[i]) {
  ------------------
  |  Branch (300:11): [True: 0, False: 128]
  ------------------
  301|      0|        cellshape[i] = (int8_t) blockshape[i];
  302|      0|      }
  303|    128|      cell_size *= cellshape[i];
  304|    128|    } else {
  305|    128|      cellshape[i] = 1;
  306|    128|    }
  307|    256|  }
  308|       |
  309|     32|  int8_t typesize = (int8_t) schunk->typesize;
  310|     32|  uint8_t *ip = (uint8_t *) input;
  311|     32|  uint8_t *ip_limit = ip + length;
  312|     32|  uint8_t *op = (uint8_t *) output;
  313|     32|  if (typesize <= 0) {
  ------------------
  |  Branch (313:7): [True: 0, False: 32]
  ------------------
  314|      0|    free(shape);
  315|      0|    free(chunkshape);
  316|      0|    free(blockshape);
  317|      0|    BLOSC_TRACE_ERROR("Invalid typesize %d", typesize);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  318|      0|    return BLOSC2_ERROR_FAILURE;
  319|      0|  }
  320|       |  // The block geometry (blockshape) comes from the attacker-controlled "b2nd"
  321|       |  // metalayer and is NOT validated by b2nd_deserialize_meta().  Compute the
  322|       |  // block size in 64-bit and reject non-positive dimensions.  Otherwise a
  323|       |  // crafted blockshape whose 32-bit product wraps back onto `length` would pass
  324|       |  // the check below, while the scatter-write index arithmetic further down uses
  325|       |  // the true (huge) dimensions, writing past the `length`-sized output buffer
  326|       |  // (heap overflow).  Bailing as soon as the running product exceeds `length`
  327|       |  // also keeps the 64-bit multiply from overflowing.
  328|     32|  int64_t blocksize = (int64_t) typesize;
  329|    160|  for (int i = 0; i < ndim; i++) {
  ------------------
  |  Branch (329:19): [True: 128, False: 32]
  ------------------
  330|    128|    if (blockshape[i] <= 0) {
  ------------------
  |  Branch (330:9): [True: 0, False: 128]
  ------------------
  331|      0|      free(shape);
  332|      0|      free(chunkshape);
  333|      0|      free(blockshape);
  334|      0|      BLOSC_TRACE_ERROR("Invalid blockshape[%d] = %d", i, blockshape[i]);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  335|      0|      return BLOSC2_ERROR_FAILURE;
  336|      0|    }
  337|    128|    blocksize *= blockshape[i];
  338|    128|    if (blocksize > (int64_t) length) {
  ------------------
  |  Branch (338:9): [True: 0, False: 128]
  ------------------
  339|      0|      free(shape);
  340|      0|      free(chunkshape);
  341|      0|      free(blockshape);
  342|      0|      BLOSC_TRACE_ERROR("blockshape too large for block of %d bytes", length);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  343|      0|      return BLOSC2_ERROR_FAILURE;
  344|      0|    }
  345|    128|  }
  346|       |
  347|     32|  if ((int64_t) length != blocksize) {
  ------------------
  |  Branch (347:7): [True: 0, False: 32]
  ------------------
  348|      0|    free(shape);
  349|      0|    free(chunkshape);
  350|      0|    free(blockshape);
  351|      0|    BLOSC_TRACE_ERROR("Length not equal to blocksize");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  352|      0|    return BLOSC2_ERROR_FAILURE;
  353|      0|  }
  354|       |
  355|     32|  if (length < cell_size * typesize) {
  ------------------
  |  Branch (355:7): [True: 0, False: 32]
  ------------------
  356|      0|    free(shape);
  357|      0|    free(chunkshape);
  358|      0|    free(blockshape);
  359|      0|    BLOSC_TRACE_ERROR("input and output buffer cannot be smaller than cell size");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  360|      0|    return BLOSC2_ERROR_FAILURE;
  361|      0|  }
  362|       |
  363|     32|  int64_t i_shape[NDMEAN_MAX_DIM];
  364|    160|  for (int i = 0; i < ndim; ++i) {
  ------------------
  |  Branch (364:19): [True: 128, False: 32]
  ------------------
  365|    128|    i_shape[i] = (blockshape[i] + cellshape[i] - 1) / cellshape[i];
  366|    128|  }
  367|       |
  368|     32|  int64_t ncells = 1;
  369|    160|  for (int i = 0; i < ndim; ++i) {
  ------------------
  |  Branch (369:19): [True: 128, False: 32]
  ------------------
  370|    128|    ncells *= i_shape[i];
  371|    128|  }
  372|       |
  373|       |  /* main loop */
  374|     32|  int64_t pad_shape[NDMEAN_MAX_DIM] = {0};
  375|     32|  int64_t ii[NDMEAN_MAX_DIM];
  376|     32|  int32_t ind = 0;
  377|    544|  for (int cell_ind = 0; cell_ind < ncells; cell_ind++) {      // for each cell
  ------------------
  |  Branch (377:26): [True: 512, False: 32]
  ------------------
  378|       |
  379|    512|    if (ip > ip_limit) {
  ------------------
  |  Branch (379:9): [True: 0, False: 512]
  ------------------
  380|      0|      free(shape);
  381|      0|      free(chunkshape);
  382|      0|      free(blockshape);
  383|      0|      BLOSC_TRACE_ERROR("Exceeding input length!");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  384|      0|      return BLOSC2_ERROR_FAILURE;
  385|      0|    }
  386|    512|    blosc2_unidim_to_multidim(ndim, i_shape, cell_ind, ii);
  387|    512|    uint32_t orig = 0;
  388|    512|    int64_t nd_aux = (int64_t) (cellshape[0]);
  389|  2.56k|    for (int i = ndim - 1; i >= 0; i--) {
  ------------------
  |  Branch (389:28): [True: 2.04k, False: 512]
  ------------------
  390|  2.04k|      orig += ii[i] * nd_aux;
  391|  2.04k|      nd_aux *= blockshape[i];
  392|  2.04k|    }
  393|       |
  394|  2.56k|    for (int dim_ind = 0; dim_ind < ndim; dim_ind++) {
  ------------------
  |  Branch (394:27): [True: 2.04k, False: 512]
  ------------------
  395|  2.04k|      if ((blockshape[dim_ind] % cellshape[dim_ind] != 0) && (ii[dim_ind] == i_shape[dim_ind] - 1)) {
  ------------------
  |  Branch (395:11): [True: 0, False: 2.04k]
  |  Branch (395:62): [True: 0, False: 0]
  ------------------
  396|      0|        pad_shape[dim_ind] = blockshape[dim_ind] % cellshape[dim_ind];
  397|  2.04k|      } else {
  398|  2.04k|        pad_shape[dim_ind] = (int64_t) cellshape[dim_ind];
  399|  2.04k|      }
  400|  2.04k|    }
  401|       |
  402|    512|    int64_t ncopies = 1;
  403|  2.04k|    for (int i = 0; i < ndim - 1; ++i) {
  ------------------
  |  Branch (403:21): [True: 1.53k, False: 512]
  ------------------
  404|  1.53k|      ncopies *= pad_shape[i];
  405|  1.53k|    }
  406|    512|    int64_t kk[NDMEAN_MAX_DIM];
  407|  4.60k|    for (int copy_ind = 0; copy_ind < ncopies; ++copy_ind) {
  ------------------
  |  Branch (407:28): [True: 4.09k, False: 512]
  ------------------
  408|  4.09k|      blosc2_unidim_to_multidim((int8_t) (ndim - 1), pad_shape, copy_ind, kk);
  409|  4.09k|      nd_aux = blockshape[ndim - 1];
  410|  4.09k|      ind = (int32_t) orig;
  411|  16.3k|      for (int i = ndim - 2; i >= 0; i--) {
  ------------------
  |  Branch (411:30): [True: 12.2k, False: 4.09k]
  ------------------
  412|  12.2k|        ind += (int32_t) (kk[i] * nd_aux);
  413|  12.2k|        nd_aux *= blockshape[i];
  414|  12.2k|      }
  415|  4.09k|      memcpy(&op[ind * typesize], ip, pad_shape[ndim - 1] * typesize);
  416|  4.09k|      ip += pad_shape[ndim - 1] * typesize;
  417|  4.09k|    }
  418|    512|  }
  419|     32|  ind += (int32_t) pad_shape[ndim - 1];
  420|       |
  421|     32|  free(shape);
  422|     32|  free(chunkshape);
  423|     32|  free(blockshape);
  424|       |
  425|     32|  if (ind != (int32_t) (blocksize / typesize)) {
  ------------------
  |  Branch (425:7): [True: 0, False: 32]
  ------------------
  426|      0|    BLOSC_TRACE_ERROR("Output size is not compatible with embedded blockshape ind %d %lld \n",
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  427|      0|                      ind, (long long) (blocksize / typesize));
  428|      0|    return BLOSC2_ERROR_FAILURE;
  429|      0|  }
  430|       |
  431|     32|  return BLOSC2_ERROR_SUCCESS;
  432|     32|}

register_tuners:
   13|  1.96k|void register_tuners(void) {
   14|       |
   15|  1.96k|  blosc2_tuner btune;
   16|  1.96k|  btune.id = BLOSC_BTUNE;
   17|  1.96k|  btune.name = "btune";
   18|  1.96k|  btune.init = NULL;
   19|  1.96k|  btune.next_cparams = NULL;
   20|  1.96k|  btune.next_blocksize = NULL;
   21|  1.96k|  btune.update = NULL;
   22|  1.96k|  btune.free = NULL;
   23|       |
   24|  1.96k|  register_tuner_private(&btune);
   25|  1.96k|}

LLVMFuzzerTestOneInput:
   51|  1.96k|int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
   52|  1.96k|  tail_reader r = {data, size};
   53|       |
   54|  1.96k|  if (size < 16) {
  ------------------
  |  Branch (54:7): [True: 0, False: 1.96k]
  ------------------
   55|      0|    return 0;
   56|      0|  }
   57|       |
   58|  1.96k|  uint8_t mode = (uint8_t)(tail_u8(&r) % 2);
   59|  1.96k|  uint8_t typesize_sel = (uint8_t)(tail_u8(&r) % 4);
   60|       |
   61|  1.96k|  blosc2_init();
   62|  1.96k|  blosc2_set_nthreads(1);
   63|       |
   64|  1.96k|  if (mode == 1) {
  ------------------
  |  Branch (64:7): [True: 1.89k, False: 70]
  ------------------
   65|       |    /* Parser mode: untrusted b2nd frame; registered codecs and filters are
   66|       |     * selected by the frame's own header fields. */
   67|  1.89k|    b2nd_array_t *parsed = NULL;
   68|  1.89k|    if (b2nd_from_cframe((uint8_t *)data, (int64_t)size, false, &parsed) >= 0 &&
  ------------------
  |  Branch (68:9): [True: 0, False: 1.89k]
  ------------------
   69|      0|        parsed != NULL) {
  ------------------
  |  Branch (69:9): [True: 0, False: 0]
  ------------------
   70|      0|      uint8_t *buf = (uint8_t *)malloc(FUZZ_MAX_ITEMS * 8);
  ------------------
  |  |   36|      0|#define FUZZ_MAX_ITEMS 4096    /* cap on elements of any allocated buffer */
  ------------------
   71|      0|      if (buf != NULL) {
  ------------------
  |  Branch (71:11): [True: 0, False: 0]
  ------------------
   72|      0|        b2nd_to_cbuffer(parsed, buf, FUZZ_MAX_ITEMS * 8);
  ------------------
  |  |   36|      0|#define FUZZ_MAX_ITEMS 4096    /* cap on elements of any allocated buffer */
  ------------------
   73|      0|        free(buf);
   74|      0|      }
   75|      0|      b2nd_free(parsed);
   76|      0|    }
   77|  1.89k|    blosc2_destroy();
   78|  1.89k|    return 0;
   79|  1.89k|  }
   80|       |
   81|     70|  static const uint8_t typesizes[4] = {4, 8, 1, 2};
   82|     70|  static const uint8_t compcodes[7] = {
   83|     70|      BLOSC_BLOSCLZ, BLOSC_LZ4, BLOSC_ZSTD, BLOSC_CODEC_NDLZ,
   84|     70|      BLOSC_CODEC_ZFP_FIXED_ACCURACY, BLOSC_CODEC_ZFP_FIXED_PRECISION,
   85|     70|      BLOSC_CODEC_ZFP_FIXED_RATE};
   86|     70|  static const uint8_t filters[9] = {
   87|     70|      BLOSC_SHUFFLE, BLOSC_BITSHUFFLE, BLOSC_DELTA, BLOSC_TRUNC_PREC,
   88|     70|      BLOSC_FILTER_NDCELL, BLOSC_FILTER_NDMEAN, BLOSC_FILTER_BYTEDELTA,
   89|     70|      BLOSC_FILTER_BYTEDELTA_BUGGY, BLOSC_FILTER_INT_TRUNC};
   90|       |
   91|     70|  uint8_t comp_sel = (uint8_t)(tail_u8(&r) % 7);
   92|     70|  uint8_t raw_meta = tail_u8(&r);
   93|     70|  uint8_t filter_sel = (uint8_t)(tail_u8(&r) % 9);
   94|     70|  uint8_t filter_meta = tail_u8(&r);
   95|     70|  uint8_t clevel = (uint8_t)(tail_u8(&r) % 10);
   96|     70|  int8_t ndim = (int8_t)(tail_u8(&r) % FUZZ_MAX_DIM + 1);
  ------------------
  |  |   34|     70|#define FUZZ_MAX_DIM 4         /* ZFP_MAX_DIM */
  ------------------
   97|     70|  uint8_t typesize = typesizes[typesize_sel];
   98|       |
   99|     70|  uint8_t compcode = compcodes[comp_sel];
  100|     70|  bool is_zfp = (compcode == BLOSC_CODEC_ZFP_FIXED_ACCURACY ||
  ------------------
  |  Branch (100:18): [True: 3, False: 67]
  ------------------
  101|     67|                 compcode == BLOSC_CODEC_ZFP_FIXED_PRECISION ||
  ------------------
  |  Branch (101:18): [True: 16, False: 51]
  ------------------
  102|     51|                 compcode == BLOSC_CODEC_ZFP_FIXED_RATE);
  ------------------
  |  Branch (102:18): [True: 7, False: 44]
  ------------------
  103|     70|  if (is_zfp && typesize != 4 && typesize != 8) {
  ------------------
  |  Branch (103:7): [True: 26, False: 44]
  |  Branch (103:17): [True: 11, False: 15]
  |  Branch (103:34): [True: 8, False: 3]
  ------------------
  104|      8|    typesize = (typesize_sel % 2) ? 8 : 4;
  ------------------
  |  Branch (104:16): [True: 3, False: 5]
  ------------------
  105|      8|  }
  106|     70|  if (compcode == BLOSC_CODEC_NDLZ) {
  ------------------
  |  Branch (106:7): [True: 1, False: 69]
  ------------------
  107|      1|    ndim = 2;
  108|      1|    typesize = 1;
  109|      1|  }
  110|       |
  111|     70|  uint8_t compcode_meta = raw_meta;
  112|     70|  if (compcode == BLOSC_CODEC_NDLZ) {
  ------------------
  |  Branch (112:7): [True: 1, False: 69]
  ------------------
  113|      1|    compcode_meta = (uint8_t)((raw_meta % 2) ? 8 : 4);
  ------------------
  |  Branch (113:31): [True: 1, False: 0]
  ------------------
  114|     69|  } else if (compcode == BLOSC_CODEC_ZFP_FIXED_PRECISION) {
  ------------------
  |  Branch (114:14): [True: 16, False: 53]
  ------------------
  115|     16|    compcode_meta = (uint8_t)(raw_meta % (typesize * 8) + 1);
  116|     53|  } else if (compcode == BLOSC_CODEC_ZFP_FIXED_RATE) {
  ------------------
  |  Branch (116:14): [True: 7, False: 46]
  ------------------
  117|      7|    compcode_meta = (uint8_t)(raw_meta % 32 + 1);
  118|     46|  } else if (compcode == BLOSC_CODEC_ZFP_FIXED_ACCURACY) {
  ------------------
  |  Branch (118:14): [True: 3, False: 43]
  ------------------
  119|      3|    compcode_meta = (uint8_t)(raw_meta % 16);
  120|      3|  }
  121|       |
  122|     70|  int64_t shape[FUZZ_MAX_DIM] = {0};
  123|     70|  int32_t chunkshape[FUZZ_MAX_DIM] = {0};
  124|     70|  int32_t blockshape[FUZZ_MAX_DIM] = {0};
  125|     70|  int64_t total = 1;
  126|    323|  for (int8_t d = 0; d < ndim; d++) {
  ------------------
  |  Branch (126:22): [True: 253, False: 70]
  ------------------
  127|    253|    int64_t ext = (int64_t)(tail_u8(&r) % FUZZ_MAX_EXTENT + 1);
  ------------------
  |  |   35|    253|#define FUZZ_MAX_EXTENT 8      /* per-dimension bound */
  ------------------
  128|    253|    if (is_zfp && ext < 4) {
  ------------------
  |  Branch (128:9): [True: 86, False: 167]
  |  Branch (128:19): [True: 42, False: 44]
  ------------------
  129|     42|      ext = 4;
  130|     42|    }
  131|    253|    if (total * ext > FUZZ_MAX_ITEMS) {
  ------------------
  |  |   36|    253|#define FUZZ_MAX_ITEMS 4096    /* cap on elements of any allocated buffer */
  ------------------
  |  Branch (131:9): [True: 0, False: 253]
  ------------------
  132|      0|      ext = is_zfp ? 4 : 1;
  ------------------
  |  Branch (132:13): [True: 0, False: 0]
  ------------------
  133|      0|    }
  134|    253|    shape[d] = ext;
  135|    253|    if (is_zfp) {
  ------------------
  |  Branch (135:9): [True: 86, False: 167]
  ------------------
  136|     86|      chunkshape[d] = (int32_t)(ext >= 4 ? 4 : ext);
  ------------------
  |  Branch (136:33): [True: 86, False: 0]
  ------------------
  137|     86|      blockshape[d] = 4;
  138|    167|    } else if (compcode == BLOSC_CODEC_NDLZ) {
  ------------------
  |  Branch (138:16): [True: 2, False: 165]
  ------------------
  139|      2|      int32_t b = (compcode_meta == 8) ? 8 : 4;
  ------------------
  |  Branch (139:19): [True: 2, False: 0]
  ------------------
  140|      2|      chunkshape[d] = b;
  141|      2|      blockshape[d] = b;
  142|      2|      if (shape[d] < b) shape[d] = b;
  ------------------
  |  Branch (142:11): [True: 2, False: 0]
  ------------------
  143|    165|    } else {
  144|    165|      chunkshape[d] = (int32_t)(ext > 4 ? 4 : ext);
  ------------------
  |  Branch (144:33): [True: 124, False: 41]
  ------------------
  145|    165|      blockshape[d] = (int32_t)(ext > 2 ? 2 : ext);
  ------------------
  |  Branch (145:33): [True: 159, False: 6]
  ------------------
  146|    165|    }
  147|    253|    total *= shape[d];
  148|    253|  }
  149|       |
  150|     70|  uint8_t filter = filters[filter_sel];
  151|     70|  uint8_t f_meta = filter_meta;
  152|     70|  if (filter == BLOSC_FILTER_NDCELL || filter == BLOSC_FILTER_NDMEAN) {
  ------------------
  |  Branch (152:7): [True: 6, False: 64]
  |  Branch (152:40): [True: 1, False: 63]
  ------------------
  153|      7|    f_meta = (uint8_t)((filter_meta % 2) + 1);
  154|     63|  } else if (filter == BLOSC_FILTER_BYTEDELTA || filter == BLOSC_FILTER_BYTEDELTA_BUGGY) {
  ------------------
  |  Branch (154:14): [True: 1, False: 62]
  |  Branch (154:50): [True: 0, False: 62]
  ------------------
  155|      1|    f_meta = typesize;
  156|     62|  } else if (filter == BLOSC_FILTER_INT_TRUNC) {
  ------------------
  |  Branch (156:14): [True: 6, False: 56]
  ------------------
  157|      6|    f_meta = (uint8_t)(filter_meta % (typesize * 8));
  158|      6|  }
  159|       |
  160|     70|  blosc2_cparams cparams = BLOSC2_CPARAMS_DEFAULTS;
  161|     70|  cparams.typesize = typesize;
  162|     70|  cparams.clevel = clevel;
  163|     70|  cparams.compcode = compcode;
  164|     70|  cparams.compcode_meta = compcode_meta;
  165|     70|  cparams.filters[BLOSC2_MAX_FILTERS - 1] = filter;
  166|     70|  cparams.filters_meta[BLOSC2_MAX_FILTERS - 1] = f_meta;
  167|     70|  cparams.nthreads = 1;
  168|     70|  blosc2_dparams dparams = BLOSC2_DPARAMS_DEFAULTS;
  169|     70|  dparams.nthreads = 1;
  170|     70|  blosc2_storage storage = {.cparams = &cparams, .dparams = &dparams,
  171|     70|                            .contiguous = true};
  172|       |
  173|     70|  b2nd_context_t *ctx = b2nd_create_ctx(&storage, ndim, shape, chunkshape,
  174|     70|                                        blockshape, NULL, 0, NULL, 0);
  175|     70|  if (ctx == NULL) {
  ------------------
  |  Branch (175:7): [True: 0, False: 70]
  ------------------
  176|      0|    blosc2_destroy();
  177|      0|    return 0;
  178|      0|  }
  179|       |
  180|     70|  int64_t required_bytes = total * typesize;
  181|     70|  uint8_t *payload_buf = (uint8_t *)malloc((size_t)required_bytes);
  182|     70|  if (payload_buf == NULL) {
  ------------------
  |  Branch (182:7): [True: 0, False: 70]
  ------------------
  183|      0|    b2nd_free_ctx(ctx);
  184|      0|    blosc2_destroy();
  185|      0|    return 0;
  186|      0|  }
  187|     70|  const uint8_t *payload = data;
  188|     70|  size_t payload_len = r.size;
  189|     70|  if (payload_len > 0) {
  ------------------
  |  Branch (189:7): [True: 70, False: 0]
  ------------------
  190|  4.09k|    for (size_t i = 0; i < (size_t)required_bytes; i += payload_len) {
  ------------------
  |  Branch (190:24): [True: 4.02k, False: 70]
  ------------------
  191|  4.02k|      size_t chunk = ((size_t)required_bytes - i < payload_len) ? ((size_t)required_bytes - i) : payload_len;
  ------------------
  |  Branch (191:22): [True: 66, False: 3.95k]
  ------------------
  192|  4.02k|      memcpy(payload_buf + i, payload, chunk);
  193|  4.02k|    }
  194|     70|  } else {
  195|      0|    memset(payload_buf, 0, (size_t)required_bytes);
  196|      0|  }
  197|       |
  198|     70|  b2nd_array_t *arr = NULL;
  199|     70|  int rc = b2nd_from_cbuffer(ctx, &arr, payload_buf, required_bytes);
  200|     70|  free(payload_buf);
  201|     70|  if (rc >= 0 && arr != NULL) {
  ------------------
  |  Branch (201:7): [True: 69, False: 1]
  |  Branch (201:18): [True: 69, False: 0]
  ------------------
  202|     69|    uint8_t *buf = (uint8_t *)malloc((size_t)FUZZ_MAX_ITEMS * 8);
  ------------------
  |  |   36|     69|#define FUZZ_MAX_ITEMS 4096    /* cap on elements of any allocated buffer */
  ------------------
  203|     69|    if (buf != NULL) {
  ------------------
  |  Branch (203:9): [True: 69, False: 0]
  ------------------
  204|     69|      b2nd_to_cbuffer(arr, buf, (int64_t)FUZZ_MAX_ITEMS * 8);
  ------------------
  |  |   36|     69|#define FUZZ_MAX_ITEMS 4096    /* cap on elements of any allocated buffer */
  ------------------
  205|       |
  206|     69|      uint8_t *cframe = NULL;
  207|     69|      int64_t len = 0;
  208|     69|      bool needs_free = false;
  209|     69|      if (b2nd_to_cframe(arr, &cframe, &len, &needs_free) >= 0 && len > 0 &&
  ------------------
  |  Branch (209:11): [True: 69, False: 0]
  |  Branch (209:67): [True: 69, False: 0]
  ------------------
  210|     69|          cframe != NULL) {
  ------------------
  |  Branch (210:11): [True: 69, False: 0]
  ------------------
  211|     69|        b2nd_array_t *again = NULL;
  212|     69|        if (b2nd_from_cframe(cframe, len, false, &again) >= 0 &&
  ------------------
  |  Branch (212:13): [True: 69, False: 0]
  ------------------
  213|     69|            again != NULL) {
  ------------------
  |  Branch (213:13): [True: 69, False: 0]
  ------------------
  214|     69|          b2nd_to_cbuffer(again, buf, (int64_t)FUZZ_MAX_ITEMS * 8);
  ------------------
  |  |   36|     69|#define FUZZ_MAX_ITEMS 4096    /* cap on elements of any allocated buffer */
  ------------------
  215|     69|          b2nd_free(again);
  216|     69|        }
  217|     69|        if (needs_free) {
  ------------------
  |  Branch (217:13): [True: 0, False: 69]
  ------------------
  218|      0|          free(cframe);
  219|      0|        }
  220|     69|      }
  221|     69|      free(buf);
  222|     69|    }
  223|     69|  }
  224|       |  /* b2nd_empty inside b2nd_from_cbuffer may have assigned *array even on
  225|       |   * error; free it whenever it is set. */
  226|     70|  if (arr != NULL) {
  ------------------
  |  Branch (226:7): [True: 70, False: 0]
  ------------------
  227|     70|    b2nd_free(arr);
  228|     70|  }
  229|       |
  230|     70|  b2nd_free_ctx(ctx);
  231|     70|  blosc2_destroy();
  232|     70|  return 0;
  233|     70|}
fuzz_plugins.c:tail_u8:
   43|  4.60k|static uint8_t tail_u8(tail_reader *r) {
   44|  4.60k|  if (r->size == 0) {
  ------------------
  |  Branch (44:7): [True: 0, False: 4.60k]
  ------------------
   45|      0|    return 0;
   46|      0|  }
   47|  4.60k|  r->size--;
   48|  4.60k|  return r->data[r->size];
   49|  4.60k|}

